/* Layout: sticky nav → page content in a 1120px column → contact footer.
   Colors are tokens; the light set lives on :root, the dark set is applied by
   the OS preference or by data-theme="dark" (set by assets/js/theme.js). */
:root {
  --paper: #f3f6f7;
  --surface: #ffffff;
  --ink: #12202b;
  --ink-2: #4a5a66;
  --rule: #d5dee3;
  --accent: #2f62b0;
  --accent-soft: #e3ecf8;
  --award: #a86a12;
  --award-soft: #f7ecd9;
  --block: #c2412d;
  --allow: #2b7a52;
  --graph-node: #ffffff;

  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "Source Serif 4", Georgia, "Times New Roman", serif;
  --f-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --radius: 14px;
  --max: 1120px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0d1419; --surface: #141d24; --ink: #e6edf1; --ink-2: #9aabb7; --rule: #26343e;
    --accent: #86acec; --accent-soft: #1b2a3d; --award: #e0a94e; --award-soft: #2e2415; --block: #f07a63; --allow: #6cc59a; --graph-node: #18232c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0d1419; --surface: #141d24; --ink: #e6edf1; --ink-2: #9aabb7; --rule: #26343e;
  --accent: #86acec; --accent-soft: #1b2a3d; --award: #e0a94e; --award-soft: #2e2415; --block: #f07a63; --allow: #6cc59a; --graph-node: #18232c;
  color-scheme: dark;
}

@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1.0625rem/1.65 var(--f-body);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
[hidden] { display: none !important; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 650; letter-spacing: -0.015em; line-height: 1.15; text-wrap: balance; margin: 0; }
.wrap { max-width: var(--max); margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.mono { font-family: var(--f-mono); font-size: 0.78rem; letter-spacing: 0.02em; }
.muted { color: var(--ink-2); }
.eyebrow { font-family: var(--f-mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-2); margin: 0 0 12px; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 20; background: var(--ink); color: var(--paper); padding: 10px 14px; border-radius: 8px; }
.skip:focus { top: 12px; }

/* Nav */
.nav { position: sticky; top: 0; z-index: 9; background: color-mix(in srgb, var(--paper) 88%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule); view-transition-name: site-nav; }
.nav .wrap { display: flex; align-items: center; gap: 12px; padding-block: 12px; }
.brand { font: 700 1.05rem/1 var(--f-display); color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 10px; white-space: nowrap; margin-right: auto; }
.brand .mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--ink); color: var(--paper); font-size: 0.82rem; letter-spacing: 0.02em; }
.nav ul { list-style: none; display: flex; gap: 2px; margin: 0; padding: 0; }
.nav ul a { display: block; padding: 9px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font: 500 0.92rem/1 var(--f-display); }
.nav ul a:hover { color: var(--ink); background: var(--surface); }
.nav ul a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--rule); }
.icon-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; min-width: 38px; justify-content: center; padding: 0 11px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); border-radius: 10px; font: 500 0.85rem/1 var(--f-display); cursor: pointer; }
.icon-btn kbd { font: 500 0.7rem/1 var(--f-mono); color: var(--ink-2); border: 1px solid var(--rule); border-radius: 5px; padding: 3px 5px; }
.icon-btn svg { width: 16px; height: 16px; flex: none; }
#theme-toggle .sun { display: none; }
.is-dark #theme-toggle .sun { display: block; }
.is-dark #theme-toggle .moon { display: none; }
@media (max-width: 900px) {
  .nav .wrap { flex-wrap: wrap; row-gap: 6px; }
  .nav nav { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .nav ul a { padding: 8px 9px; }
  .search-btn .label, .search-btn kbd { display: none; }
}

/* Shared page header */
.page-head .wrap { padding-block: 56px 32px; }
.page-head h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); font-weight: 700; letter-spacing: -0.03em; }
.page-head .lede { font-size: 1.2rem; color: var(--ink-2); max-width: 58ch; margin: 16px 0 0; }
.page-head .mono { margin: 14px 0 0; }
.page-body { padding-block: 8px 72px; }

/* Hero */
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 48px; align-items: center; padding-block: 64px 56px; }
.hero h1 { font-size: clamp(2.3rem, 5.2vw, 4rem); font-weight: 700; letter-spacing: -0.03em; }
.hero h1 em { font-style: normal; color: var(--accent); }
.lede { font-size: 1.2rem; color: var(--ink-2); max-width: 38ch; margin: 20px 0 0; }
.roles { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 0; padding: 0; list-style: none; }
.roles li { font: 500 0.88rem/1.2 var(--f-display); padding: 8px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--rule); }
.roles li a { text-decoration: none; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; font: 600 0.95rem/1 var(--f-display); text-decoration: none; border: 1px solid var(--rule); color: var(--ink); background: var(--surface); cursor: pointer; }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn:hover { text-decoration: none; border-color: var(--ink-2); }
.graph-card { margin: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: 22px; overflow: hidden; aspect-ratio: 1 / 0.96; max-width: 100%; display: flex; flex-direction: column; }
.graph-card canvas { display: block; width: 100%; flex: 1; min-height: 0; }
.graph-card figcaption { padding: 10px 18px 14px; display: flex; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; color: var(--ink-2); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: -1px; margin-right: 6px; background: var(--accent); }
.legend i.b { background: var(--block); }
@media (max-width: 860px) { .hero .wrap { grid-template-columns: 1fr; gap: 32px; padding-block: 40px; } }

/* Homepage sections */
section.block { padding-block: 56px; border-top: 1px solid var(--rule); }
.head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.head h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.more { font: 500 0.92rem/1 var(--f-display); text-decoration: none; }
.more::after { content: " →"; }

.now { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 48px; }
.about p { margin: 0 0 14px; max-width: 60ch; }
.portrait { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.portrait img { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; border: 1px solid var(--rule); }
.portrait div { font: 500 0.95rem/1.35 var(--f-display); }
.portrait small { display: block; color: var(--ink-2); font: 400 0.8rem/1.4 var(--f-mono); margin-top: 4px; }
details.history { margin-top: 6px; border-top: 1px solid var(--rule); padding-top: 12px; }
details.history summary { cursor: pointer; font: 500 0.95rem/1.4 var(--f-display); min-height: 24px; }
details.history ul { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 4px; font-size: 0.95rem; }
details.history li span { color: var(--ink-2); }
@media (max-width: 860px) { .now { grid-template-columns: 1fr; } }

.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--rule); }
.timeline li { position: relative; padding: 0 0 22px 22px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 2px solid var(--accent); }
.timeline li.award::before { border-color: var(--award); background: var(--award); }
.timeline time { display: block; font: 500 0.75rem/1.4 var(--f-mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-2); }
.timeline p { margin: 2px 0 0; }
.timeline-year { font: 600 0.8rem/1 var(--f-mono); letter-spacing: 0.1em; color: var(--ink-2); margin: 28px 0 14px; }
.timeline-year:first-child { margin-top: 0; }

.bento { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.tile { grid-column: span 2; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tile.wide { grid-column: span 3; }
.tile h3 { font-size: 1.22rem; }
.tile p { margin: 0; color: var(--ink-2); font-size: 0.98rem; }
.tile .eyebrow { margin: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }
.tags span { font: 400 0.72rem/1 var(--f-mono); padding: 5px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--ink); }
.tile.past { background: transparent; border-style: dashed; }
@media (max-width: 960px) { .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tile, .tile.wide { grid-column: span 1; } .tile.past { grid-column: span 2; } }
@media (max-width: 600px) { .bento { grid-template-columns: 1fr; } .tile.past { grid-column: span 1; } }

.arc { margin-top: 34px; overflow-x: auto; }
.arc ol { list-style: none; margin: 0; padding: 0 0 6px; display: grid; grid-template-columns: repeat(5, minmax(170px, 1fr)); min-width: 860px; }
.arc li { position: relative; padding: 26px 18px 0 0; border-top: 2px solid var(--rule); }
.arc li::before { content: ""; position: absolute; top: -7px; left: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
.arc li:last-child { border-top-color: var(--accent); }
.arc b { display: block; font: 600 1.05rem/1.2 var(--f-display); margin: 4px 0; }
.arc span { font-size: 0.9rem; color: var(--ink-2); display: block; }

.systems { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.sys { display: flex; flex-direction: column; gap: 8px; padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--rule); text-decoration: none; color: var(--ink); transition: border-color .2s, transform .2s; }
.sys:hover { border-color: var(--accent); transform: translateY(-2px); }
.sys h3 { font-size: 1.35rem; display: flex; justify-content: space-between; align-items: baseline; }
.sys h3::after { content: "↗"; color: var(--accent); font-size: 1rem; }
.sys p { margin: 0; color: var(--ink-2); font-size: 0.98rem; }
.sys .stat { font: 500 0.8rem/1.4 var(--f-mono); color: var(--ink); margin-top: auto; padding-top: 10px; border-top: 1px solid var(--rule); }
@media (max-width: 860px) { .systems { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .sys { transition: none; } .sys:hover { transform: none; } }

/* Publications */
.pub-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.chip { font: 500 0.85rem/1 var(--f-display); min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pub-tools input { flex: 1 1 220px; min-height: 38px; border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); color: var(--ink); padding: 0 12px; font: 400 0.95rem var(--f-body); }
.pub-count { margin: 0 0 8px; }
.pubs { list-style: none; margin: 0; padding: 0; }
.year { font: 600 0.8rem/1 var(--f-mono); color: var(--ink-2); letter-spacing: 0.1em; padding: 26px 0 8px; border-bottom: 1px solid var(--rule); }
.pub { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.venue { font: 500 0.78rem/1.2 var(--f-mono); align-self: start; text-align: center; padding: 7px 6px; border-radius: 8px; background: var(--accent-soft); color: var(--ink); }
.venue.pre { background: transparent; border: 1px dashed var(--rule); color: var(--ink-2); }
.pub h3 { font: 600 1.05rem/1.35 var(--f-display); letter-spacing: -0.005em; }
.pub h3 a { color: var(--ink); text-decoration: none; }
.pub h3 a:hover { color: var(--accent); text-decoration: underline; }
.pub .authors { margin: 4px 0 0; font-size: 0.95rem; color: var(--ink-2); }
.pub .authors b { color: var(--ink); font-weight: 600; }
.pub .meta { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin-top: 6px; font-size: 0.9rem; color: var(--ink-2); }
.pub .meta span:first-child { font-style: italic; }
.pub .actions { display: flex; gap: 14px; margin-top: 6px; font: 400 0.78rem/1.3 var(--f-mono); }
.pub .actions a, .pub .actions button { font: inherit; color: var(--accent); background: none; border: 0; padding: 4px 0; cursor: pointer; text-decoration: none; min-height: 24px; }
.pub .actions a:hover, .pub .actions button:hover { text-decoration: underline; }
.badge { color: var(--award); background: var(--award-soft); padding: 2px 8px; border-radius: 6px; font: 500 0.78rem/1.4 var(--f-mono); }
.empty { padding: 24px 0; color: var(--ink-2); }
.pubs-compact .pub .meta span:first-child { display: none; }
@media (max-width: 560px) { .pub { grid-template-columns: 1fr; gap: 8px; } .venue { justify-self: start; } }

/* Students band */
.band { background: var(--ink); color: var(--paper); border-radius: 22px; padding: 36px; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 28px; align-items: center; }
.band h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); }
.band p { margin: 10px 0 0; opacity: .85; max-width: 52ch; }
.band .eyebrow { color: inherit; opacity: .7; }
.band ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.band li a { display: flex; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 10px; background: color-mix(in srgb, var(--paper) 10%, transparent); color: var(--paper); text-decoration: none; font: 500 0.95rem/1.3 var(--f-display); }
.band li a:hover { background: color-mix(in srgb, var(--paper) 18%, transparent); }
@media (max-width: 760px) { .band { grid-template-columns: 1fr; padding: 26px; } }

/* Long-form pages (research statement, students) */
.prose { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 56px; align-items: start; }
.prose article { max-width: 70ch; min-width: 0; }
.prose article > p, .prose article li { hyphens: auto; }
.prose h2 { font-size: 1.55rem; margin: 48px 0 14px; scroll-margin-top: 84px; }
.prose h3 { font-size: 1.15rem; margin: 30px 0 8px; }
.prose p { margin: 0 0 16px; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: 8px; }
.prose .callout { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 22px 24px; margin: 0 0 8px; font-size: 1.08rem; }
.prose .callout p:last-child { margin: 0; }
.prose sup a, .cite { text-decoration: none; font-family: var(--f-mono); font-size: 0.78em; }
.toc { position: sticky; top: 90px; font-size: 0.92rem; border-left: 2px solid var(--rule); padding-left: 16px; }
.toc p { margin: 0 0 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.toc a { color: var(--ink-2); text-decoration: none; display: block; line-height: 1.35; }
.toc a:hover, .toc a.active { color: var(--accent); }
.refs { font-size: 0.95rem; padding-left: 1.6em; }
.refs li { margin-bottom: 12px; scroll-margin-top: 90px; }
.refs li:target { background: var(--accent-soft); border-radius: 8px; outline: 6px solid var(--accent-soft); }
.refs .ref-venue { color: var(--ink-2); display: block; }
@media (max-width: 960px) { .prose { grid-template-columns: 1fr; gap: 0; } .toc { display: none; } }

.reading { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 8px; }
.reading section { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 22px; min-width: 0; }
.reading h2 { font-size: 1.25rem; margin: 0; }
.reading .quip { color: var(--ink-2); font-style: italic; margin: 4px 0 12px; }
.reading ul { margin: 0; padding-left: 1.1em; }
.reading li { margin-bottom: 8px; }
@media (max-width: 760px) { .reading { grid-template-columns: 1fr; } }

/* Footer */
.site-footer { border-top: 1px solid var(--rule); padding-block: 48px 56px; padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px)); }
.foot { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.foot h2 { font: 500 0.75rem/1.4 var(--f-mono); text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-2); margin-bottom: 10px; }
.foot p { margin: 0 0 8px; font-size: 0.95rem; }
.foot .links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.95rem; }
.copy-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.copy-row .email { font: 500 0.9rem var(--f-mono); }
.copy-row .email-kind { font: 500 0.7rem/1 var(--f-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2); min-width: 4.6em; }
.small-btn { font: 500 0.75rem/1 var(--f-mono); padding: 6px 9px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); border-radius: 7px; cursor: pointer; min-height: 28px; }
.colophon { margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--rule); color: var(--ink-2); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
@media (max-width: 760px) { .foot { grid-template-columns: 1fr; } }

/* Search palette */
dialog.palette { width: min(620px, calc(100vw - 32px)); max-height: min(70vh, 560px); padding: 0; border: 1px solid var(--rule); border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgb(0 0 0 / .35); margin-top: 12vh; }
dialog.palette::backdrop { background: rgb(10 18 24 / .45); }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--rule); background: transparent; color: var(--ink); padding: 18px 20px; font: 400 1.05rem var(--f-body); outline: none; }
.palette ul { list-style: none; margin: 0; padding: 8px; overflow-y: auto; max-height: calc(min(70vh, 560px) - 100px); }
.palette li button { width: 100%; text-align: left; display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px; padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); font: 400 0.95rem/1.35 var(--f-body); cursor: pointer; }
.palette li button[aria-selected="true"], .palette li button:hover { background: var(--accent-soft); }
.palette li .k { font: 500 0.7rem/1.7 var(--f-mono); color: var(--ink-2); text-transform: uppercase; letter-spacing: .08em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette .empty { padding: 14px 12px; }
.palette .hint { padding: 10px 20px; border-top: 1px solid var(--rule); color: var(--ink-2); }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 30; background: var(--ink); color: var(--paper); font: 500 0.85rem var(--f-mono); padding: 10px 16px; border-radius: 10px; }

/* 404 */
.notfound { padding-block: 96px; }
.notfound h1 { font-size: clamp(2.4rem, 6vw, 4rem); }

@media print {
  .nav, .site-footer, .pub-tools, .toc, .actions, dialog { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .prose { display: block; }
  a { color: inherit; }
}
.section-lede { max-width: 68ch; margin: -12px 0 28px; }
.page-body > .band { margin-top: 40px; }
