/* ============================================================
   CSS Variables
   ============================================================ */
:root {
    --bg-primary:    #fafaf9;
    --bg-secondary:  #f0ebe4;
    --bg-card:       #ffffff;
    --border:        rgba(8, 145, 178, 0.15);
    --border-hover:  rgba(8, 145, 178, 0.45);
    --accent:        #0891b2;
    --accent-dim:    #0e7490;
    --accent-glow:   rgba(8, 145, 178, 0.07);
    --accent-glow2:  rgba(8, 145, 178, 0.13);
    --green:         #16a34a;
    --green-glow:    rgba(22, 163, 74, 0.07);
    --text-primary:  #1c1917;
    --text-secondary:#57534e;
    --text-muted:    #a8a29e;
    --font-body:     'Space Grotesk', system-ui, sans-serif;
    --font-mono:     'JetBrains Mono', monospace;
    --nav-h:         64px;
    --max-w:         1100px;
    --radius:        14px;
    --radius-sm:     8px;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: #7dd3fc; }

img { max-width: 100%; display: block; }

/* ============================================================
   Navbar
   ============================================================ */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--nav-h);
    z-index: 100;
    transition: background 0.35s, border-bottom 0.35s, backdrop-filter 0.35s;
}

.navbar.scrolled {
    background: rgba(250, 250, 249, 0.90);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.nav-container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 28px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-logo {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 500;
    color: var(--accent);
    letter-spacing: 0.08em;
    margin-right: auto;
    user-select: none;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 4px;
}

.nav-links a {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-secondary);
    padding: 6px 16px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent);
    background: var(--accent-glow2);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: 0.3s;
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* subtle gradient bottom fade into next section */
.hero::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 160px;
    background: linear-gradient(to bottom, transparent, var(--bg-primary));
    pointer-events: none;
    z-index: 1;
}

#heroCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: var(--max-w);
    margin: 0 auto;
    padding: calc(var(--nav-h) + 20px) 28px 80px;
    display: flex;
    align-items: center;
    gap: 64px;
}

/* Profile photo */
.hero-photo-wrap {
    flex-shrink: 0;
    position: relative;
}

.hero-photo-wrap::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    background: conic-gradient(var(--accent), transparent, var(--accent-dim), transparent, var(--accent));
    animation: spin 8s linear infinite;
    opacity: 0.35;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hero-photo {
    width: 210px;
    height: 210px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(8, 145, 178, 0.5);
    box-shadow: 0 0 50px rgba(8, 145, 178, 0.15);
    position: relative;
    background: linear-gradient(135deg, #0f2040 0%, #1a3a60 100%);
}

/* Hero text */
.hero-name {
    font-size: clamp(38px, 5vw, 58px);
    font-weight: 700;
    line-height: 1.08;
    margin-bottom: 10px;
    letter-spacing: -0.02em;
    background: linear-gradient(100deg, var(--text-primary) 40%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-title {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 22px;
}

.hero-bio {
    font-size: 16px;
    color: var(--text-secondary);
    max-width: 560px;
    margin-bottom: 34px;
    line-height: 1.85;
}

.hero-bio .highlight {
    color: var(--accent);
    font-weight: 500;
}

.hero-bio a {
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-hover);
    transition: color 0.2s, border-color 0.2s;
}

.hero-bio a:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* Social buttons */
.social-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.social-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    background: var(--accent-glow);
    transition: all 0.22s;
}

.social-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-glow2);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(8, 145, 178, 0.10);
}

.social-btn i {
    font-size: 16px;
}

/* Scroll hint */
.hero-scroll-hint {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50%       { transform: translateX(-50%) translateY(6px); }
}

/* ============================================================
   Section scaffolding
   ============================================================ */
.section { padding: 48px 0; position: relative; }

.section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--accent), transparent);
    opacity: 0.25;
}

.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 28px;
}

.section-header { margin-bottom: 36px; }

.section-title {
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* ============================================================
   Page edge glow
   ============================================================ */
.page-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 99;
    background:
        radial-gradient(ellipse 50% 65% at 0% 38%,   rgba(251, 211, 61, 0.11) 0%, transparent 55%),
        radial-gradient(ellipse 50% 65% at 100% 68%, rgba(251, 211, 61, 0.11) 0%, transparent 55%);
}

/* ============================================================
   News
   ============================================================ */
.news-list {
    list-style: none;
    border-top: 1px solid var(--border);
}

.news-item {
    display: flex;
    align-items: baseline;
    gap: 24px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.news-date {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent);
    white-space: nowrap;
    width: 68px;
    flex-shrink: 0;
}

.news-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.65;
}

.news-text a {
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-hover);
    transition: color 0.2s, border-color 0.2s;
}

.news-text a:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* ============================================================
   Publications
   ============================================================ */
.pub-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pub-card {
    display: flex;
    gap: 28px;
    padding: 28px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
}

.pub-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 36px rgba(8, 145, 178, 0.07);
}

.pub-thumb {
    flex-shrink: 0;
    width: 210px;
    height: 140px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
}

.pub-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pub-info { flex: 1; min-width: 0; }

.pub-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 9px;
    line-height: 1.45;
}

.pub-authors {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 9px;
    line-height: 1.5;
}

.pub-venue {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.venue-tag {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    color: var(--accent);
    background: var(--accent-glow2);
    border: 1px solid var(--border);
    padding: 2px 9px;
    border-radius: 5px;
}

.venue-tag-workshop {
    color: var(--green);
    background: var(--green-glow);
}

.pub-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pub-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    padding: 5px 13px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.pub-link:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-glow);
}

/* ============================================================
   Projects
   ============================================================ */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 24px;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
}

.project-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: 0 14px 48px rgba(8, 145, 178, 0.09);
}

.project-media {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: var(--bg-primary);
}

.project-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s;
}

.project-card:hover .project-media img {
    transform: scale(1.04);
}

.project-info { padding: 22px; }

.project-info h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 9px;
    line-height: 1.4;
}

.project-info > p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.65;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.tag {
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 5px;
    background: var(--accent-glow);
    color: var(--accent);
    border: 1px solid var(--border);
}

.project-links {
    display: flex;
    gap: 16px;
}

.project-links a {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}

.project-links a:hover { color: var(--accent); }

/* ============================================================
   Experience / Timeline
   ============================================================ */
.timeline {
    position: relative;
    padding-left: 36px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 9px;
    top: 10px;
    bottom: 10px;
    width: 1px;
    background: linear-gradient(to bottom,
        var(--accent) 0%,
        rgba(56, 189, 248, 0.15) 80%,
        transparent 100%);
}

.timeline-item {
    position: relative;
    margin-bottom: 24px;
}

.timeline-item:last-child { margin-bottom: 0; }

.timeline-dot {
    position: absolute;
    left: -31px;
    top: 20px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-primary);
    box-shadow: 0 0 14px var(--accent);
    transition: transform 0.2s;
}

.timeline-item:hover .timeline-dot {
    transform: scale(1.3);
}

.timeline-dot-ta {
    background: var(--green);
    box-shadow: 0 0 14px var(--green);
}

.timeline-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 28px;
    transition: border-color 0.25s, box-shadow 0.25s;
}

.timeline-content:hover {
    border-color: var(--border-hover);
    box-shadow: 0 6px 28px rgba(8, 145, 178, 0.06);
}

/* top row: org name + date(s) */
.timeline-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.timeline-top-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.timeline-logo {
    height: 44px;
    width: auto;
    max-width: 72px;
    object-fit: contain;
    border-radius: 6px;
    flex-shrink: 0;

}

.timeline-org {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
}

/* date badge(s) */
.timeline-dates {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    flex-shrink: 0;
}

.timeline-date {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent);
    background: var(--accent-glow2);
    border: 1px solid var(--border);
    padding: 3px 11px;
    border-radius: 20px;
    white-space: nowrap;
}

.timeline-date-prev {
    opacity: 0.55;
}

/* metadata rows below the org name */
.timeline-role {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.timeline-role-note {
    font-weight: 400;
    font-size: 13px;
    color: var(--text-secondary);
}

.timeline-advisor {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent);
    opacity: 0.8;
    margin-bottom: 3px;
}

.timeline-inst {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.timeline-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.75;
}

.timeline-bullets {
    list-style: none;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.timeline-bullets li {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
    padding-left: 18px;
    position: relative;
}

.timeline-bullets li::before {
    content: '▸';
    position: absolute;
    left: 0;
    top: 2px;
    color: var(--accent);
    font-size: 11px;
}

.timeline-bullets strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* ============================================================
   Academic Service
   ============================================================ */
.service-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.service-block {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 28px;
    transition: border-color 0.25s;
}

.service-block:hover {
    border-color: var(--border-hover);
}

.service-subtitle {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.service-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.service-list li {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    padding-left: 18px;
    position: relative;
}

.service-list li::before {
    content: '▸';
    position: absolute;
    left: 0;
    top: 2px;
    color: var(--accent);
    font-size: 11px;
}

.service-count {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent);
    background: var(--accent-glow2);
    border: 1px solid var(--border);
    padding: 1px 7px;
    border-radius: 4px;
    margin-right: 5px;
}

@media (max-width: 600px) {
    .service-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Awards & Honors
   ============================================================ */
.awards-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.award-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.25s, box-shadow 0.25s;
}

.award-item:hover {
    border-color: var(--border-hover);
    box-shadow: 0 6px 28px rgba(8, 145, 178, 0.06);
}

.award-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.award-icon {
    font-size: 20px;
    color: #fbbf24;
    flex-shrink: 0;
    width: 40px;
    text-align: center;
}

.award-logo {
    height: 40px;
    width: 40px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 6px;
}

.award-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.award-org {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
}

.award-year {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent);
    background: var(--accent-glow2);
    border: 1px solid var(--border);
    padding: 3px 11px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
    padding: 36px 0;
    text-align: center;
}

.footer p {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
}

/* ============================================================
   Fade-in on scroll
   ============================================================ */
.fade-in {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.55s ease, transform 0.55s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* stagger delay for grid children */
.projects-grid .project-card:nth-child(2) { transition-delay: 0.08s; }
.projects-grid .project-card:nth-child(3) { transition-delay: 0.16s; }
.projects-grid .project-card:nth-child(4) { transition-delay: 0.24s; }

.pub-list .pub-card:nth-child(2) { transition-delay: 0.08s; }
.pub-list .pub-card:nth-child(3) { transition-delay: 0.16s; }

.timeline .timeline-item:nth-child(2) { transition-delay: 0.08s; }
.timeline .timeline-item:nth-child(3) { transition-delay: 0.16s; }
.timeline .timeline-item:nth-child(4) { transition-delay: 0.24s; }
.timeline .timeline-item:nth-child(5) { transition-delay: 0.32s; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 820px) {
    .hero-content {
        flex-direction: column;
        text-align: center;
        padding-top: calc(var(--nav-h) + 48px);
        padding-bottom: 100px;
        gap: 36px;
    }

    .hero-bio {
        margin-left: auto;
        margin-right: auto;
    }

    .social-links { justify-content: center; }

    .pub-card {
        flex-direction: column;
    }

    .pub-thumb {
        width: 100%;
        height: 180px;
    }

    .timeline-header { flex-direction: column; }

    .nav-links {
        display: none;
        position: absolute;
        top: var(--nav-h);
        left: 0; right: 0;
        background: rgba(250, 250, 249, 0.97);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        flex-direction: column;
        padding: 16px 20px 24px;
        border-bottom: 1px solid var(--border);
        gap: 4px;
    }

    .nav-links.open { display: flex; }

    .nav-toggle { display: flex; }
}

@media (max-width: 480px) {
    .hero-photo { width: 160px; height: 160px; }
    .hero-photo-wrap::before { inset: -6px; }
    .social-btn span { display: none; }
    .social-btn { padding: 9px 13px; }
    .projects-grid { grid-template-columns: 1fr; }
}
