/* ---------- tokens ---------- */
:root {
  --bg: #faf9f7;
  --surface: #ffffff;
  --text: #16171a;
  --muted: #5c6068;
  --faint: #6b6f76;
  --line: #e7e4df;
  --accent: #d92d2a;
  --accent-ink: #b3221f;   /* accent text on tinted backgrounds */
  --accent-soft: #fbe9e8;
  --tile: #ffffff;
  --radius: 14px;
  --maxw: 1120px;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111214;
    --surface: #1a1b1e;
    --text: #ecebe8;
    --muted: #a3a6ab;
    --faint: #8e9197;
    --line: #2c2d31;
    --accent: #ff5d55;
    --accent-ink: #ff7b74;
    --accent-soft: #3a1d1c;
    --tile: #f4f2ee;
    color-scheme: dark;
  }
  .logo { filter: invert(1) hue-rotate(180deg); }
}

/* ---------- 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(--text);
  font: 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
a:hover { color: var(--accent); text-decoration-color: currentColor; }
h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 24px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; white-space: nowrap; }
.brand img { width: 28px; height: 28px; }
.nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 6px 10px; border-radius: 8px; text-decoration: none; color: var(--muted);
  font-size: 15px; white-space: nowrap;
}
.nav a:hover { color: var(--text); background: var(--line); }
.nav a[aria-current='true'] { color: var(--text); background: var(--accent-soft); }
@media (max-width: 720px) {
  html { scroll-padding-top: 16px; }
  .site-header { position: static; }
  .site-header .wrap { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 8px; row-gap: 6px; }
  .nav { margin-left: -8px; width: calc(100% + 8px); flex-wrap: wrap; overflow: visible; gap: 2px; }
  .nav a { padding: 5px 8px; font-size: 14px; }
}

/* ---------- sections ---------- */
section { padding: 72px 0; border-top: 1px solid var(--line); }
section:first-of-type { border-top: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 32px; flex-wrap: wrap; }
.section-head h2 { font-size: 28px; }
.kicker {
  font: 500 12px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 10px;
}
.more { font-size: 15px; text-decoration: none; color: var(--muted); white-space: nowrap; }
.more:hover { color: var(--accent); }

/* ---------- hero ---------- */
.hero { padding: 64px 0 56px; }
.hero .wrap { display: grid; grid-template-columns: 1.25fr 1fr; gap: 56px; align-items: start; }
.hero h1 { font-size: clamp(40px, 6vw, 60px); letter-spacing: -0.025em; }
.hero .tagline { font: 500 15px/1.4 var(--mono); color: var(--accent); margin: 14px 0 22px; }
.hero .intro { font-size: 19px; line-height: 1.55; color: var(--text); max-width: 34em; }
.affils { list-style: none; padding: 0; margin: 20px 0 28px; color: var(--muted); font-size: 15px; }
.affils li { padding: 2px 0; }
.affils a { text-decoration: none; }
.buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); text-decoration: none; font-size: 15px;
}
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
@media (max-width: 880px) { .hero .wrap { grid-template-columns: 1fr; gap: 40px; } }

/* ---------- news ---------- */
.news-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; }
.news-card h2 .more { font: 14px/1 var(--sans); letter-spacing: 0; text-transform: none; }
.news-card h2 { font-size: 13px; font: 500 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; display: flex; justify-content: space-between; }
.news { list-style: none; margin: 0; padding: 0; }
.news li { display: grid; grid-template-columns: 72px 1fr; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 15px; line-height: 1.45; }
.news li:first-child { border-top: 0; }
.news time { font: 13px/1.6 var(--mono); color: var(--faint); white-space: nowrap; }
.news a { text-decoration: none; }
.news a:hover { text-decoration: underline; }
.tag {
  display: inline-block; font: 500 12px/1 var(--mono); letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 6px; border-radius: 5px; margin-right: 6px; vertical-align: 1px;
  background: var(--line); color: var(--muted);
}
.tag-paper, .tag-preprint { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- research ---------- */
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 880px) { .grid3 { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.theme .icon { max-width: 420px; margin-inline: auto; background: var(--tile); border-radius: 10px; aspect-ratio: 5 / 3; object-fit: contain; width: 100%; margin-bottom: 18px; border: 1px solid var(--line); }
.theme h3 { font-size: 19px; margin-bottom: 10px; }
.theme p { color: var(--muted); font-size: 15px; }
.theme .refs { font-size: 14px; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.theme .refs div { margin-bottom: 6px; }
.theme .refs .lbl { font: 500 12px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--faint); display: block; margin-bottom: 6px; }
.chip { display: inline-block; font: 13px/1 var(--mono); border: 1px solid var(--line); border-radius: 999px; padding: 9px 12px; margin: 0 6px 8px 0; text-decoration: none; }

/* ---------- people ---------- */
.pi { display: grid; grid-template-columns: 140px 1fr; gap: 28px; align-items: center; margin-bottom: 36px; }
.pi img, .pi .avatar { width: 140px; height: 140px; }
.pi h3 { font-size: 22px; }
.pi .role { color: var(--accent); font: 500 13px var(--mono); margin: 4px 0 8px; }
.pi p { color: var(--muted); font-size: 15px; margin-bottom: 6px; max-width: 46em; }
@media (max-width: 600px) { .pi { grid-template-columns: 1fr; } }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 28px 24px; }
.person { display: grid; grid-template-columns: 72px 1fr; gap: 14px; align-items: start; }
.person h3 { font-size: 16px; }
.person .role { font: 12.5px/1.4 var(--mono); color: var(--accent); margin: 2px 0 4px; }
.person p { font-size: 14px; color: var(--muted); margin: 0; line-height: 1.45; }
.avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; background: var(--line); display: grid; place-items: center; font: 500 20px var(--mono); color: var(--muted); }
.alumni { margin-top: 48px; }
.alumni h3 { font: 500 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.alumni ul { list-style: none; padding: 0; margin: 0; columns: 3 240px; column-gap: 24px; font-size: 14.5px; }
.alumni li { break-inside: avoid; padding: 3px 0; }
.alumni .det { color: var(--faint); }

/* ---------- publications ---------- */
.pubs { list-style: none; margin: 0; padding: 0; }
.pub { padding: 16px 0; border-top: 1px solid var(--line); }
.pub:first-child { border-top: 0; }
.pub .t { font-weight: 500; font-size: 16.5px; line-height: 1.4; text-decoration: none; }
.pub .t:hover { text-decoration: underline; }
.pub .a { font-size: 14.5px; color: var(--muted); margin: 4px 0 2px; }
.pub .a b { color: var(--text); font-weight: 600; }
.pub .a .mk { font-size: 0.75em; margin-left: 1px; color: var(--muted); }
.pub .j { font-size: 14.5px; }
.pub .j i { font-style: italic; }
.pub .links { display: inline-flex; gap: 10px; margin-left: 8px; font: 12.5px var(--mono); }
.pub .links a { color: var(--muted); }
.pub .star { color: var(--accent); font-size: 12px; margin-left: 6px; }
.pub.collab .t { font-weight: 400; color: var(--muted); }
.year-group h2, .year-group h3 { font: 500 14px var(--mono); color: var(--faint); margin: 28px 0 4px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 24px 0 8px; }
.filters button {
  font: 13px/1 var(--mono); padding: 8px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.filters button[aria-pressed='true'] { background: var(--text); color: var(--bg); border-color: var(--text); }
.filters input {
  flex: 1 1 220px; font: 15px var(--sans); padding: 8px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.count { font: 13px var(--mono); color: var(--faint); }
@media (max-width: 720px) { .filters button { padding: 12px 14px; } }
.pub-section { padding: 0; border: 0; margin-top: 36px; }
.pub-section-title { font-size: 22px; margin-bottom: 4px; }
.pub-section-title .muted { font-weight: 400; font-size: 17px; }
.pub-section > p { margin: 6px 0 0; font-size: 15px; }

/* ---------- software ---------- */
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }
.tool h3 { font: 600 20px var(--mono); letter-spacing: -0.01em; }
.tool h3 a { text-decoration: none; }
.tool p { color: var(--muted); margin: 8px 0 14px; font-size: 15px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { font: 12.5px/1 var(--mono); padding: 6px 9px; border-radius: 6px; background: var(--line); text-decoration: none; color: var(--text); }
.badge:hover { background: var(--accent-ink); color: #fff; }
.badge.archived, .badge.archived:hover { background: transparent; border: 1px solid var(--muted, #888); color: var(--muted, #888); cursor: default; }
.archived-note { margin: 12px 0 0; color: var(--muted, #888); }

/* ---------- join / contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
.contact h3 { font-size: 18px; margin: 28px 0 8px; }
.contact-grid > div > h3:first-child { margin-top: 0; }
.contact address { font-style: normal; color: var(--muted); line-height: 1.7; }
.contact .directions { color: var(--muted); font-size: 15px; line-height: 1.6; }
.contact p { color: var(--muted); font-size: 15px; line-height: 1.6; }
@media (max-width: 760px) { .contact-grid { grid-template-columns: 1fr; } }

/* ---------- pages & prose ---------- */
.page { padding: 56px 0 80px; }
.page h1 { font-size: clamp(32px, 5vw, 44px); margin-bottom: 8px; }
.prose { max-width: 42em; font-size: 17px; }
.prose img { margin: 24px 0; border-radius: 10px; border: 1px solid var(--line); background: var(--tile); width: auto; max-width: min(100%, 560px); height: auto; }
.back { font-size: 15px; text-decoration: none; color: var(--muted); display: inline-block; margin-bottom: 28px; }
.figure { background: var(--tile); border-radius: var(--radius); border: 1px solid var(--line); padding: 16px; margin: 28px 0; max-width: 760px; }

/* ---------- footer ---------- */
footer { border-top: 1px solid var(--line); padding: 36px 0 48px; color: var(--muted); font-size: 14px; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 16px 32px; justify-content: space-between; align-items: center; }
footer nav { display: flex; gap: 16px; flex-wrap: wrap; }
footer a { text-decoration: none; }

/* ---------- accessibility ---------- */
.skip { position: absolute; left: 12px; top: -48px; z-index: 20; padding: 8px 14px; border-radius: 8px; background: var(--text); color: var(--bg); text-decoration: none; }
.skip:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
.pub .links a { padding: 4px 2px; }
.no-js .filters button { display: none; }

/* dark mode: line-art research icons on a dark tile */
@media (prefers-color-scheme: dark) {
  .theme .icon { background: #1f2024; filter: invert(.9) hue-rotate(180deg); }
  .btn.primary:hover, .badge:hover { color: #111; background: var(--accent); border-color: var(--accent); }
}

/* ---------- print ---------- */
@media print {
  :root { --bg: #fff; --surface: #fff; --text: #000; --muted: #333; --faint: #555; --line: #ccc; }
  .site-header, .filters, .buttons, footer nav, .skip, .back { display: none !important; }
  section { padding: 24px 0; }
  .card, .news-card { border-color: #ccc; }
  a { color: #000; }
}
