/* ============================================
   Design system
   ============================================ */
:root {
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Plus Jakarta Sans', 'Inter', sans-serif;
    --font-display-name: 'Great Vibes', 'Segoe Script', cursive;
    /* 中文题名：行楷飘逸 + 行书大气（web 字体 + 系统行楷/楷体回退） */
    --font-hand-cn: 'Zhi Mang Xing', 'Long Cang', 'STXingkai', 'Kaiti SC', 'KaiTi', 'STKaiti', serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 22px;
    --radius-xl: 28px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
    --shadow-lg: 0 24px 64px rgba(0,0,0,0.12), 0 8px 24px rgba(0,0,0,0.06);

    --layout-max: min(980px, calc(100vw - 40px));
    --content-column: var(--layout-max);
    --gap-section: clamp(28px, 4vw, 52px);

    /* Light theme (default) */
    --bg-base: #f6f7fb;
    --bg-primary: #f6f7fb;
    --bg-secondary: #ffffff;
    --bg-tertiary: #eef0f5;
    --bg-card: rgba(255, 255, 255, 0.72);
    --bg-card-solid: #ffffff;
    --bg-card-hover: rgba(255, 255, 255, 0.92);
    --bg-nav: rgba(255, 255, 255, 0.65);

    --text-primary: #0c0f16;
    --text-secondary: #4a5060;
    --text-tertiary: #8b909e;

    --accent: #3b5bdb;
    --accent-hover: #2f4ac4;
    --accent-soft: rgba(59, 91, 219, 0.12);
    --accent-glow: rgba(59, 91, 219, 0.28);
    --accent-secondary: #e040fb;

    --border: rgba(12, 15, 22, 0.08);
    --border-strong: rgba(12, 15, 22, 0.14);

    --pill-bg: rgba(59, 91, 219, 0.08);
    --pill-text: #3b5bdb;
    --pill-border: rgba(59, 91, 219, 0.2);

    --news-date-bg: rgba(59, 91, 219, 0.1);
    --news-date-text: #2f42a8;
    --news-line: rgba(59, 91, 219, 0.22);

    --pub-venue: #0d9488;
    --pub-a: #3b5bdb;
    --pub-b: #7c3aed;
    --pub-c: #db2777;
    --pub-d: #ea580c;
    --pub-e: #0891b2;
    --pub-f: #4f46e5;
    --pub-g: #6366f1;
    --pub-h: #0284c7;
    --pub-i: #b45309;

    --grain-opacity: 0.035;
    --grid-line: rgba(12, 15, 22, 0.04);
}

html[data-theme="dark"] {
    /* Dark = black canvas + gold accents + purple highlights (former mamba-2) */
    --bg-base: #000000;
    --bg-primary: #000000;
    --bg-secondary: #000000;
    --bg-tertiary: #080808;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-solid: #050505;
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --bg-nav: rgba(0, 0, 0, 0.94);

    --text-primary: #f5f5f6;
    --text-secondary: #a5a5ad;
    --text-tertiary: #6e6e76;

    --accent: #ecc458;
    --accent-hover: #f5d87a;
    --accent-soft: rgba(236, 204, 88, 0.14);
    --accent-glow: rgba(201, 171, 255, 0.34);
    --accent-secondary: #c9abff;

    --border: rgba(255, 255, 255, 0.06);
    --border-strong: rgba(201, 171, 255, 0.28);

    --pill-bg: rgba(236, 204, 88, 0.11);
    --pill-text: #f5e2a0;
    --pill-border: rgba(201, 171, 255, 0.32);

    --news-date-bg: rgba(201, 171, 255, 0.1);
    --news-date-text: #dcc8ff;
    --news-line: rgba(201, 171, 255, 0.36);

    --pub-venue: #5eead4;
    --pub-a: #ecc458;
    --pub-b: #c4b5fd;
    --pub-c: #f9a8d4;
    --pub-d: #fdba74;
    --pub-e: #67e8f9;
    --pub-f: #d4b8ff;
    --pub-g: #c9abff;
    --pub-h: #38bdf8;
    --pub-i: #fbbf24;

    --grain-opacity: 0.05;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.35);
    --shadow-md: 0 8px 28px rgba(0,0,0,0.45);
    --shadow-lg: 0 28px 80px rgba(0,0,0,0.55);
    --grid-line: rgba(236, 204, 88, 0.035);
}


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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-primary);
    background: var(--bg-base);
    transition: background 0.45s var(--ease-out), color 0.45s var(--ease-out);
    overflow-x: hidden;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

strong {
    font-weight: 600;
}

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

::selection {
    background: var(--accent);
    color: #fff;
}

/* ============================================
   Ambient background
   ============================================ */
.ambient-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.ambient-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 70% 60% at 50% 20%, black 0%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 20%, black 0%, transparent 75%);
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(72px);
    opacity: 0.55;
    animation: orbFloat 22s ease-in-out infinite;
}

.orb-1 {
    width: min(52vw, 520px);
    height: min(52vw, 520px);
    top: -8%;
    right: -12%;
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    animation-delay: 0s;
}

.orb-2 {
    width: min(40vw, 400px);
    height: min(40vw, 400px);
    bottom: 18%;
    left: -10%;
    background: radial-gradient(circle, var(--accent-secondary) 0%, transparent 70%);
    animation-delay: -7s;
    opacity: 0.4;
}

.orb-3 {
    width: min(30vw, 300px);
    height: min(30vw, 300px);
    top: 42%;
    left: 38%;
    background: radial-gradient(circle, #22d3ee 0%, transparent 70%);
    animation-delay: -14s;
    opacity: 0.22;
}

html[data-theme="dark"] .orb-3 {
    background: radial-gradient(circle, var(--accent-secondary) 0%, transparent 70%);
    opacity: 0.16;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(3%, -4%) scale(1.05); }
    66% { transform: translate(-4%, 2%) scale(0.96); }
}

/* ============================================
   Grain
   ============================================ */
.grain-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: var(--grain-opacity);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url('/proxy/aHR0cHM6Ly9zaGl5aWNhby5jb20vJTIzbm9pc2U')'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ============================================
   Navbar
   ============================================ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 12px clamp(14px, 3vw, 24px);
    transition: padding 0.35s var(--ease-out), background 0.35s var(--ease-out), border-color 0.35s ease, backdrop-filter 0.35s ease;
}

.navbar.scrolled {
    padding-top: 8px;
    padding-bottom: 8px;
    background: var(--bg-nav);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    max-width: var(--layout-max);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
}

.nav-logo {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    justify-self: start;
    padding: 4px 0;
    transition: color 0.2s ease;
}

.nav-logo:hover {
    color: var(--accent);
}

.nav-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
}

.nav-center a {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    padding: 6px 11px;
    border-radius: var(--radius-full);
    position: relative;
    transition: color 0.2s ease, background 0.2s ease;
}

.nav-center a:hover {
    color: var(--text-primary);
    background: var(--accent-soft);
}

.nav-actions {
    justify-self: end;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.theme-toggle {
    flex-shrink: 0;
    background: var(--bg-card-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 7px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s var(--ease-spring), border-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

html[data-theme="dark"] .icon-sun { display: block; }
html[data-theme="dark"] .icon-moon { display: none; }
html[data-theme="light"] .icon-sun,
:root .icon-sun { display: none; }
html[data-theme="light"] .icon-moon,
:root .icon-moon { display: block; }

/* ============================================
   Hero (dense: photo left, copy right)
   ============================================ */
.hero {
    position: relative;
    z-index: 5;
    padding: clamp(76px, 12vh, 100px) clamp(14px, 3vw, 24px) clamp(24px, 3vw, 36px);
}

.hero-shell {
    max-width: var(--layout-max);
    margin: 0 auto;
}

.hero-dense {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: clamp(18px, 2.5vw, 28px);
    align-items: start;
}

.hero-photo-link {
    grid-row: 1;
    grid-column: 1;
    display: block;
    width: 312px;
    max-width: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    line-height: 0;
}

.hero-photo-link:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}

.hero-photo-link .hero-photo {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    transition: transform 0.35s var(--ease-out);
}

.hero-photo-link:hover .hero-photo {
    transform: scale(1.03);
}

.hero-copy-dense {
    grid-row: 1;
    grid-column: 2;
    min-width: 0;
}

.hero-name {
    font-size: clamp(2.35rem, 6.5vw, 3.35rem);
    line-height: 1.18;
    margin-bottom: 8px;
}

.hero-name-line {
    font-family: var(--font-display-name);
    font-style: normal;
    font-weight: 400;
    letter-spacing: 0.02em;
    background: linear-gradient(125deg, var(--text-primary) 0%, var(--text-primary) 38%, var(--accent) 62%, var(--accent-secondary) 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 14s ease-in-out infinite alternate;
}

.hero-name-cn {
    display: inline;
    font-family: var(--font-sans);
    font-size: 0.5em;
    font-weight: 600;
    letter-spacing: 0.28em;
    color: var(--text-tertiary);
    margin-left: 0.35em;
    vertical-align: baseline;
    -webkit-text-fill-color: var(--text-tertiary);
    background: none;
    animation: none;
}

.hero-affil {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 8px;
    max-width: 62ch;
}

.hero-bio {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 0;
    max-width: 65ch;
}

.hero-bio + .hero-bio {
    margin-top: 8px;
}

.hero-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
    padding-top: 2px;
}

.link-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--pill-text);
    background: var(--pill-bg);
    border: 1px solid var(--pill-border);
    border-radius: var(--radius-full);
    transition: all 0.28s var(--ease-out);
}

.link-pill svg {
    flex-shrink: 0;
    opacity: 0.85;
    width: 14px;
    height: 14px;
}

.link-pill:hover {
    color: #fff;
    background: linear-gradient(135deg, var(--accent) 0%, #6366f1 100%);
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px var(--accent-glow);
}

@keyframes shimmer {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

/* ============================================
   Section shell (editorial layout)
   ============================================ */
.section {
    position: relative;
    z-index: 5;
    padding: var(--gap-section) clamp(16px, 4vw, 32px);
}

.section-alt {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

.section-shell {
    max-width: var(--layout-max);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: clamp(12px, 2vw, 20px);
    align-items: stretch;
}

.section-heading {
    min-width: 0;
    padding-top: 2px;
    margin-bottom: clamp(4px, 1vw, 8px);
}

.rail-title {
    font-family: var(--font-display);
    font-size: clamp(1.45rem, 3.2vw, 1.85rem);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.12;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.rail-number {
    display: block;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.12em;
    color: var(--accent);
    margin-bottom: 6px;
}

.rail-desc {
    font-size: 13px;
    color: var(--text-tertiary);
    line-height: 1.45;
}

.section-body {
    min-width: 0;
}

/* ============================================
   Timeline / news (horizontal track + archive list)
   ============================================ */
.timeline {
    position: relative;
    width: 100%;
    max-width: var(--content-column);
    margin-inline: auto;
    isolation: isolate;
}

.timeline-track {
    position: relative;
    --timeline-pad-x: 0px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: visible;
    padding: 26px 0 22px;
    margin: 0 0 4px;
    scroll-padding-inline: 0;
    scroll-snap-type: inline proximity;
    -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(
        90deg,
        transparent 0,
        black 10px,
        black calc(100% - 10px),
        transparent 100%
    );
    mask-image: linear-gradient(
        90deg,
        transparent 0,
        black 10px,
        black calc(100% - 10px),
        transparent 100%
    );
}

/* In-flow row: full scroll width so the rail (::before/::after) moves with horizontal scroll. */
.timeline-track-row {
    position: relative;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: center;
    gap: 16px;
    width: max-content;
    min-width: 100%;
    box-sizing: border-box;
}

/* Glow rail (horizontal, centered on track — cards alternate above / below) */
.timeline-track-row::before {
    content: '';
    position: absolute;
    left: var(--timeline-pad-x);
    right: var(--timeline-pad-x);
    top: 50%;
    transform: translateY(-50%);
    height: 3px;
    width: auto;
    border-radius: 4px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        color-mix(in srgb, var(--accent) 70%, var(--news-line)) 8%,
        var(--news-line) 22%,
        var(--news-line) 78%,
        color-mix(in srgb, var(--news-line) 55%, transparent) 92%,
        transparent 100%
    );
    background-size: 240% 100%;
    box-shadow:
        0 0 20px color-mix(in srgb, var(--accent) 18%, transparent),
        inset 0 1px 0 color-mix(in srgb, white 12%, transparent);
    animation: timeline-rail-flow-h 8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes timeline-rail-flow-h {
    0%,
    100% {
        background-position: 55% 0;
    }
    50% {
        background-position: 0% 0;
    }
}

/* Traveling light along the rail (right → left) */
.timeline-track-row::after {
    content: '';
    position: absolute;
    top: 50%;
    left: auto;
    right: var(--timeline-pad-x);
    width: 56px;
    height: 7px;
    margin-top: -3.5px;
    border-radius: 4px;
    pointer-events: none;
    background: linear-gradient(
        90deg,
        transparent 0%,
        color-mix(in srgb, var(--accent) 90%, white) 48%,
        transparent 100%
    );
    opacity: 0;
    filter: blur(5px);
    animation: timeline-pulse-h 4.6s ease-in-out infinite;
}

@keyframes timeline-pulse-h {
    0% {
        transform: translateX(0);
        opacity: 0;
    }
    12% {
        opacity: 0.85;
    }
    42% {
        transform: translateX(-180px);
        opacity: 0.65;
    }
    55% {
        opacity: 0.2;
    }
    100% {
        transform: translateX(-360px);
        opacity: 0;
    }
}

.timeline-track-row > .news-item {
    position: relative;
    flex: 0 0 min(260px, 78vw);
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
    gap: clamp(14px, 3.2vw, 24px);
    min-height: clamp(11.75rem, 29vw, 14.5rem);
    padding: 8px 0 10px;
    box-sizing: border-box;
}

.timeline-track-row > .news-item:nth-child(even) {
    flex-direction: column-reverse;
}

/* Milestone node on horizontal rail (column vertical center) */
.timeline-track-row > .news-item::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: radial-gradient(
        circle at 32% 32%,
        color-mix(in srgb, var(--accent) 22%, white),
        var(--accent) 58%
    );
    border: 2px solid color-mix(in srgb, var(--accent) 55%, var(--bg-card-solid));
    box-shadow:
        0 0 0 3px var(--accent-soft),
        0 0 20px color-mix(in srgb, var(--accent) 35%, transparent),
        inset 0 -1px 2px rgba(0, 0, 0, 0.12);
    transition: transform 0.4s var(--ease-out), box-shadow 0.35s ease, border-color 0.3s ease;
    z-index: 1;
}

.timeline-track-row > .news-item.animate-in.visible::before {
    animation: timeline-node-pop-h 0.65s var(--ease-out) both;
}

@keyframes timeline-node-pop-h {
    0% {
        transform: translate(-50%, -50%) scale(0.35);
        opacity: 0;
    }
    70% {
        transform: translate(-50%, -50%) scale(1.08);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.timeline-track-row > .news-item:hover::before {
    transform: translate(-50%, -50%) scale(1.14);
    border-color: var(--accent);
    box-shadow:
        0 0 0 4px var(--accent-soft),
        0 0 28px color-mix(in srgb, var(--accent) 45%, transparent);
}

.timeline-track-row > .news-item .news-date {
    align-self: center;
    text-align: center;
    margin: 0;
}

.timeline-track-row > .news-item:hover .news-date {
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent);
}

.timeline-track-row > .news-item .news-card .news-text {
    text-align: center;
}

.timeline-track-row > .news-item:nth-child(odd) .news-card::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    transform: translate(-50%, 0);
    width: min(120px, 48%);
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--accent) 42%,
        color-mix(in srgb, var(--accent) 55%, transparent) 100%
    );
    opacity: 0.4;
    transition: opacity 0.3s ease, width 0.3s ease;
}

.timeline-track-row > .news-item:nth-child(even) .news-card::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    top: auto;
    transform: translate(-50%, 0);
    width: min(120px, 48%);
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: linear-gradient(
        90deg,
        transparent,
        var(--accent) 42%,
        color-mix(in srgb, var(--accent) 55%, transparent) 100%
    );
    opacity: 0.4;
    transition: opacity 0.3s ease, width 0.3s ease;
}

.timeline-track-row > .news-item:hover .news-card::after {
    opacity: 0.85;
}

.timeline-track-row > .news-item:hover .news-card {
    border-color: color-mix(in srgb, var(--accent) 25%, var(--border));
    box-shadow: var(--shadow-md), 0 0 32px color-mix(in srgb, var(--accent) 8%, transparent);
    transform: translateY(-3px);
}

.timeline-track-row > .news-item:nth-child(even):hover .news-card {
    transform: translateY(3px);
}

.news-date {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--news-date-text);
    background: var(--news-date-bg);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    text-align: center;
    margin-top: 0;
    align-self: center;
    transition: box-shadow 0.3s ease, transform 0.25s var(--ease-out);
}

.news-card {
    position: relative;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    min-height: 3.25rem;
    transition: border-color 0.25s ease, box-shadow 0.35s ease, transform 0.35s var(--ease-out);
    overflow: hidden;
}

.news-text {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.55;
    position: relative;
    z-index: 1;
}

/* Earlier highlights: vertical list */
.news-archive-inner .news-item {
    position: relative;
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 6px 12px;
    align-items: center;
    padding-bottom: 10px;
    max-width: 100%;
}

.news-archive-inner .news-item::before {
    display: none;
}

.news-archive-inner .news-item .news-card::after {
    display: none;
}

.news-archive-inner .news-item:hover .news-card {
    transform: translateX(4px);
}

.news-archive-inner .news-item:hover .news-date {
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent);
}

/* Collapsed older news */
.news-archive {
    position: relative;
    margin-top: 10px;
    padding-bottom: 2px;
}

.news-archive-summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    padding: 8px 10px;
    margin-left: 0;
    width: 100%;
    max-width: 100%;
    border-radius: var(--radius-md);
    border: 1px dashed color-mix(in srgb, var(--border) 85%, var(--accent));
    background: color-mix(in srgb, var(--pill-bg) 55%, transparent);
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-mono);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.news-archive-summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.news-archive-summary::-webkit-details-marker {
    display: none;
}

.news-archive-summary:hover {
    border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
    background: var(--accent-soft);
}

.news-archive-hint {
    font-weight: 600;
    opacity: 0.75;
}

.news-archive[open] > .news-archive-summary {
    margin-bottom: 6px;
    border-style: solid;
    border-color: color-mix(in srgb, var(--accent) 22%, var(--border));
}

.news-archive-inner {
    padding-top: 4px;
}

.news-archive-inner .news-item:last-child {
    padding-bottom: 0;
}

/* ============================================
   Talks
   ============================================ */
.talk-list {
    list-style: none;
    margin: 0 auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    max-width: var(--content-column);
}

.talk-item {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr);
    gap: 12px 14px;
    align-items: start;
}

.talk-date {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--news-date-text);
    background: var(--news-date-bg);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    text-align: center;
    justify-self: start;
    margin-top: 2px;
}

.talk-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    transition: border-color 0.25s ease, box-shadow 0.35s ease, transform 0.35s var(--ease-out);
}

.talk-item:hover .talk-card {
    border-color: color-mix(in srgb, var(--accent) 22%, var(--border));
    box-shadow: var(--shadow-md), 0 0 28px color-mix(in srgb, var(--accent) 8%, transparent);
    transform: translateX(3px);
}

.talk-item:hover .talk-date {
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent);
}

.talk-text {
    margin: 0;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.55;
}

@media (max-width: 700px) {
    .news-archive-summary {
        margin-left: 0;
        max-width: 100%;
    }
}

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

.pub-card {
    --pub-accent: var(--accent);
    position: relative;
    display: grid;
    grid-template-columns: 38px minmax(140px, 200px) minmax(0, 1fr);
    gap: 12px 16px;
    align-items: stretch;
    padding: 14px 16px 14px 14px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-card);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow: hidden;
    transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out), border-color 0.3s ease;
}

.pub-card::after {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: linear-gradient(180deg, var(--pub-accent), transparent);
    opacity: 0.85;
}

.pub-card:hover {
    transform: translateY(-2px) translateX(1px);
    border-color: color-mix(in srgb, var(--pub-accent) 35%, var(--border));
    box-shadow: var(--shadow-lg), 0 0 36px color-mix(in srgb, var(--pub-accent) 12%, transparent);
}

.pub-index {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.06em;
    color: color-mix(in srgb, var(--pub-accent) 55%, var(--text-tertiary));
    line-height: 1;
    padding-top: 4px;
    align-self: start;
}

.pub-media {
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
}

.pub-media-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 6px;
}

a.pub-media-placeholder {
    text-decoration: none;
    color: var(--accent);
    background: linear-gradient(145deg, var(--accent-soft), rgba(224, 64, 251, 0.06));
    min-height: 100px;
    border-radius: var(--radius-md);
    transition: opacity 0.2s ease, transform 0.35s var(--ease-out);
}

a.pub-media-placeholder:hover {
    opacity: 0.95;
}

.pub-placeholder-text {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
    text-align: center;
    padding: 8px;
}

.pub-card:hover a.pub-media-placeholder {
    transform: scale(1.02);
}

.pub-media img {
    max-height: 130px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    transition: transform 0.45s var(--ease-out);
}

.pub-card:hover .pub-media img {
    transform: scale(1.03);
}

.pub-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding-top: 0;
}

.pub-title {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.35;
    color: var(--text-primary);
}

.pub-authors {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.pub-venue {
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-mono);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--pub-venue);
}

.pub-tags {
    font-size: 11px;
    color: var(--text-tertiary);
}

.pub-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.pub-link {
    font-size: 10px;
    font-weight: 700;
    font-family: var(--font-mono);
    letter-spacing: 0.05em;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    border: 1px solid var(--pill-border);
    color: var(--pill-text);
    background: var(--pill-bg);
    transition: all 0.2s ease;
    text-transform: uppercase;
}

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

.pub-link.pub-link-github {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 600;
    padding-inline: 9px 11px;
}

.pub-link-github .pub-gh-icon {
    flex-shrink: 0;
}

.pub-link-github .pub-github-stars {
    display: none;
    align-items: center;
    gap: 3px;
    margin-left: 1px;
    padding-left: 8px;
    border-left: 1px solid color-mix(in srgb, var(--pill-text) 22%, transparent);
    font-size: 10px;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.pub-link-github.pub-github-stars-loaded .pub-github-stars {
    display: inline-flex;
}

.pub-link-github .pub-star-icon {
    flex-shrink: 0;
    opacity: 0.88;
}

.pub-link-github:hover .pub-github-stars {
    border-left-color: rgba(255, 255, 255, 0.35);
}

.pub-link-github:hover .pub-star-icon {
    opacity: 1;
}

/* ============================================
   Footer
   ============================================ */
.footer {
    position: relative;
    z-index: 5;
    padding: 28px clamp(14px, 3vw, 24px) 28px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.footer-glow {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    width: min(90%, 640px);
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), var(--accent-secondary), transparent);
    opacity: 0.65;
}

.footer-shell {
    max-width: var(--layout-max);
    margin: 0 auto;
}

.footer-brand {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 16px;
    letter-spacing: -0.03em;
    margin-bottom: 10px;
}

.footer-cn {
    font-family: var(--font-hand-cn);
    font-weight: 400;
    font-size: clamp(18px, 3.6vw, 24px);
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-left: 0;
    vertical-align: middle;
}

.footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.footer-text {
    font-size: 13px;
    color: var(--text-tertiary);
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-tertiary);
}

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

/* ============================================
   Scroll animations
   ============================================ */
.animate-in {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.65s var(--ease-out), transform 0.65s var(--ease-out);
}

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

.timeline-track-row > .news-item.animate-in:nth-child(1) { transition-delay: 0ms; }
.timeline-track-row > .news-item.animate-in:nth-child(2) { transition-delay: 40ms; }
.timeline-track-row > .news-item.animate-in:nth-child(3) { transition-delay: 80ms; }

.talk-item.animate-in:nth-child(1) { transition-delay: 0ms; }
.talk-item.animate-in:nth-child(2) { transition-delay: 55ms; }

.pub-card.animate-in:nth-child(1) { transition-delay: 0ms; }
.pub-card.animate-in:nth-child(2) { transition-delay: 70ms; }
.pub-card.animate-in:nth-child(3) { transition-delay: 140ms; }
.pub-card.animate-in:nth-child(4) { transition-delay: 210ms; }
.pub-card.animate-in:nth-child(5) { transition-delay: 280ms; }
.pub-card.animate-in:nth-child(6) { transition-delay: 350ms; }
.pub-card.animate-in:nth-child(7) { transition-delay: 420ms; }
.pub-card.animate-in:nth-child(8) { transition-delay: 490ms; }
.pub-card.animate-in:nth-child(9) { transition-delay: 560ms; }

/* ============================================
   Reduced motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    .hero-name-line,
    .orb {
        animation: none;
    }
    .animate-in {
        opacity: 1;
        transform: none;
        transition: none;
    }
    .pub-card:hover,
    .news-item:hover .news-card,
    .talk-item:hover .talk-card {
        transform: none;
    }
    .pub-card:hover a.pub-media-placeholder {
        transform: none;
    }
    .timeline-track-row::before,
    .timeline-track-row::after {
        animation: none;
    }
    .timeline-track-row > .news-item.animate-in.visible::before {
        animation: none;
    }
    .timeline-track-row > .news-item:hover::before {
        transform: translate(-50%, -50%);
    }
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 900px) {
    .hero-dense {
        grid-template-columns: 1fr;
        row-gap: 12px;
    }

    .hero-photo-link {
        grid-row: 1;
        grid-column: 1;
        justify-self: center;
        width: min(336px, 85vw);
        margin: 0;
    }

    .hero-copy-dense {
        grid-row: 2;
        grid-column: 1;
        text-align: left;
        max-width: none;
    }

    .section-heading {
        padding-bottom: 10px;
        margin-bottom: 4px;
        border-bottom: 1px solid var(--border);
    }

    .pub-card {
        grid-template-columns: 36px minmax(0, 1fr);
        grid-template-rows: auto auto;
    }

    .pub-index {
        grid-row: 1;
        grid-column: 1;
    }

    .pub-media {
        grid-column: 2;
        grid-row: 1;
        min-height: 100px;
    }

    .pub-info {
        grid-column: 1 / -1;
        grid-row: 2;
    }
}

@media (max-width: 700px) {
    /* Two rows: logo + theme | links (wrap). Sticky = bar stays in flow so hero clears the photo. */
    .navbar {
        position: sticky;
        top: 0;
        left: auto;
        right: auto;
        width: 100%;
        max-width: none;
        padding: calc(12px + env(safe-area-inset-top, 0px)) clamp(14px, 3vw, 22px) 12px;
        background: var(--bg-nav);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        border-bottom: 1px solid var(--border);
        z-index: 100;
    }

    .navbar.scrolled {
        padding-top: calc(8px + env(safe-area-inset-top, 0px));
        padding-bottom: 8px;
    }

    .hero {
        padding-top: clamp(16px, 4vw, 28px);
    }

    .nav-inner {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto auto;
        align-items: center;
        column-gap: 14px;
        row-gap: 10px;
        max-width: var(--layout-max);
    }

    .nav-logo {
        grid-column: 1;
        grid-row: 1;
        justify-self: start;
        max-width: none;
        overflow: visible;
        text-overflow: clip;
        white-space: nowrap;
    }

    .nav-actions {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
        flex-wrap: nowrap;
    }

    .nav-center {
        grid-column: 1 / -1;
        grid-row: 2;
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-start;
        align-items: center;
        gap: 6px 8px;
        margin-top: 0;
        padding-top: 10px;
        border-top: 1px solid var(--border);
        overflow-x: visible;
        overflow-y: visible;
        min-width: 0;
    }

    .nav-center a {
        padding: 6px 10px;
        font-size: 12px;
    }

    .news-archive {
        margin-top: 18px;
    }

    .timeline-track {
        --timeline-pad-x: 0px;
        padding: 30px 0 28px;
        margin-left: 0;
        margin-right: 0;
        /* Safari/WebKit: edge mask + overflow scroll often clips or fades the rail wrongly. */
        -webkit-mask-image: none;
        mask-image: none;
    }

    .timeline-track-row {
        gap: 12px;
        justify-content: flex-start;
    }

    .timeline-track-row::before {
        height: 4px;
        border-radius: 5px;
        box-shadow:
            0 0 24px color-mix(in srgb, var(--accent) 22%, transparent),
            inset 0 1px 0 color-mix(in srgb, white 14%, transparent);
    }

    .timeline-track-row > .news-item {
        flex: 0 0 min(236px, 86vw);
        min-height: 10.75rem;
        gap: clamp(12px, 3vw, 20px);
    }

    .talk-item {
        grid-template-columns: 1fr;
    }

    .talk-date {
        justify-self: center;
    }

    .news-archive-inner .news-item {
        grid-template-columns: 1fr;
        gap: 8px;
        padding-left: 0;
    }

    .pub-card {
        padding: 18px 16px;
    }
}

@media (max-width: 520px) {
    .nav-logo {
        font-size: 13px;
    }

    .footer-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* color-mix fallback for older browsers */
@supports not (color: color-mix(in srgb, white 50%, black)) {
    .pub-card:hover {
        border-color: var(--accent);
    }
    .pub-index {
        color: var(--text-tertiary);
    }
}
