/* ---------- Tokens ---------- */
:root {
  --bg: #fbfbf9;
  --bg-alt: #f3f2ee;
  --surface: #ffffff;
  --ink: #111418;
  --ink-2: #454b54;
  --muted: #6b717a;
  --line: #e3e2dd;
  --accent: #2a6fd1;
  --accent-ink: #1d5bb3;
  --accent-soft: #e6effb;
  --good: #1f8a5b;
  --shadow: 0 1px 2px rgba(17, 20, 24, .04), 0 8px 24px rgba(17, 20, 24, .06);
  --radius: 14px;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1117; --bg-alt: #131821; --surface: #171d27; --ink: #eef1f5; --ink-2: #c3c9d2;
    --muted: #8f97a3; --line: #262e3a; --accent: #5b9bf0; --accent-ink: #8ab8f5; --accent-soft: #17263b;
    --good: #3cc488; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1117; --bg-alt: #131821; --surface: #171d27; --ink: #eef1f5; --ink-2: #c3c9d2;
  --muted: #8f97a3; --line: #262e3a; --accent: #5b9bf0; --accent-ink: #8ab8f5; --accent-soft: #17263b;
  --good: #3cc488; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.65 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 16px; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; letter-spacing: -.01em; }
.brand svg { width: 26px; height: 26px; fill: none; stroke: var(--accent); stroke-width: 2.2; }
nav { margin-left: auto; }
.nav-links { display: flex; gap: 4px; list-style: none; }
.nav-links a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: 15px; font-weight: 500; }
.nav-links a:hover, .nav-links a.active { color: var(--ink); background: var(--bg-alt); }
.nav-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
}
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.i-sun { display: none !important; }
:root[data-theme="dark"] .i-sun { display: block !important; }
:root[data-theme="dark"] .i-moon { display: none !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: block !important; }
  :root:not([data-theme="light"]) .i-moon { display: none !important; }
}
.menu-btn { display: none; }

/* ---------- Hero ---------- */
.hero { padding: 72px 0 64px; border-bottom: 1px solid var(--line);
  background: radial-gradient(1000px 420px at 85% 0%, var(--accent-soft), transparent 70%); }
.hero-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 56px; align-items: center; }
.eyebrow { font: 500 13px/1.5 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 18px; }
h1 { font: 700 clamp(40px, 6vw, 62px)/1.05 var(--serif); letter-spacing: -.02em; margin-bottom: 22px; }
.lead { font-size: 19px; line-height: 1.6; color: var(--ink-2); max-width: 36em; }
.lead strong { color: var(--ink); font-weight: 600; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 28px 0 36px; }
.cta.center { justify-content: center; margin-bottom: 0; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 500; font-size: 15px;
  text-decoration: none; transition: transform .15s ease, border-color .15s ease;
}
.btn svg { width: 17px; height: 17px; fill: currentColor; }
.btn:hover { color: var(--ink); border-color: var(--muted); transform: translateY(-1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
:root[data-theme="dark"] .btn.primary, :root[data-theme="dark"] .btn.primary:hover { color: #0e1117; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #0e1117; } }
.stats { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: 12px 36px; margin: 0; }
.stats div { display: flex; flex-direction: column-reverse; }
.stats dt { font-size: 13px; color: var(--muted); }
.stats dd { margin: 0; font: 700 28px/1.2 var(--serif); }

.hero-art { margin: 0; }
.hero-art svg { width: 100%; height: auto; }
.hero-art figcaption { text-align: center; font-size: 13px; color: var(--muted); margin-top: 8px; }
.grid rect { fill: var(--surface); stroke: var(--line); }
.grid path { stroke: var(--line); stroke-width: 1; fill: none; }
.edge, .loop { fill: none; stroke: var(--muted); stroke-width: 2; }
.loop { stroke-width: 1.5; opacity: .7; }
.arrowhead { fill: var(--muted); }
.elabel { font: 500 13px var(--mono); fill: var(--ink-2); }
.state circle { fill: var(--surface); stroke: var(--ink); stroke-width: 2.4; }
.state text { font: 600 16px var(--sans); fill: var(--ink); text-anchor: middle; }
.state.accept circle { stroke: var(--accent); }
.state.accept circle + circle { fill: none; stroke-width: 2; }
.token { fill: var(--accent); }
@media (prefers-reduced-motion: reduce) { .token { display: none; } html { scroll-behavior: auto; } }

/* ---------- Sections ---------- */
.section { padding: 80px 0; }
.section.alt { background: var(--bg-alt); border-block: 1px solid var(--line); }
.section-title { font: 700 30px/1.2 var(--serif); letter-spacing: -.01em; margin-bottom: 14px; }
.section-sub { color: var(--ink-2); max-width: 44em; margin-bottom: 32px; }
.two-col { display: grid; grid-template-columns: 220px 1fr; gap: 40px; }
.prose p { color: var(--ink-2); font-size: 17px; }
.prose strong { color: var(--ink); font-weight: 600; }
.open-to { display: inline-flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--surface); font-size: 15px !important; margin-top: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 20%, transparent); }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.card h3 { font-size: 18px; margin: 16px 0 10px; }
.card p { color: var(--ink-2); font-size: 15px; flex: 1; }
.card-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); display: grid; place-items: center; }
.card-icon svg { width: 24px; height: 24px; fill: none; stroke: var(--accent-ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; }
.tags li { font-size: 12.5px; padding: 3px 10px; border-radius: 999px; background: var(--bg-alt); border: 1px solid var(--line); color: var(--ink-2); }

/* Timeline */
.timeline { list-style: none; border-left: 2px solid var(--line); padding-left: 24px; }
.timeline li { position: relative; display: grid; grid-template-columns: 56px 1fr; gap: 12px; padding: 9px 0; color: var(--ink-2); }
.timeline li::before { content: ""; position: absolute; left: -31px; top: 17px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent); }
.timeline time { font: 500 14px/1.9 var(--mono); color: var(--accent-ink); }
.timeline strong { color: var(--ink); font-weight: 600; }

/* Publications */
.pub-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.pub-head .section-title { margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font: 500 14px var(--sans); cursor: pointer; }
.chip:hover { border-color: var(--muted); color: var(--ink); }
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.pubs { list-style: none; display: grid; gap: 12px; }
.pub { display: grid; grid-template-columns: 150px 1fr; gap: 20px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; transition: border-color .15s ease; }
.pub:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.pub[hidden] { display: none; }
.venue { align-self: start; justify-self: start; font: 600 12.5px/1.3 var(--mono); padding: 5px 9px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent-ink); }
.venue.preprint { background: var(--bg-alt); color: var(--muted); border: 1px solid var(--line); }
.pub h3 { font-size: 16.5px; font-weight: 600; margin-bottom: 6px; }
.authors { font-size: 14.5px; color: var(--ink-2); margin-bottom: 2px; }
.authors b { color: var(--ink); font-weight: 600; }
.where { font-size: 14px; color: var(--muted); margin: 0; font-style: italic; }
.where a { font-style: normal; font-weight: 500; }
.more { margin: 24px 0 0; color: var(--ink-2); }

/* Repos */
.repos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.repo { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
  color: var(--ink); text-decoration: none; box-shadow: var(--shadow); transition: transform .15s ease, border-color .15s ease; }
a.repo:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--ink); }
.repo.soon { box-shadow: none; border-style: dashed; background: transparent; }
.repo-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.repo-name { font: 600 18px var(--mono); }
.badge { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); white-space: nowrap; }
.badge.muted { background: var(--bg-alt); color: var(--muted); }
.repo p { color: var(--ink-2); font-size: 15px; }
.text-link { font-weight: 500; text-decoration: none; }

/* Experience */
.xp, .edu { list-style: none; display: grid; gap: 28px; }
.xp-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.xp h3 { font-size: 18px; }
.edu h4 { font-size: 16px; font-weight: 600; }
.xp-head time { font: 500 13.5px var(--mono); color: var(--muted); white-space: nowrap; }
.org { color: var(--accent-ink); font-size: 15px; margin: 4px 0 10px; }
.edu .org { color: var(--ink-2); margin-bottom: 0; }
.xp ul { padding-left: 20px; color: var(--ink-2); font-size: 15.5px; display: grid; gap: 6px; }
.xp ul strong { color: var(--ink); font-weight: 600; }
.sub-title { font: 700 22px var(--serif); margin: 48px 0 20px; }

/* Skills */
.skills { display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px 40px; }
.skills h3 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.honors { padding-left: 18px; color: var(--ink-2); font-size: 15px; display: grid; gap: 6px; }

/* Contact / footer */
.contact { text-align: center; background: linear-gradient(180deg, var(--bg), var(--accent-soft)); border-top: 1px solid var(--line); }
.contact .section-sub { margin-inline: auto; }
.footer { padding: 28px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; text-align: center; }
.footer p { margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .hero-art { max-width: 460px; margin-inline: auto; width: 100%; }
  .cards { grid-template-columns: 1fr; }
  .repos { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; gap: 8px; }
}
@media (max-width: 760px) {
  .menu-btn { display: grid; }
  nav { margin-left: auto; }
  .nav-links { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 16px 16px; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px; }
  .hero { padding: 48px 0; }
  .lead { font-size: 17px; }
  .stats { grid-template-columns: repeat(2, auto); gap: 14px 40px; }
  .section { padding: 56px 0; }
  .pub { grid-template-columns: 1fr; gap: 10px; padding: 18px; }
  .repos, .skills { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; gap: 0; }
}
