/* ==========================================================
   Dark Lab — haoyuan-l.github.io
   Dark-first. Light theme via [data-theme="light"].
   ========================================================== */
:root {
  --bg: #070b14;
  --bg-2: #0a1020;
  --surface: #0d1424;
  --surface-2: #111a2e;
  --ink: #e6ecf7;
  --ink-2: #b7c2d8;
  --mute: #8390a9;
  --line: #1b2640;
  --line-2: #26345a;
  --acc: #6fb6ff;
  --acc-2: #a78bfa;
  --acc-ink: #061020;
  --glow: rgba(111, 182, 255, 0.18);
  --paper: #f4f6fa;
  --shadow: 0 20px 50px -30px rgba(0, 0, 0, 0.8);

  --f-display: "Space Grotesk", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --max: 1120px;
  --gutter: clamp(18px, 4vw, 40px);
  --radius: 14px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f5f7fb;
  --bg-2: #eef2f9;
  --surface: #ffffff;
  --surface-2: #f3f6fc;
  --ink: #0d1424;
  --ink-2: #33405c;
  --mute: #5a6680;
  --line: #dde3ef;
  --line-2: #c8d2e6;
  --acc: #1f63d6;
  --acc-2: #6d4fd8;
  --acc-ink: #ffffff;
  --glow: rgba(31, 99, 214, 0.12);
  --paper: #ffffff;
  --shadow: 0 18px 40px -28px rgba(20, 40, 90, 0.35);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
[hidden] { display: none !important; }
a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--acc); color: var(--acc-ink); }
h1, h2, h3, h4 { font-family: var(--f-display); line-height: 1.15; margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
p { margin: 0; }

.container {
  max-width: var(--max);
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--acc); color: var(--acc-ink); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 12px; }
.mono { font-family: var(--f-mono); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background .3s;
}
.nav.scrolled { border-bottom-color: var(--line); }
.nav .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.brand { font-family: var(--f-display); font-weight: 700; letter-spacing: 0.08em; color: var(--ink); font-size: 0.95rem; display: flex; align-items: center; gap: 10px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 26px; height: 26px; }
.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-links a { color: var(--ink-2); font-size: 0.9rem; padding: 6px 12px; border-radius: 8px; transition: color .2s, background .2s; }
.nav-links a:hover, .nav-links a.active { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer;
  transition: color .2s, border-color .2s;
}
.icon-btn:hover { color: var(--acc); border-color: var(--acc); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .sun { display: none; }
:root[data-theme="light"] .theme-toggle .sun { display: block; }
:root[data-theme="light"] .theme-toggle .moon { display: none; }
.menu-btn { display: none; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(700px 380px at 78% 45%, var(--glow), transparent 70%),
    linear-gradient(to bottom, transparent 70%, var(--bg));
}
.hero-grid {
  position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 70% 60% at 70% 45%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 70% 45%, #000 20%, transparent 75%);
}
#fl-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  mask-image: linear-gradient(90deg, transparent 22%, #000 58%);
  -webkit-mask-image: linear-gradient(90deg, transparent 22%, #000 58%);
}
.hero .container { position: relative; z-index: 1; padding-block: clamp(72px, 12vw, 140px) clamp(64px, 9vw, 110px); }
.hero-copy { max-width: 620px; }
.eyebrow { font-family: var(--f-mono); font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--acc); display: inline-flex; align-items: center; gap: 10px; }
.eyebrow .pulse { width: 8px; height: 8px; border-radius: 50%; background: #3ddc97; box-shadow: 0 0 0 0 rgba(61, 220, 151, .6); animation: pulse 2.2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(61, 220, 151, 0); } 100% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0); } }
.hero h1 { font-size: clamp(2.8rem, 7.5vw, 5.4rem); letter-spacing: -0.035em; line-height: 0.98; margin: 18px 0 20px; font-weight: 700; }
.hero h1 .grad {
  display: block;
  background: linear-gradient(92deg, var(--acc) 0%, var(--acc-2) 60%, var(--acc) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: sheen 8s ease-in-out infinite;
}
@keyframes sheen { 50% { background-position: 100% 0; } }
.hero .lede { font-size: clamp(1.02rem, 1.6vw, 1.15rem); color: var(--ink-2); max-width: 54ch; }
.hero .lede strong { color: var(--ink); font-weight: 600; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 10px;
  font-weight: 600; font-size: 0.92rem; color: var(--ink); border: 1px solid var(--line-2);
  background: color-mix(in srgb, var(--surface) 80%, transparent); transition: transform .2s, border-color .2s, background .2s, box-shadow .2s;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { text-decoration: none; border-color: var(--acc); transform: translateY(-2px); }
.btn.primary { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); box-shadow: 0 8px 30px -10px var(--acc); }
.btn.primary:hover { box-shadow: 0 10px 34px -8px var(--acc); }

.hud {
  position: absolute; right: max(var(--gutter), env(safe-area-inset-right, 0px)); bottom: 26px; z-index: 1;
  font-family: var(--f-mono); font-size: 0.72rem; color: var(--mute); text-align: right; line-height: 1.8;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(6px);
}
.hud b { color: var(--acc); font-weight: 500; font-variant-numeric: tabular-nums; }
.hud .legend { display: flex; gap: 12px; justify-content: flex-end; }
.hud .legend i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }

/* ---------- Sections ---------- */
section.block { padding-block: clamp(64px, 9vw, 104px); border-bottom: 1px solid var(--line); }
.sec-head { display: flex; align-items: end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 36px; }
.sec-head .kicker { font-family: var(--f-mono); font-size: 0.74rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--acc); margin-bottom: 10px; }
.sec-head h2 { font-size: clamp(1.8rem, 3.6vw, 2.5rem); letter-spacing: -0.02em; }
.sec-head .aside { font-family: var(--f-mono); font-size: 0.78rem; color: var(--mute); }

/* About */
.about { display: grid; grid-template-columns: 300px 1fr; gap: clamp(28px, 5vw, 64px); align-items: start; }
.portrait { position: relative; border-radius: 18px; overflow: hidden; border: 1px solid var(--line-2); background: var(--surface); box-shadow: var(--shadow); }
.portrait img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; }
.portrait::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); pointer-events: none; }
.status-chip {
  position: absolute; left: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.78rem; font-weight: 600; color: #e9fff4; padding: 6px 11px; border-radius: 999px;
  background: rgba(6, 30, 22, 0.78); border: 1px solid rgba(61, 220, 151, .45); backdrop-filter: blur(6px);
}
.status-chip i { width: 7px; height: 7px; border-radius: 50%; background: #3ddc97; }
.bio { display: grid; gap: 16px; font-size: 1.05rem; color: var(--ink-2); max-width: 66ch; }
.bio p:first-child { color: var(--ink); font-size: 1.15rem; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-top: 30px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.facts div { padding: 14px 16px; border-right: 1px solid var(--line); min-width: 0; }
.facts div:last-child { border-right: 0; }
.facts dt { font-family: var(--f-mono); font-size: 0.68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); margin-bottom: 4px; }
.facts dd { margin: 0; font-size: 0.9rem; color: var(--ink); }
.socials { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.chip-link {
  display: inline-flex; align-items: center; gap: 8px; font-size: 0.86rem; color: var(--ink-2);
  border: 1px solid var(--line); background: var(--surface); padding: 7px 12px; border-radius: 9px; transition: color .2s, border-color .2s;
}
.chip-link svg { width: 15px; height: 15px; }
.chip-link:hover { color: var(--acc); border-color: var(--acc); text-decoration: none; }

/* Research focus */
.focus-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.focus-card {
  position: relative; display: flex; flex-direction: column; gap: 12px; padding: 26px 24px 22px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  transition: border-color .3s, transform .3s; color: inherit; text-align: left; font: inherit; cursor: pointer;
}
.focus-card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(400px 200px at var(--mx, 50%) var(--my, 0%), var(--glow), transparent 70%);
}
.focus-card:hover { border-color: var(--line-2); transform: translateY(-4px); }
.focus-card:hover::before { opacity: 1; }
.focus-card .ico { width: 46px; height: 46px; color: var(--acc); }
.focus-card h3 { font-size: 1.18rem; }
.focus-card p { color: var(--mute); font-size: 0.94rem; flex: 1; }
.focus-card .count { font-family: var(--f-mono); font-size: 0.76rem; color: var(--acc); display: flex; align-items: center; justify-content: space-between; border-top: 1px dashed var(--line-2); padding-top: 12px; }
.focus-card .count span:last-child { transition: transform .25s; }
.focus-card:hover .count span:last-child { transform: translateX(4px); }

/* Activity timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; display: grid; gap: 0; }
.timeline::before { content: ""; position: absolute; left: 132px; top: 8px; bottom: 8px; width: 1px; background: linear-gradient(var(--acc), var(--line) 60%, transparent); }
.tl-item { display: grid; grid-template-columns: 112px 40px 1fr; align-items: start; padding: 14px 0; }
.tl-item time { font-family: var(--f-mono); font-size: 0.8rem; color: var(--mute); padding-top: 3px; font-variant-numeric: tabular-nums; }
.tl-dot { justify-self: center; margin-top: 7px; width: 11px; height: 11px; border-radius: 50%; background: var(--bg); border: 2px solid var(--acc); box-shadow: 0 0 0 4px var(--bg); }
.tl-item:first-child .tl-dot { background: var(--acc); box-shadow: 0 0 0 4px var(--bg), 0 0 14px var(--acc); }
.tl-body { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; color: var(--ink-2); }
.tl-body strong { color: var(--ink); }
.tag { font-family: var(--f-mono); font-size: 0.68rem; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--mute); white-space: nowrap; }
.tag.paper { color: var(--acc); border-color: color-mix(in srgb, var(--acc) 45%, transparent); }
.tag.accept { color: #3ddc97; border-color: rgba(61, 220, 151, .45); }
:root[data-theme="light"] .tag.accept { color: #0f8a5a; border-color: rgba(15, 138, 90, .4); }
.tag.talk, .tag.award { color: var(--acc-2); border-color: color-mix(in srgb, var(--acc-2) 45%, transparent); }
.more-btn { margin-top: 16px; }

/* Publications */
.pub-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; align-items: center; }
.filter {
  font: inherit; font-size: 0.84rem; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line);
  padding: 7px 13px; border-radius: 999px; cursor: pointer; transition: color .2s, border-color .2s, background .2s;
}
.filter:hover { border-color: var(--line-2); color: var(--ink); }
.filter[aria-pressed="true"] { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); }
.filter .n { opacity: .7; margin-left: 4px; font-variant-numeric: tabular-nums; }
.pub-tools .sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
.pubs { display: grid; gap: 14px; }
.year-label { font-family: var(--f-mono); color: var(--mute); font-size: 0.8rem; letter-spacing: .1em; padding: 10px 0 2px; display: flex; align-items: center; gap: 12px; }
.year-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.pub {
  display: grid; grid-template-columns: 104px 1fr; gap: 20px; padding: 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); transition: border-color .25s, box-shadow .25s;
}
.pub:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.pub.has-fig { grid-template-columns: 104px 1fr 240px; }
.venue-badge {
  align-self: start; text-align: center; font-family: var(--f-mono); font-size: 0.7rem; line-height: 1.35; font-weight: 500;
  color: var(--acc); border: 1px solid color-mix(in srgb, var(--acc) 50%, transparent); border-radius: 8px; padding: 7px 6px;
  background: color-mix(in srgb, var(--acc) 7%, transparent);
}
.venue-badge.preprint { color: var(--acc-2); border-color: color-mix(in srgb, var(--acc-2) 50%, transparent); background: color-mix(in srgb, var(--acc-2) 7%, transparent); }
.venue-badge.workshop { color: var(--ink-2); border-color: var(--line-2); background: transparent; }
.venue-badge span { display: block; color: var(--mute); font-size: 0.66rem; }
.pub h3 { font-size: 1.04rem; font-weight: 600; line-height: 1.35; letter-spacing: 0; }
.pub .authors { color: var(--mute); font-size: 0.9rem; margin-top: 6px; }
.pub .authors .me { color: var(--ink); font-weight: 600; border-bottom: 1px solid var(--acc); }
.pub .venue { font-size: 0.88rem; color: var(--ink-2); margin-top: 3px; font-style: italic; }
.pub .note { font-size: 0.84rem; color: var(--mute); margin-top: 4px; }
.pub-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.pub-links a, .pub-links button {
  font: inherit; font-family: var(--f-mono); font-size: 0.74rem; color: var(--ink-2); background: transparent; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: 6px; padding: 3px 9px; transition: color .2s, border-color .2s;
}
.pub-links a:hover, .pub-links button:hover, .pub-links button[aria-expanded="true"] { color: var(--acc); border-color: var(--acc); text-decoration: none; }
.pub figure { margin: 0; align-self: center; }
.pub figure button { all: unset; display: block; cursor: zoom-in; border-radius: 8px; overflow: hidden; background: var(--paper); border: 1px solid var(--line); }
.pub figure button:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.pub figure img { width: 100%; height: auto; transition: transform .4s; }
.pub figure button:hover img { transform: scale(1.04); }
.bib { grid-column: 1 / -1; position: relative; margin-top: 4px; }
.bib pre {
  margin: 0; padding: 16px 18px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line);
  font-family: var(--f-mono); font-size: 0.78rem; color: var(--ink-2); overflow-x: auto; line-height: 1.6;
}
.bib .copy { position: absolute; top: 8px; right: 8px; }
.pub[hidden] { display: none; }
.empty { color: var(--mute); padding: 20px 0; }

/* Contact / footer */
.contact { display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: center; }
.contact h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); letter-spacing: -0.02em; }
.contact p { color: var(--ink-2); margin-top: 14px; max-width: 52ch; }
.mail-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line-2); font-family: var(--f-mono); font-size: 1rem; color: var(--ink);
}
.mail-card a { color: var(--ink); word-break: break-all; }
footer.site { padding-block: 28px calc(28px + env(safe-area-inset-bottom, 0px)); color: var(--mute); font-size: 0.82rem; }
footer.site .container { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px; background: rgba(3, 6, 12, .86); backdrop-filter: blur(6px); cursor: zoom-out; }
.lightbox img { max-width: min(1200px, 100%); max-height: 88vh; border-radius: 10px; background: #fff; }
.lightbox[hidden] { display: none; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 210; background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 9px; font-size: 0.86rem; font-weight: 600; }
.toast[hidden] { display: none; }

/* ---------- CV page ---------- */
.page-head { padding-block: clamp(56px, 8vw, 90px) 30px; }
.page-head h1 { font-size: clamp(2.4rem, 5vw, 3.6rem); letter-spacing: -0.03em; margin-top: 12px; }
.page-head .row { display: flex; justify-content: space-between; align-items: end; gap: 20px; flex-wrap: wrap; }
.cv-section { display: grid; grid-template-columns: 200px 1fr; gap: 28px; padding-block: 36px; border-top: 1px solid var(--line); }
.cv-section > h2 { font-size: 1.2rem; }
.cv-list { display: grid; gap: 22px; }
.cv-item { display: grid; grid-template-columns: 170px 1fr; gap: 18px; }
.cv-item .when { font-family: var(--f-mono); font-size: 0.8rem; color: var(--mute); padding-top: 2px; font-variant-numeric: tabular-nums; }
.cv-item .when span { display: block; font-size: 0.74rem; opacity: .85; }
.cv-item h3 { font-size: 1.02rem; font-family: var(--f-body); font-weight: 600; letter-spacing: 0; }
.cv-item .org { color: var(--acc); font-size: 0.92rem; }
.cv-item p, .cv-item li { color: var(--ink-2); font-size: 0.92rem; }
.cv-item ul { margin: 6px 0 0; padding-left: 18px; }
.cv-pub { color: var(--ink-2); font-size: 0.94rem; }
.cv-pub b { color: var(--ink); font-weight: 600; }

/* ---------- Reveal animation (content is visible without JS) ---------- */
.js-anim .reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s cubic-bezier(.2,.7,.2,1), transform .8s cubic-bezier(.2,.7,.2,1); transition-delay: var(--d, 0s); }
.js-anim .reveal.in { opacity: 1; transform: none; }
.hero-copy > * { animation: rise .9s both cubic-bezier(.2,.7,.2,1); }
.hero-copy > *:nth-child(2) { animation-delay: .08s; }
.hero-copy > *:nth-child(3) { animation-delay: .16s; }
.hero-copy > *:nth-child(4) { animation-delay: .24s; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .pub.has-fig { grid-template-columns: 96px 1fr; }
  .pub.has-fig figure { grid-column: 2; max-width: 420px; }
  .focus-grid { grid-template-columns: 1fr; }
  .about { grid-template-columns: 220px 1fr; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts div:nth-child(2) { border-right: 0; }
  .facts div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .contact { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .menu-btn { display: inline-grid; }
  #fl-canvas { opacity: .55; mask-image: linear-gradient(180deg, #000 30%, transparent 75%); -webkit-mask-image: linear-gradient(180deg, #000 30%, transparent 75%); }
  .nav-links {
    position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px max(var(--gutter), env(safe-area-inset-left, 0px)) 14px;
  }
  .nav-links:not(.open) { display: none; }
  .nav-links a { padding: 12px 8px; }
  .hud { position: relative; right: auto; bottom: auto; margin: 0 max(var(--gutter), env(safe-area-inset-left, 0px)) 24px; text-align: left; display: inline-block; }
  .hud .legend { justify-content: flex-start; }
  .about { grid-template-columns: 1fr; }
  .portrait { max-width: 260px; }
  .timeline::before { left: 5px; }
  .tl-item { grid-template-columns: 30px 1fr; row-gap: 2px; }
  .tl-item time { grid-column: 2; grid-row: 1; }
  .tl-dot { grid-column: 1; grid-row: 1 / span 2; justify-self: start; }
  .tl-body { grid-column: 2; }
  .pub, .pub.has-fig { grid-template-columns: 1fr; gap: 12px; padding: 16px; }
  .pub.has-fig figure { grid-column: auto; }
  .venue-badge { justify-self: start; display: inline-flex; gap: 6px; }
  .venue-badge span { display: inline; }
  .cv-section { grid-template-columns: 1fr; gap: 16px; }
  .cv-item { grid-template-columns: 1fr; gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .js-anim .reveal { opacity: 1; transform: none; }
}
@media print {
  .nav, .hero canvas, .hud, .cta, .theme-toggle, footer.site { display: none !important; }
  body { background: #fff; color: #000; }
}
.cv-pub .me { color: var(--ink); font-weight: 600; border-bottom: 1px solid var(--acc); }
@media (max-width: 420px) { .hero h1 { font-size: 2.35rem; } }
