:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1d2321;
  --muted: #5d6764;
  --line: #e6e3dc;
  --accent: #0f6b5f;
  --accent-soft: #e3f1ee;
  --highlight: #b4561f;
  --shadow: 0 1px 2px rgba(20, 30, 28, .05), 0 4px 16px rgba(20, 30, 28, .05);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --width: 960px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121615;
    --surface: #1a201e;
    --text: #e6ebe9;
    --muted: #9aa6a2;
    --line: #2b3331;
    --accent: #5cc4b2;
    --accent-soft: #1d332f;
    --highlight: #e79a62;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121615;
  --surface: #1a201e;
  --text: #e6ebe9;
  --muted: #9aa6a2;
  --line: #2b3331;
  --accent: #5cc4b2;
  --accent-soft: #1d332f;
  --highlight: #e79a62;
  --shadow: none;
  color-scheme: dark;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.25; margin: 0; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; z-index: 100; background: var(--surface); padding: 8px 12px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--width); margin: 0 auto; padding: 0 24px;
  height: 56px; display: flex; align-items: center; gap: 24px;
}
.brand { font-family: var(--serif); font-weight: 600; font-size: 1.15rem; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 20px; margin-left: auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--muted); font-size: .9rem; font-weight: 500; white-space: nowrap; }
.nav a:hover, .nav a.is-current { color: var(--accent); text-decoration: none; }
.theme-toggle {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  display: grid; place-items: center; cursor: pointer;
}
.theme-toggle svg { width: 16px; height: 16px; fill: currentColor; }
.theme-toggle:hover { color: var(--accent); }

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

/* Hero */
.hero {
  display: grid; grid-template-columns: 220px 1fr; gap: 48px; align-items: start;
  padding: 64px 0 48px;
}
.portrait {
  width: 220px; height: auto; aspect-ratio: 750 / 780; object-fit: cover;
  border-radius: 18px; box-shadow: var(--shadow);
}
.eyebrow { margin: 0 0 6px; color: var(--highlight); font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3rem); letter-spacing: -.01em; }
.affil { color: var(--muted); margin: 8px 0 0; }
.bio { margin-top: 20px; max-width: 60ch; }
.bio p { margin: 0; }
.links { list-style: none; padding: 0; margin: 24px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.links a {
  display: inline-block; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: .85rem; font-weight: 500; color: var(--text);
}
.links a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.links a.link-primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.links a.link-primary:hover { opacity: .9; color: var(--bg); }

/* Sections */
.section { padding: 48px 0; border-top: 1px solid var(--line); }
.section h2 { font-size: 1.75rem; margin-bottom: 24px; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.section-head h2 { margin: 0; }

/* Research */
.interests { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.interest {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px; box-shadow: var(--shadow);
}
.interest-num { font-family: var(--serif); color: var(--highlight); font-size: .95rem; }
.interest h3 { font-size: 1.15rem; margin: 6px 0 10px; }
.interest h3 a { color: inherit; }
.interest p { margin: 0; color: var(--muted); font-size: .93rem; }

/* News */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: grid; grid-template-columns: 96px 1fr; gap: 16px;
  padding: 10px 0; border-bottom: 1px dashed var(--line);
}
.timeline li:last-child { border-bottom: 0; }
.timeline time, .plain-list time { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; padding-top: 2px; }
.timeline li.is-paper div::before {
  content: "Paper"; display: inline-block; margin-right: 8px; padding: 0 7px;
  border-radius: 4px; background: var(--accent-soft); color: var(--accent);
  font-size: .72rem; font-weight: 600; letter-spacing: .03em; vertical-align: 2px;
}
.timeline.is-collapsed li.is-extra { display: none; }
.more {
  margin-top: 16px; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: 500 .85rem var(--sans);
}
.more:hover { border-color: var(--accent); color: var(--accent); }

/* Publications */
.filter { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--surface); }
.filter button {
  border: 0; background: none; color: var(--muted); cursor: pointer;
  padding: 5px 14px; border-radius: 999px; font: 500 .85rem var(--sans);
}
.filter button span { opacity: .7; margin-left: 2px; }
.filter button.is-active { background: var(--accent); color: var(--bg); }

.year-group { display: grid; grid-template-columns: 72px 1fr; gap: 0 16px; }
.year-group + .year-group { margin-top: 12px; }
.year { grid-row: span 99; font-size: 1.1rem; color: var(--muted); padding-top: 18px; }
.year-group.is-empty { display: none; }

.pub {
  display: grid; grid-template-columns: 200px 1fr; gap: 24px;
  padding: 18px 0; border-bottom: 1px solid var(--line);
}
.pub[hidden] { display: none; }
.pub-media {
  display: block; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; aspect-ratio: 4 / 3;
}
.pub-media img, .pub-media video { width: 100%; height: 100%; object-fit: contain; display: block; }
.pub h4 { font-size: 1.08rem; }
.pub h4 a { color: var(--text); }
.pub h4 a:hover { color: var(--accent); }
.authors { margin: 6px 0 2px; font-size: .9rem; color: var(--muted); }
.authors b { color: var(--text); font-weight: 600; }
.venue { margin: 0; font-size: .9rem; }
.venue em { color: var(--highlight); font-style: normal; font-weight: 600; }
details { margin-top: 8px; font-size: .9rem; }
summary { cursor: pointer; color: var(--accent); font-weight: 500; width: fit-content; }
details ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
details li + li { margin-top: 4px; }

/* Honors + education */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 48px; border-top: 1px solid var(--line); }
.two-col .section { border-top: 0; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { display: grid; grid-template-columns: 76px 1fr; gap: 14px; padding: 9px 0; font-size: .95rem; }
#education .plain-list li { grid-template-columns: 1fr; gap: 2px; }
.note {
  display: inline-block; margin-left: 4px; padding: 0 7px; border-radius: 4px;
  background: var(--accent-soft); color: var(--accent); font-size: .75rem; font-weight: 500;
}
.muted { color: var(--muted); }

.footer {
  max-width: var(--width); margin: 0 auto; padding: 32px 24px 48px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem;
}
.footer p { margin: 0; }

/* Responsive */
@media (max-width: 860px) {
  .interests { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .two-col .section + .section { border-top: 1px solid var(--line); }
}
@media (max-width: 680px) {
  .topbar-inner, main, .footer { padding-left: 16px; padding-right: 16px; }
  .topbar-inner { gap: 14px; }
  .brand { display: none; }
  .nav { margin-left: 0; gap: 16px; }
  .theme-toggle { margin-left: auto; }
  .hero { grid-template-columns: 1fr; gap: 24px; padding: 40px 0 32px; }
  .portrait { width: 140px; }
  .year-group { grid-template-columns: 1fr; }
  .year { grid-row: auto; padding-top: 12px; }
  .pub { grid-template-columns: 1fr; gap: 12px; }
  .pub-media { max-width: 320px; }
  .timeline li { grid-template-columns: 1fr; gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
