/* ==========================================================================
   Lun Huang — personal site
   Shared styles for the home page and every research page.
   ========================================================================== */

:root {
    --bg: #fbfaf7;
    --bg-elev: #ffffff;
    --bg-soft: #f3f1ec;
    --ink: #16181d;
    --ink-2: #3d4250;
    --ink-3: #6b7080;
    --line: #e6e2d9;
    --line-strong: #d4cfc3;
    --accent: #2f4fd8;
    --accent-ink: #1f37a8;
    --accent-soft: #e9edfc;
    --gold: #a86a12;
    --gold-soft: #fbf1df;
    --figure-bg: #ffffff;
    --shadow-sm: 0 1px 2px rgba(22, 24, 29, 0.05);
    --shadow: 0 1px 2px rgba(22, 24, 29, 0.04), 0 8px 24px -12px rgba(22, 24, 29, 0.18);
    --shadow-lg: 0 2px 4px rgba(22, 24, 29, 0.04), 0 22px 48px -20px rgba(22, 24, 29, 0.28);
    --radius: 14px;
    --radius-sm: 9px;
    --maxw: 1080px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-serif: 'Source Serif 4', 'Iowan Old Style', Georgia, serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0f1115;
        --bg-elev: #161a21;
        --bg-soft: #1b2029;
        --ink: #eceef3;
        --ink-2: #c3c8d4;
        --ink-3: #8a91a2;
        --line: #262c37;
        --line-strong: #353d4b;
        --accent: #8ea2ff;
        --accent-ink: #b3c0ff;
        --accent-soft: #1d2442;
        --gold: #f0b75e;
        --gold-soft: #2c2312;
        --figure-bg: #f4f4f2;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px -14px rgba(0, 0, 0, 0.7);
        --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.3), 0 24px 52px -22px rgba(0, 0, 0, 0.8);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #0f1115;
    --bg-elev: #161a21;
    --bg-soft: #1b2029;
    --ink: #eceef3;
    --ink-2: #c3c8d4;
    --ink-3: #8a91a2;
    --line: #262c37;
    --line-strong: #353d4b;
    --accent: #8ea2ff;
    --accent-ink: #b3c0ff;
    --accent-soft: #1d2442;
    --gold: #f0b75e;
    --gold-soft: #2c2312;
    --figure-bg: #f4f4f2;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px -14px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.3), 0 24px 52px -22px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.65;
    color: var(--ink-2);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

a { color: var(--accent); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--accent-ink); }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

strong, b { color: var(--ink); font-weight: 600; }

::selection { background: var(--accent-soft); color: var(--ink); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- Top navigation ---------- */

.nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid transparent;
    transition: border-color .2s ease;
}
.nav.scrolled { border-bottom-color: var(--line); }

.nav-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.brand {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--ink);
    letter-spacing: -0.01em;
    margin-right: auto;
    white-space: nowrap;
}
.brand:hover { color: var(--ink); }

.nav-links { display: flex; gap: 4px; align-items: center; }
.nav-links a {
    color: var(--ink-3);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 999px;
    transition: background .15s ease, color .15s ease;
}
.nav-links a:hover { color: var(--ink); background: var(--bg-soft); }
.nav-links a.active { color: var(--ink); background: var(--bg-soft); }

.icon-btn {
    width: 36px;
    height: 36px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--bg-elev);
    color: var(--ink-2);
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease;
    flex-shrink: 0;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.theme-toggle .fa-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .fa-sun { display: inline; }
:root[data-theme="dark"] .theme-toggle .fa-moon { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .fa-sun { display: inline; }
    :root:not([data-theme="light"]) .theme-toggle .fa-moon { display: none; }
}

.menu-toggle { display: none; }

/* ---------- Hero ---------- */

.hero { padding: 64px 0 40px; }

.hero-grid {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 48px;
    align-items: center;
}

.portrait {
    width: 220px;
    aspect-ratio: 1;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    background: var(--bg-soft);
    position: relative;
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 14px;
}
.eyebrow .dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #22a06b;
    box-shadow: 0 0 0 4px color-mix(in srgb, #22a06b 18%, transparent);
}

.hero h1 {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: clamp(2.4rem, 5vw, 3.4rem);
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin: 0 0 12px;
}
.hero h1 .zh { font-size: 0.55em; color: var(--ink-3); font-weight: 500; margin-left: 10px; letter-spacing: 0; }

.hero-role { font-size: 1.12rem; color: var(--ink-2); margin-bottom: 4px; }
.hero-role strong { font-weight: 600; }
.hero-loc { color: var(--ink-3); font-size: 0.95rem; margin-bottom: 22px; }
.hero-loc i { margin-right: 6px; }

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

/* ---------- Buttons / chips ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--bg-elev);
    color: var(--ink);
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.2;
    box-shadow: var(--shadow-sm);
    transition: transform .15s ease, border-color .15s ease, background .15s ease, color .15s ease;
    cursor: pointer;
    font-family: inherit;
}
.btn:hover { transform: translateY(-1px); border-color: var(--line-strong); color: var(--ink); }
.btn i { font-size: 0.95em; color: var(--ink-3); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary i { color: inherit; opacity: .8; }
.btn.primary:hover { color: var(--bg); }
.btn.disabled { opacity: .5; pointer-events: none; box-shadow: none; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    font-size: 0.82rem;
    border-radius: 999px;
    background: var(--bg-soft);
    color: var(--ink-2);
    border: 1px solid var(--line);
    white-space: nowrap;
}

.venue {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: var(--accent-soft);
    color: var(--accent-ink);
}
.venue.highlight { background: var(--gold-soft); color: var(--gold); }
.venue.muted { background: var(--bg-soft); color: var(--ink-3); }

/* ---------- Sections ---------- */

.section { padding: 44px 0; border-top: 1px solid var(--line); }
.section:first-of-type { border-top: 0; }

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 26px;
    flex-wrap: wrap;
}

.section h2 {
    font-family: var(--font-serif);
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--ink);
    margin: 0;
}
.section-sub { color: var(--ink-3); font-size: 0.92rem; }

.about-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 40px;
}
.about-text { font-size: 1.04rem; }
.about-text p { margin-bottom: 1.05em; }

.interests {
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    align-self: start;
}
.interests h3 {
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin: 0 0 14px;
    font-weight: 600;
}
.interests ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.interests li { display: flex; gap: 12px; align-items: flex-start; color: var(--ink-2); font-size: 0.95rem; line-height: 1.45; }
.interests li i { color: var(--accent); width: 18px; text-align: center; margin-top: 3px; flex-shrink: 0; }

/* News */
.news { list-style: none; margin: 0; padding: 0; }
.news li {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 18px;
    padding: 12px 0;
    border-bottom: 1px dashed var(--line);
}
.news li:last-child { border-bottom: 0; }
.news time {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--ink-3);
    padding-top: 2px;
}
.news .tag-new {
    font-size: 0.68rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
    color: #fff; background: #e5484d; border-radius: 4px; padding: 1px 6px; margin-right: 6px; vertical-align: 2px;
}

/* ---------- Research cards (home) ---------- */

.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filter {
    font: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 6px 13px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--ink-3);
    cursor: pointer;
    transition: all .15s ease;
}
.filter:hover { color: var(--ink); border-color: var(--line-strong); }
.filter.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.research-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }

.rcard {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.rcard:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--line-strong); }
.rcard.hidden { display: none; }

.rcard-media {
    aspect-ratio: 16 / 9;
    background: var(--figure-bg);
    border-bottom: 1px solid var(--line);
    overflow: hidden;
    display: grid;
    place-items: center;
}
.rcard-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s ease;
}
.rcard-media img.contain { object-fit: contain; padding: 14px; }
.rcard:hover .rcard-media img { transform: scale(1.03); }

.rcard-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.rcard-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rcard-year { font-size: 0.82rem; color: var(--ink-3); font-family: var(--font-mono); }
.rcard h3 {
    font-family: var(--font-serif);
    font-size: 1.18rem;
    line-height: 1.3;
    font-weight: 600;
    color: var(--ink);
    margin: 2px 0 0;
    letter-spacing: -0.01em;
}
.rcard h3 a { color: inherit; }
.rcard h3 a::after { content: ''; position: absolute; inset: 0; z-index: 1; }
.rcard-authors { font-size: 0.86rem; color: var(--ink-3); line-height: 1.5; }
.rcard-authors .me { color: var(--ink); font-weight: 600; }
.rcard-tldr { font-size: 0.93rem; color: var(--ink-2); line-height: 1.55; }
.rcard-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 8px; position: relative; z-index: 2; }
.rcard-links a {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.8rem; font-weight: 500;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--ink-2);
    background: var(--bg);
}
.rcard-links a:hover { border-color: var(--accent); color: var(--accent); }
.rcard-links a.page { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }

.rcard.featured { grid-column: 1 / -1; flex-direction: row; }
.rcard.featured .rcard-media { flex: 0 0 52%; aspect-ratio: auto; min-height: 300px; border-bottom: 0; border-right: 1px solid var(--line); }
.rcard.featured .rcard-body { padding: 26px 28px; justify-content: center; }
.rcard.featured.flip { flex-direction: row-reverse; }
.rcard.featured.flip .rcard-media { border-right: 0; border-left: 1px solid var(--line); }
.rcard.featured h3 { font-size: 1.45rem; }

/* Compact publication list */
.pubs { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 4px; }
.pubs li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.pubs li:last-child { border-bottom: 0; }
.pubs .t { color: var(--ink); font-weight: 600; font-family: var(--font-serif); font-size: 1.05rem; }
.pubs .a { font-size: 0.88rem; color: var(--ink-3); }
.pubs .a .me { color: var(--ink); font-weight: 600; }

.subhead {
    font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--ink-3); font-weight: 600; margin: 34px 0 0;
}

/* ---------- Timeline (experience / education) ---------- */

.timeline { position: relative; display: grid; gap: 14px; }

.titem {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: 18px;
    align-items: start;
    padding: 18px 20px;
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.titem.current { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }

.logo {
    width: 56px; height: 56px;
    border-radius: 12px;
    display: grid; place-items: center;
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    letter-spacing: -0.02em;
}
.logo.bytedance { background: linear-gradient(135deg, #325ab4, #1c3a8a); }
.logo.msra { background: linear-gradient(135deg, #2b8fd6, #0f5aa6); }
.logo.tencent { background: linear-gradient(135deg, #2f9e5a, #0b6e3b); }
.logo.duke { background: linear-gradient(135deg, #00539b, #012169); }
.logo.princeton { background: linear-gradient(135deg, #f58025, #c3561a); }
.logo.pku { background: linear-gradient(135deg, #b22c2c, #8a1515); }
.logo.hust { background: linear-gradient(135deg, #2069c4, #0b4a96); }

.titem h3 { margin: 0; font-size: 1.05rem; color: var(--ink); font-weight: 600; line-height: 1.35; }
.titem .role { color: var(--ink-2); font-size: 0.95rem; }
.titem .detail { color: var(--ink-3); font-size: 0.9rem; margin-top: 6px; line-height: 1.55; }
.titem .detail a { font-weight: 500; }
.titem .when { text-align: right; font-size: 0.85rem; color: var(--ink-3); white-space: nowrap; line-height: 1.5; }
.titem .when .place { display: block; font-size: 0.8rem; }
.badge-now {
    display: inline-block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
    color: #138a5a; background: color-mix(in srgb, #22a06b 14%, transparent);
    padding: 2px 8px; border-radius: 999px; margin-left: 8px; vertical-align: 2px;
}

/* ---------- Misc cards (honors / service / teaching) ---------- */

.tri { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.panel {
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
}
.panel h3 {
    margin: 0 0 12px;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-3);
    font-weight: 600;
    display: flex; align-items: center; gap: 8px;
}
.panel h3 i { color: var(--accent); }
.panel ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.panel li { font-size: 0.92rem; line-height: 1.45; color: var(--ink-2); }
.panel li span { display: block; font-size: 0.82rem; color: var(--ink-3); }
.panel .chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Footer ---------- */

.footer { border-top: 1px solid var(--line); padding: 36px 0 48px; color: var(--ink-3); font-size: 0.88rem; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
/* Visitor map (ClustrMaps), kept compact in the footer */
.visitor-map {
    width: 300px;
    max-width: 100%;
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 10px 12px 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.visitor-map .vm-label {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--ink-3); margin-bottom: 8px;
}
.visitor-map .vm-label i { color: var(--accent); }
.visitor-map > :not(.vm-label) { max-width: 100%; pointer-events: none; }
.visitor-map img, .visitor-map canvas { max-width: 100%; height: auto; border-radius: 6px; }

/* ==========================================================================
   Research (project) pages
   ========================================================================== */

.p-hero {
    padding: 56px 0 36px;
    text-align: center;
    background:
        radial-gradient(1200px 380px at 50% -120px, var(--accent-soft), transparent 70%);
}
.p-hero .back {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 0.86rem; color: var(--ink-3); margin-bottom: 22px;
}
.p-hero .back:hover { color: var(--ink); }
.p-hero .venue-row { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.p-hero h1 {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: clamp(2rem, 4.6vw, 3.1rem);
    line-height: 1.12;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin: 0 auto 8px;
    max-width: 900px;
}
.p-hero h1 .name { display: block; }
.p-hero .subtitle {
    font-family: var(--font-serif);
    font-size: clamp(1.15rem, 2.3vw, 1.45rem);
    color: var(--ink-2);
    margin: 0 auto 26px;
    max-width: 820px;
    line-height: 1.35;
}
.authors { max-width: 860px; margin: 0 auto 8px; font-size: 1.02rem; line-height: 1.8; }
.authors a, .authors span { color: var(--ink); white-space: nowrap; }
.authors a { border-bottom: 1px solid var(--line-strong); }
.authors a:hover { color: var(--accent); border-color: var(--accent); }
.authors .me { font-weight: 600; }
.authors sup { color: var(--ink-3); font-size: 0.7em; margin-left: 1px; }
.affils { color: var(--ink-3); font-size: 0.9rem; margin: 6px auto 4px; max-width: 860px; }
.affils span { margin: 0 8px; white-space: nowrap; }
.note { color: var(--ink-3); font-size: 0.82rem; margin-top: 4px; }
.p-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 26px; }

.p-main { padding: 12px 0 40px; }
.p-narrow { max-width: 860px; margin: 0 auto; }

.p-section { padding: 36px 0; }
.p-section + .p-section { border-top: 1px solid var(--line); }
.p-section h2 {
    font-family: var(--font-serif);
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--ink);
    margin: 0 0 18px;
    letter-spacing: -0.015em;
    text-align: center;
}
.p-section .lead { font-size: 1.04rem; text-align: justify; hyphens: auto; }

.figure {
    margin: 0;
    background: var(--figure-bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.figure img { width: 100%; height: auto; }
.figure.padded { padding: 18px; }
.figure.narrow { max-width: 620px; margin-left: auto; margin-right: auto; }
.figcaption { font-size: 0.9rem; color: var(--ink-3); margin: 12px auto 0; max-width: 820px; text-align: center; line-height: 1.55; }
.figcaption b { color: var(--ink-2); }

.tldr {
    display: flex; gap: 14px; align-items: flex-start;
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin: 28px auto 0;
    max-width: 860px;
    box-shadow: var(--shadow-sm);
}
.tldr .k { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); padding-top: 3px; white-space: nowrap; }
.tldr p { margin: 0; color: var(--ink); font-size: 1rem; text-align: left; }

.highlights { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.hl {
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}
.hl .num { font-family: var(--font-serif); font-size: 1.7rem; font-weight: 600; color: var(--ink); line-height: 1.1; }
.hl .lbl { font-size: 0.88rem; color: var(--ink-3); margin-top: 6px; line-height: 1.45; }
.hl i { color: var(--accent); font-size: 1.15rem; margin-bottom: 10px; display: block; }
.hl .t { font-weight: 600; color: var(--ink); margin-bottom: 4px; }

.video-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.video-card {
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.video-card video { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #000; }
.video-card .cap { padding: 12px 16px 14px; font-size: 0.88rem; color: var(--ink-2); line-height: 1.5; }
.video-card .cap b { display: block; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin-bottom: 4px; }

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.compare figure { margin: 0; }
.compare figcaption { font-size: 0.78rem; color: var(--ink-3); padding: 6px 2px 0; text-align: center; font-weight: 500; }
.compare figcaption.ours { color: var(--accent); }

.external-cta {
    margin-top: 22px; text-align: center; font-size: 0.95rem; color: var(--ink-3);
}

.bibtex { position: relative; }
.bibtex pre {
    margin: 0;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 20px 22px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--ink-2);
}
.copy-btn {
    position: absolute; top: 10px; right: 10px;
    font: inherit; font-size: 0.78rem; font-weight: 500;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 10px;
    border-radius: 7px;
    border: 1px solid var(--line);
    background: var(--bg-elev);
    color: var(--ink-2);
    cursor: pointer;
}
.copy-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.copy-btn.done { color: #138a5a; border-color: #138a5a; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 28px 0 8px; border-top: 1px solid var(--line); }
.pager a {
    display: block;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-elev);
    color: var(--ink);
    transition: border-color .15s ease, transform .15s ease;
}
.pager a:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.pager .dir { font-size: 0.76rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); display: block; margin-bottom: 4px; }
.pager .ttl { font-family: var(--font-serif); font-weight: 600; font-size: 1.02rem; }
.pager .next { text-align: right; grid-column: 2; }

/* ---------- Reveal on scroll ---------- */

.js .reveal { opacity: 0; transform: translateY(12px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
    .js .reveal { opacity: 1; transform: none; transition: none; }
    html { scroll-behavior: auto; }
    .rcard, .rcard-media img, .btn { transition: none; }
}

/* ---------- Responsive ---------- */

@media (max-width: 920px) {
    .about-grid { grid-template-columns: 1fr; gap: 24px; }
    .tri { grid-template-columns: 1fr; }
    .rcard.featured { flex-direction: column; }
    .rcard.featured, .rcard.featured.flip { flex-direction: column; }
    .rcard.featured .rcard-media { flex: none; aspect-ratio: 16 / 9; min-height: 0; border-right: 0; border-left: 0; border-bottom: 1px solid var(--line); }
    .highlights { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .wrap, .nav-inner { padding: 0 16px; }
    .menu-toggle { display: inline-grid; }
    .nav-links {
        position: absolute;
        top: 64px; left: 0; right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding: 10px 16px 16px;
        background: var(--bg);
        border-bottom: 1px solid var(--line);
        display: none;
    }
    .nav-links.open { display: flex; }
    .nav-links a { padding: 10px 12px; border-radius: 8px; }

    .hero { padding: 36px 0 24px; }
    .hero-grid { grid-template-columns: 1fr; gap: 24px; text-align: left; }
    .portrait { width: 132px; border-radius: 22px; }
    .research-grid { grid-template-columns: 1fr; }
    .section { padding: 34px 0; }
    .section h2 { font-size: 1.5rem; }
    .news li { grid-template-columns: 1fr; gap: 2px; }
    .titem { grid-template-columns: 44px 1fr; gap: 14px; padding: 16px; }
    .logo { width: 44px; height: 44px; font-size: 0.9rem; border-radius: 10px; }
    .titem .when { grid-column: 2; text-align: left; }
    .titem .when .place { display: inline; margin-left: 8px; }
    .video-grid { grid-template-columns: 1fr; }
    .p-hero { padding: 36px 0 24px; }
    .p-section .lead { text-align: left; }
    .pager { grid-template-columns: 1fr; }
    .pager .next { grid-column: 1; }
    .tldr { flex-direction: column; gap: 6px; }
}
