/* ---------- tokens ---------- */
:root {
  color-scheme: light;
  --bg: #faf8f5;
  --surface: #ffffff;
  --surface-2: #f3f0ea;
  --ink: #1c1917;
  --ink-2: #57534e;
  --ink-3: #8a847d;
  --line: #e8e3dc;
  --accent: #e5532d;
  --accent-ink: #b8391a;
  --accent-strong: #c7411d;
  --accent-soft: rgba(229, 83, 45, 0.09);
  --shadow: 0 1px 2px rgba(28, 25, 23, 0.04), 0 10px 28px -14px rgba(28, 25, 23, 0.14);
  --nav-bg: rgba(250, 248, 245, 0.62);
  --dot: rgba(28, 25, 23, 0.09);
  --glow-a: rgba(229, 83, 45, 0.16);
  --glow-b: rgba(74, 122, 255, 0.10);
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Noto Sans SC", sans-serif;
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 18px;
  --nav-h: 60px;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12100e;
  --surface: #1a1714;
  --surface-2: #221e1a;
  --ink: #f3efe9;
  --ink-2: #b9b2a8;
  --ink-3: #857e74;
  --line: #2c2723;
  --accent: #ff7a52;
  --accent-ink: #ff916f;
  --accent-strong: #d9532a;
  --accent-soft: rgba(255, 122, 82, 0.12);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 30px -14px rgba(0, 0, 0, 0.6);
  --nav-bg: rgba(18, 16, 14, 0.62);
  --dot: rgba(243, 239, 233, 0.08);
  --glow-a: rgba(255, 122, 82, 0.14);
  --glow-b: rgba(96, 140, 255, 0.10);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.7 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .3s, color .3s;
}
a { color: inherit; text-decoration: none; }
abbr[title] { text-decoration: none; cursor: help; }
img { max-width: 100%; display: block; }
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--accent-soft); color: var(--ink); }

.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; }
.skip:focus { left: 12px; }

.i { width: 1.05em; height: 1.05em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- ambient background ---------- */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image: radial-gradient(var(--dot) 1px, transparent 1.2px);
  background-size: 26px 26px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 70%);
          mask-image: linear-gradient(to bottom, #000 0%, transparent 70%);
}
.glow { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.glow span { position: absolute; border-radius: 50%; filter: blur(70px); will-change: transform; }
.glow span:nth-child(1) { width: 520px; height: 520px; left: -140px; top: -120px; background: var(--glow-a); animation: drift 26s ease-in-out infinite alternate; }
.glow span:nth-child(2) { width: 460px; height: 460px; right: -120px; top: 60px; background: var(--glow-b); animation: drift 32s ease-in-out infinite alternate-reverse; }
@keyframes drift { to { transform: translate3d(70px, 50px, 0) scale(1.08); } }

.progress { position: fixed; left: 0; top: 0; height: 2px; width: 100%; z-index: 60; background: var(--accent); transform: scaleX(0); transform-origin: 0 50%; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50; height: var(--nav-h);
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(1.5) blur(14px); backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid transparent; transition: border-color .25s;
}
.nav.scrolled { border-color: var(--line); }
.nav-in { max-width: 1180px; margin: 0 auto; padding: 0 28px; height: 100%; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font: 600 16px var(--font-display); letter-spacing: -.01em; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--ink); color: var(--bg); font: 600 11.5px var(--font-mono); letter-spacing: 0; }
.nav-links { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a { padding: 6px 13px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--ink-2); white-space: nowrap; transition: color .2s, background .2s; }
.nav-links a:hover { color: var(--ink); background: var(--surface-2); }
.nav-links a[aria-current="true"] { color: var(--accent-ink); background: var(--accent-soft); }
.theme { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); display: grid; place-items: center; cursor: pointer; transition: color .2s, border-color .2s, transform .2s; }
.theme:hover { color: var(--accent-ink); border-color: var(--accent); }
.theme:active { transform: scale(.94); }
.theme .i { width: 17px; height: 17px; }
.theme .sun { display: none; }
[data-theme="dark"] .theme .sun { display: block; }
[data-theme="dark"] .theme .moon { display: none; }

/* ---------- layout ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 36px 28px 40px; display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: 56px; align-items: start; }
.profile { position: sticky; top: calc(var(--nav-h) + 28px); }
main { min-width: 0; }
section { scroll-margin-top: calc(var(--nav-h) + 20px); margin-bottom: 72px; }

/* ---------- profile ---------- */
.avatar { position: relative; width: 132px; height: 132px; margin-bottom: 22px; }
.avatar::before { content: ""; position: absolute; inset: -14px; border-radius: 40px; background: radial-gradient(closest-side, var(--glow-a), transparent); filter: blur(10px); z-index: -1; }
.avatar img { width: 100%; height: 100%; border-radius: 32px; object-fit: cover; box-shadow: 0 0 0 1px var(--line), 0 0 0 5px var(--surface), 0 0 0 6px var(--line), var(--shadow); }
.name { font: 700 30px/1.1 var(--font-display); letter-spacing: -.025em; }
.role { margin-top: 10px; color: var(--ink-2); font-size: 15px; line-height: 1.5; }
.affil { margin-top: 16px; display: grid; gap: 8px; }
.affil li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-2); }
.affil li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); flex: none; }
.affil b { color: var(--ink); font-weight: 600; }
.loc { margin-top: 16px; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-3); }
.contact { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.contact a { display: flex; align-items: center; gap: 11px; padding: 7px 10px; margin: 0 -10px; border-radius: 10px; font-size: 14.5px; color: var(--ink-2); transition: color .2s, background .2s; }
.contact a:hover { color: var(--accent-ink); background: var(--accent-soft); }
.contact .i { width: 17px; height: 17px; }

/* ---------- section headings ---------- */
.sec-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 26px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.sec-head .idx { font: 500 12px var(--font-mono); color: var(--accent-ink); letter-spacing: .04em; }
.sec-head h2 { font: 700 26px/1.2 var(--font-display); letter-spacing: -.02em; }
.sec-head .aside { margin-left: auto; font: 400 12.5px var(--font-mono); color: var(--ink-3); }

/* ---------- about ---------- */
.lead { font: 700 clamp(28px, 3.6vw, 38px)/1.16 var(--font-display); letter-spacing: -.03em; max-width: 20em; }
.lead em { font-style: normal; background: linear-gradient(100deg, var(--accent), #f59e0b 90%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.prose { margin-top: 22px; display: grid; gap: 14px; max-width: 42em; color: var(--ink-2); font-size: 16.5px; line-height: 1.75; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose a { color: var(--ink); font-weight: 500; background: linear-gradient(var(--accent), var(--accent)) 0 100%/100% 1.5px no-repeat; padding-bottom: 1px; transition: color .2s, background-size .25s; }
.prose a:hover { color: var(--accent-ink); }

.qs-label { margin-top: 34px; font: 500 12px var(--font-mono); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.questions { margin-top: 12px; }
.questions li { display: grid; grid-template-columns: 46px minmax(0, 1fr); align-items: baseline; padding: 15px 0; border-top: 1px solid var(--line); }
.questions li:last-child { border-bottom: 1px solid var(--line); }
.questions .q { font: 600 13px var(--font-mono); color: var(--accent-ink); }
.questions p { font: 500 clamp(18px, 2vw, 21px)/1.4 var(--font-display); letter-spacing: -.012em; max-width: 30em; }
.questions em { font-style: normal; background: linear-gradient(transparent 62%, var(--accent-soft) 62%); box-shadow: 0 2px 0 var(--accent); }
.interest .tag b { margin-right: 8px; padding: 1px 7px; border-radius: 6px; background: var(--accent-soft); font-weight: 600; }
.interests { margin-top: 26px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.interest { padding: 18px 18px 20px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); transition: border-color .25s, transform .25s, box-shadow .25s; }
.interest.new { border-style: dashed; background: transparent; }
.interest:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.interest .tag { font: 500 11.5px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--accent-ink); }
.interest p { margin-top: 10px; font-size: 14.5px; line-height: 1.6; color: var(--ink-2); }

/* ---------- timeline ---------- */
.tl { position: relative; margin-left: 6px; padding-left: 24px; border-left: 1px solid var(--line); }
.tl-item { position: relative; padding-bottom: 36px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ""; position: absolute; left: -30px; top: 7px; width: 11px; height: 11px; border-radius: 50%; background: var(--bg); border: 2px solid var(--ink-3); transition: border-color .25s; }
.tl-item.current::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.tl-item:hover::before { border-color: var(--accent); }
.tl-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.tl-head h3 { font: 600 19px/1.3 var(--font-display); letter-spacing: -.01em; }
.tl-head .date { font: 400 12.5px var(--font-mono); color: var(--ink-3); white-space: nowrap; }
.tl-sub { margin-top: 2px; color: var(--ink-2); font-size: 15px; }
.tl-sub a { color: var(--ink); font-weight: 500; }
.tl-sub a:hover { color: var(--accent-ink); }
.tl-sub .sep { margin: 0 8px; color: var(--ink-3); }
.bullets { margin-top: 12px; display: grid; gap: 9px; max-width: 46em; }
.bullets li { position: relative; padding-left: 18px; font-size: 15px; line-height: 1.65; color: var(--ink-2); }
.bullets li::before { content: ""; position: absolute; left: 0; top: .78em; width: 8px; height: 1.5px; background: var(--accent); }
.bullets b { color: var(--ink); font-weight: 600; }

.chips { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font: 500 12px var(--font-mono); color: var(--ink-2); }
.chip b { color: var(--accent-ink); font-weight: 600; }

/* ---------- publications ---------- */
.pubs { display: grid; gap: 22px; }
.pub { display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: 24px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); transition: transform .3s, border-color .3s, box-shadow .3s; }
.pub:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.pub-fig { position: relative; align-self: start; width: 100%; aspect-ratio: 21 / 10; padding: 0; border-radius: 14px; background: #fff; border: 1px solid var(--line); overflow: hidden; display: grid; place-items: center; cursor: zoom-in; font: inherit; color: inherit; }
.pub-fig::after { content: "Click to enlarge"; position: absolute; right: 8px; bottom: 8px; padding: 2px 8px; border-radius: 999px; font: 500 10.5px/1.6 var(--font-mono); background: rgba(28, 25, 23, .78); color: #faf8f5; opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s; }
.pub-fig:hover::after, .pub-fig:focus-visible::after { opacity: 1; transform: none; }
.pub-fig img { width: 100%; height: 100%; object-fit: contain; padding: 8px; transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.pub:hover .pub-fig img { transform: scale(1.04); }
.badge { position: absolute; left: 10px; top: 10px; z-index: 1; padding: 3px 9px; border-radius: 999px; font: 500 11px/1.5 var(--font-mono); letter-spacing: .02em; background: #1c1917; color: #faf8f5; }
.badge.venue { background: var(--accent-strong); color: #fff; }
.pub-title { font: 600 19px/1.35 var(--font-display); letter-spacing: -.012em; }
.pub-title a { background: linear-gradient(var(--accent), var(--accent)) 0 100%/0 1.5px no-repeat; transition: background-size .3s, color .2s; }
.pub-title a:hover { background-size: 100% 1.5px; color: var(--accent-ink); }
.authors { margin-top: 8px; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.authors a:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
.authors .me { color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.authors sup { color: var(--accent-ink); font-weight: 600; }
.tldr { margin-top: 12px; font-size: 14.5px; line-height: 1.68; color: var(--ink-2); }
.tldr b { color: var(--ink); font-weight: 600; }
.pub .chips { margin-top: 12px; }
.links { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); font-size: 13px; font-weight: 500; color: var(--ink); transition: background .2s, color .2s, border-color .2s, transform .2s; }
.btn:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); transform: translateY(-1px); }
.btn .i { width: 14px; height: 14px; }
.notes { margin-top: 14px; display: grid; gap: 5px; }
.note { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.note .i { margin-top: 2px; width: 14px; height: 14px; color: var(--accent); }
.note a { color: var(--accent-ink); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.eq { margin-top: 2px; font: 400 12px var(--font-mono); color: var(--ink-3); }

/* ---------- education ---------- */
.edu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.edu { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; transition: border-color .25s, transform .25s, box-shadow .25s; }
.edu:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.edu .date { font: 400 12.5px var(--font-mono); color: var(--ink-3); }
.edu h3 { margin-top: 8px; font: 600 18px/1.3 var(--font-display); letter-spacing: -.01em; }
.edu p { margin-top: 4px; font-size: 14.5px; color: var(--ink-2); }
.edu .chips { margin-top: 12px; }

/* ---------- footer ---------- */
footer { max-width: 1180px; margin: 0 auto; padding: 24px 28px 48px; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-3); }
footer a:hover { color: var(--accent-ink); }

/* ---------- reveal ---------- */
.js [data-reveal] { opacity: 0; transform: translateY(16px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .2, 1); transition-delay: var(--d, 0s); }
.js [data-reveal].in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .page { grid-template-columns: 1fr; gap: 44px; padding-top: 28px; }
  .profile { position: static; display: grid; grid-template-columns: auto 1fr; column-gap: 28px; align-items: start; }
  .avatar { grid-row: 1 / span 4; margin: 0; }
  .contact { grid-column: 1 / -1; grid-template-columns: repeat(auto-fit, minmax(150px, max-content)); gap: 4px 22px; }
  .contact a { margin: 0; }
}
@media (max-width: 760px) {
  .pub { grid-template-columns: 1fr; gap: 18px; }
  .interests { grid-template-columns: 1fr; }
  .brand span:last-child { display: none; }
}
@media (max-width: 560px) {
  .nav-in, .page, footer { padding-left: 18px; padding-right: 18px; }
  .nav-in { gap: 10px; }
  .nav-links a { padding: 6px 9px; font-size: 13.5px; }
  .profile { grid-template-columns: 1fr; }
  .avatar { grid-row: auto; margin-bottom: 20px; }
  .edu-grid { grid-template-columns: 1fr; }
  .sec-head h2 { font-size: 23px; }
  .tl-head h3 { font-size: 17.5px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .glow span { animation: none; }
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  * { transition-duration: .01ms !important; }
}
@media print {
  .nav, .glow, .progress, .theme { display: none; }
  body::before { display: none; }
  .pub, .interest, .edu { box-shadow: none; break-inside: avoid; }
}

/* ---------- lightbox ---------- */
dialog.lb { width: min(92vw, 1400px); max-height: 90vh; padding: 12px; border: 0; border-radius: 18px; background: #fff; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5); overflow: auto; }
dialog.lb::backdrop { background: rgba(18, 16, 14, .62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
dialog.lb img { width: 100%; height: auto; border-radius: 10px; }
dialog.lb button { position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid #e8e3dc; background: rgba(255, 255, 255, .92); color: #1c1917; font: 500 20px/1 var(--font-sans); cursor: pointer; }
dialog.lb button:hover { background: #1c1917; color: #fff; }
