/* ---------- Tokens ---------- */
:root {
  --bg: #fbfaf8;
  --surface: #ffffff;
  --text: #1c1b1a;
  --muted: #6b6862;
  --faint: #e8e5df;
  --accent: #3a4fd6;
  --accent-soft: #eef0fd;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius: 10px;
  --max: 760px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413;
    --surface: #1c1c1a;
    --text: #ecebe7;
    --muted: #9c9890;
    --faint: #2c2b28;
    --accent: #8d9cff;
    --accent-soft: #23264a;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::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 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--faint);
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 16px; }
.nav .brand { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; color: var(--text); white-space: nowrap; }
.nav ul { display: flex; gap: 4px; min-width: 0; list-style: none; margin: 0; padding: 0; overflow-x: auto; scrollbar-width: none; }
.nav ul::-webkit-scrollbar { display: none; }
.nav li a {
  display: block; padding: 6px 10px; border-radius: 8px;
  color: var(--muted); font-size: 0.9rem; white-space: nowrap;
}
.nav li a:hover, .nav li a.active { color: var(--text); background: var(--faint); text-decoration: none; }

/* ---------- Hero ---------- */
.hero { padding: 64px 0 40px; }
.hero .wrap { display: grid; grid-template-columns: 132px 1fr; gap: 32px; align-items: center; }
.hero img {
  width: 132px; height: 132px; border-radius: 50%; object-fit: cover;
  box-shadow: 0 0 0 4px var(--surface), 0 0 0 5px var(--faint);
}
.hero .wrap { align-items: start; }
.hero img { margin-top: 6px; }
.hero h1 { font-size: clamp(2rem, 5vw, 2.6rem); letter-spacing: -0.01em; }
.hero .tagline { margin: 10px 0 0; font-size: 1.12rem; line-height: 1.5; max-width: 34em; }
.hero .role { margin: 8px 0 0; color: var(--muted); font-size: 0.95rem; }
.hero .role a { color: inherit; border-bottom: 1px solid var(--faint); }
.hero .role a:hover { color: var(--accent); text-decoration: none; }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; padding: 0; list-style: none; }
.links a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border: 1px solid var(--faint); border-radius: 999px;
  color: var(--text); font-size: 0.85rem; background: var(--surface);
  transition: border-color .15s, color .15s;
}
.links a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.links button {
  display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 999px;
  font: inherit; font-size: 0.85rem; cursor: pointer; border: 1px solid var(--faint);
}
.links button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.links button.primary:hover { opacity: .9; }
@media (prefers-color-scheme: dark) { .links button.primary { color: #141413; } }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.linklike:hover { text-decoration: underline; text-underline-offset: 3px; }
.links a.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.links a.primary:hover { color: #fff; opacity: .9; }
@media (prefers-color-scheme: dark) { .links a.primary, .links a.primary:hover { color: #141413; } }

/* ---------- Accessibility ---------- */
.skip {
  position: absolute; left: 12px; top: -48px; z-index: 20;
  background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px;
}
.skip:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a:focus-visible, summary:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- Themes (About) ---------- */
.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 24px 0 0; }
.themes > div { background: var(--surface); border: 1px solid var(--faint); border-radius: var(--radius); padding: 14px 16px; }
.themes dt { font-weight: 600; font-size: 0.92rem; color: var(--accent); margin-bottom: 4px; }
.themes dd { margin: 0; color: var(--muted); font-size: 0.88rem; line-height: 1.5; }

/* ---------- Selected research ---------- */
.projects { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.project {
  background: var(--surface); border: 1px solid var(--faint); border-radius: var(--radius);
  padding: 20px; display: flex; flex-direction: column;
}
.project h3 {
  font-family: var(--serif); font-size: 1.15rem; font-weight: 600; text-transform: none;
  letter-spacing: 0; color: var(--text); margin: 0 0 10px;
}
.project p { font-size: 0.92rem; margin: 0 0 12px; }
.project .result { background: var(--accent-soft); border-radius: 8px; padding: 10px 12px; }
.project .result span {
  display: block; font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--accent); margin-bottom: 2px;
}
.project .refs { margin-top: auto; margin-bottom: 0; font-size: 0.82rem; color: var(--muted); }

/* ---------- Sections ---------- */
section { padding: 36px 0; border-top: 1px solid var(--faint); }
section h2 { font-size: 1.6rem; margin-bottom: 20px; }
section h3 {
  font-family: var(--sans); font-size: 0.78rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
  margin: 28px 0 12px;
}
section h3:first-of-type { margin-top: 0; }
p { margin: 0 0 1em; }
.interests { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.interests li {
  padding: 4px 12px; border-radius: 999px; font-size: 0.85rem;
  background: var(--accent-soft); color: var(--accent);
}

/* ---------- Publications ---------- */
.pub-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.pub-tools input {
  flex: 1 1 220px; min-width: 0;
  padding: 9px 14px; border-radius: var(--radius); border: 1px solid var(--faint);
  background: var(--surface); color: var(--text); font: inherit; font-size: 0.92rem;
}
.pub-tools input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.pub-count { color: var(--muted); font-size: 0.85rem; }
.year { margin-top: 28px; }
.year > h3 { margin: 0 0 4px; }
.pub { padding: 14px 0; border-bottom: 1px dashed var(--faint); }
.pub:last-child { border-bottom: 0; }
.pub { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 20px; align-items: start; }
.pub[hidden] { display: none; }
.pub .thumb, .proj-fig img {
  display: block; width: 100%; background: #fff; border: 1px solid var(--faint);
  border-radius: 8px; padding: 4px; object-fit: contain;
}
.pub .thumb { aspect-ratio: 4 / 3; margin-top: 2px; }
.proj-fig { margin: -4px 0 14px; }
.proj-fig img { height: 190px; padding: 8px; }
.pub .title { font-family: var(--sans); font-size: 1rem; font-weight: 600; line-height: 1.4; margin: 0; }
.pub-summary { color: var(--muted); font-size: 0.9rem; margin: -8px 0 16px; }
.status {
  font-style: normal; font-size: 0.72rem; font-weight: 500; padding: 1px 8px; border-radius: 999px;
  background: #fff4d6; color: #8a5a00; margin-left: 4px; vertical-align: 1px;
}
@media (prefers-color-scheme: dark) { .status { background: #3a2f12; color: #f0c560; } }
details.abs { display: contents; }
details.abs summary {
  font-size: 0.75rem; font-weight: 500; padding: 2px 9px; border-radius: 6px;
  border: 1px solid var(--faint); color: var(--muted); cursor: pointer; list-style: none;
}
details.abs summary::-webkit-details-marker { display: none; }
details.abs summary::after { content: " ▾"; }
details.abs[open] summary::after { content: " ▴"; }
details.abs summary:hover { color: var(--accent); border-color: var(--accent); }
details.abs p {
  flex-basis: 100%; margin: 6px 0 0; font-size: 0.88rem; line-height: 1.6; color: var(--muted);
  border-left: 2px solid var(--faint); padding-left: 12px;
}
.pub .star { color: #e0a100; margin-right: 6px; font-size: 1.05em; cursor: help; }
.pub.featured {
  background: var(--surface); border: 1px solid var(--faint); border-radius: var(--radius);
  padding: 14px 16px; margin: 8px -16px;
}
.pub .authors { color: var(--muted); font-size: 0.9rem; margin-top: 3px; }
.pub .authors b { color: var(--text); font-weight: 600; }
.pub .venue { font-size: 0.9rem; margin-top: 2px; font-style: italic; }
.pub .venue .pre { font-style: normal; font-size: 0.75rem; padding: 1px 7px; border-radius: 999px; background: var(--faint); color: var(--muted); margin-left: 4px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tags a {
  font-size: 0.75rem; font-weight: 500; padding: 2px 9px; border-radius: 6px;
  border: 1px solid var(--faint); color: var(--muted);
}
.tags a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.empty { color: var(--muted); padding: 16px 0; display: none; }

/* ---------- Lists (talks, teaching, service) ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: grid; grid-template-columns: 56px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--faint); }
.list li:last-child { border-bottom: 0; }
.list .y { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.9rem; padding-top: 1px; }
.list .t { font-weight: 500; }
.list .d { color: var(--muted); font-size: 0.9rem; }
.list.plain li { grid-template-columns: 1fr; }

details.more { margin-top: 4px; }
details.more summary {
  cursor: pointer; color: var(--accent); font-size: 0.9rem; padding: 8px 0; list-style: none;
}
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "+ "; }
details.more[open] summary::before { content: "− "; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.two-col h3:first-child { margin-top: 0; }

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--faint); padding: 28px 0 48px; color: var(--muted); font-size: 0.85rem; }
footer p { margin: 0 0 4px; }

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  .nav .brand { display: none; }
  .nav .wrap { justify-content: center; padding: 0 8px; }
  .nav ul { gap: 0; }
  .nav li a { padding: 6px 7px; font-size: 0.85rem; }
  .wide-only { display: none; }
  .hero { padding: 40px 0 28px; }
  .hero .wrap { grid-template-columns: 1fr; gap: 20px; }
  .hero img { width: 104px; height: 104px; }
  .list li { grid-template-columns: 1fr; gap: 0; }
  .themes, .projects, .two-col { grid-template-columns: 1fr; }
  .pub { grid-template-columns: 76px minmax(0, 1fr); gap: 12px; }
  .proj-fig img { height: 170px; }
  .two-col { gap: 0; }
  .two-col > div + div { margin-top: 28px; }
  .hero .tagline { font-size: 1.02rem; }
}

@media print {
  .nav, .pub-tools, details.more summary { display: none; }
  details.more > * { display: block; }
}
