/* ==========================================================================
   Saurav Bhattarai, personal site
   One stylesheet for every page. Colors are tokens on :root; dark mode
   redefines them. Chapter colors match the dissertation figures.
   ========================================================================== */

:root {
  --paper: #f4f1e9;
  --paper-2: #ebe6d9;
  --card: #fbf9f4;
  --plate: #ffffff;
  --ink: #1b2430;
  --ink-2: #3b4654;
  --ink-3: #66707c;
  --rule: #d6cfbf;
  --rule-2: #e5dfd2;

  --c-access: #4c3f91;
  --c-refine: #0e7c7b;
  --c-translate: #1d5fa8;
  --c-apply: #d9622b;
  --c-extend: #8c5a2b;
  --c-urban: #b0306a;
  --c-compound: #9a3b2e;

  --accent: #d9622b;
  --link: #1d5fa8;
  --ok: #2e7d4f;
  --warn: #a8691a;
  --slate: #5d6b7c;

  --basin-lo: #a8c8d8;
  --basin-mid: #d9e0cf;
  --basin-hi: #f6f1e6;
  --basin-shadow: #6f8796;
  --channel: #1d5fa8;
  --water: #1f8fd6;
  --rain: #5b8db8;
  --band: #1b2430;
  --band-ink: #f4f1e9;

  --shadow: 0 1px 0 rgb(27 36 48 / 0.04), 0 18px 40px -26px rgb(27 36 48 / 0.35);
  --grain-opacity: 0.5;

  --f-display: "Newsreader", "Iowan Old Style", Georgia, serif;
  --f-sans: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --maxw: 1200px;
  --gutter: clamp(16px, 4vw, 44px);
  --radius: 10px;
  --header-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0d141c;
    --paper-2: #131d28;
    --card: #15212d;
    --plate: #f6f4ee;
    --ink: #ebe7de;
    --ink-2: #c3c9cf;
    --ink-3: #8d98a3;
    --rule: #2a3745;
    --rule-2: #1e2934;
    --c-access: #a597ea;
    --c-refine: #3fc4bf;
    --c-translate: #74b0f4;
    --c-apply: #f39361;
    --c-extend: #d8a673;
    --c-urban: #ef84b4;
    --c-compound: #f0937f;
    --accent: #f39361;
    --link: #8cc0f7;
    --ok: #63c08a;
    --warn: #e3b154;
    --slate: #9aa7b6;
    --basin-lo: #12395a;
    --basin-mid: #1c2f3c;
    --basin-hi: #2a3743;
    --basin-shadow: #070b10;
    --channel: #74b0f4;
    --water: #9ad6ff;
    --rain: #7fa9cf;
    --band: #15212d;
    --band-ink: #ebe7de;
    --shadow: 0 1px 0 rgb(0 0 0 / 0.2), 0 18px 40px -24px rgb(0 0 0 / 0.7);
    --grain-opacity: 0.18;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0d141c;
  --paper-2: #131d28;
  --card: #15212d;
  --plate: #f6f4ee;
  --ink: #ebe7de;
  --ink-2: #c3c9cf;
  --ink-3: #8d98a3;
  --rule: #2a3745;
  --rule-2: #1e2934;
  --c-access: #a597ea;
  --c-refine: #3fc4bf;
  --c-translate: #74b0f4;
  --c-apply: #f39361;
  --c-extend: #d8a673;
  --c-urban: #ef84b4;
  --c-compound: #f0937f;
  --accent: #f39361;
  --link: #8cc0f7;
  --ok: #63c08a;
  --warn: #e3b154;
  --slate: #9aa7b6;
  --basin-lo: #12395a;
  --basin-mid: #1c2f3c;
  --basin-hi: #2a3743;
  --basin-shadow: #070b10;
  --channel: #74b0f4;
  --water: #9ad6ff;
  --rain: #7fa9cf;
  --band: #15212d;
  --band-ink: #ebe7de;
  --shadow: 0 1px 0 rgb(0 0 0 / 0.2), 0 18px 40px -24px rgb(0 0 0 / 0.7);
  --grain-opacity: 0.18;
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: 17px;
  line-height: 1.6;
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
}
/* paper grain, behind everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.42 0 0 0 0 0.36 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img, svg, video, canvas { max-width: 100%; }
img { height: auto; }

a {
  color: var(--link);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  transition: color 0.15s, text-decoration-color 0.15s;
}
a:hover { text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

h1, h2, h3, h4 {
  font-family: var(--f-display);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.012em;
  margin: 0;
  text-wrap: balance;
}
p { margin: 0 0 1em; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; }
b, strong { font-weight: 600; }
sup, sub { line-height: 0; }

.wrap {
  width: 100%;
  max-width: calc(var(--maxw) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
/* grid children may shrink below their content width (code blocks, tables, lists scroll instead) */
.two-col > *, .doc > *, .idea-grid > *, .about-grid > *, .tool > *, .hero-grid > *, .fig-row > * { min-width: 0; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip-link {
  position: absolute;
  left: 12px; top: -60px;
  z-index: 100;
  background: var(--ink); color: var(--paper);
  padding: 10px 14px; border-radius: 6px;
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; }

.mono {
  font-family: var(--f-mono);
  font-size: 0.78em;
  letter-spacing: 0.02em;
}
.kicker {
  font-family: var(--f-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.num {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  font-size: 0.92em;
  color: var(--ink);
  white-space: nowrap;
}
.muted { color: var(--ink-3); }
.nowrap { white-space: nowrap; }

.icon {
  width: 1em; height: 1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.125em;
}
.icon--fill { fill: currentColor; stroke: none; }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--header-h);
  background: color-mix(in srgb, var(--paper) 84%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s;
}
.site-header.is-scrolled { border-bottom-color: var(--rule); }
.site-header .wrap {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--f-display);
  font-size: 21px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  margin-right: auto;
}
.brand svg { width: 26px; height: 26px; flex: none; }
.brand small {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  border-left: 1px solid var(--rule);
  padding-left: 10px;
}
.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  position: relative;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  padding: 8px 11px;
  border-radius: 6px;
}
.nav a:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 11px; right: 11px; bottom: 2px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}
.nav .nav-cv {
  margin-left: 6px;
  border: 1px solid var(--ink);
  color: var(--ink);
  display: inline-flex; align-items: center; gap: 6px;
}
.nav .nav-cv:hover { background: var(--ink); color: var(--paper); }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 8px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  font-size: 17px;
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
}
.menu-toggle { display: none; }

@media (max-width: 960px) {
  .brand small { display: none; }
  .menu-toggle { display: inline-grid; }
  .nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px var(--gutter) 20px;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    box-shadow: var(--shadow);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  }
  .nav.is-open { opacity: 1; transform: none; visibility: visible; }
  .nav a { font-size: 18px; padding: 13px 4px; border-bottom: 1px solid var(--rule-2); border-radius: 0; }
  .nav a[aria-current="page"]::after { left: 4px; right: auto; width: 24px; bottom: 6px; }
  .nav .nav-cv { margin: 14px 0 0; justify-content: center; border-radius: 8px; }
}

/* ---------- buttons, chips, links ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--f-sans);
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1;
  padding: 14px 20px;
  border-radius: 8px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, color 0.15s, border-color 0.15s;
}
.btn:hover { transform: translateY(-1px); background: color-mix(in srgb, var(--ink) 88%, var(--accent)); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn--ghost:hover { background: var(--card); border-color: var(--ink-3); }
.btn .icon { font-size: 17px; }

.arrow-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 2px;
}
.arrow-link .icon { transition: transform 0.18s; }
.arrow-link:hover { color: var(--accent); border-color: var(--accent); }
.arrow-link:hover .icon { transform: translate(2px, -2px); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding: 6px 9px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: color-mix(in srgb, var(--card) 70%, transparent);
  white-space: nowrap;
}
.chip::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--dot, var(--ink-3));
}
@media (max-width: 600px) {
  .chip { white-space: normal; line-height: 1.3; max-width: 100%; }
}
.chip--done { --dot: var(--ok); }
.chip--pub { --dot: var(--c-translate); }
.chip--prog { --dot: var(--warn); }
.chip--prop { --dot: var(--slate); }
.chip--plain::before { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.link-row { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.link-row a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
}
.link-row a:hover { color: var(--accent); }
.link-row .icon { font-size: 16px; }

/* ---------- sections ---------- */
.section { padding-block: clamp(64px, 9vw, 120px); }
.section--tight { padding-block: clamp(40px, 6vw, 72px); }
.section-head {
  display: grid;
  grid-template-columns: minmax(150px, 220px) 1fr;
  gap: 18px 40px;
  border-top: 1px solid var(--ink);
  padding-top: 18px;
  margin-bottom: clamp(32px, 5vw, 56px);
}
.section-head .kicker { padding-top: 10px; }
.section-head h2 {
  font-size: clamp(2rem, 4.2vw, 3.3rem);
  font-weight: 340;
  line-height: 1.04;
  max-width: 20ch;
}
.section-head h2 em { font-style: italic; color: var(--accent); }
.section-head .lede {
  grid-column: 2;
  max-width: 62ch;
  color: var(--ink-2);
  font-size: 18px;
  margin: 0;
}
@media (max-width: 720px) {
  .section-head { grid-template-columns: 1fr; gap: 10px; }
  .section-head .kicker { padding-top: 0; }
  .section-head .lede { grid-column: 1; }
}

.prose {
  font-family: var(--f-display);
  font-size: 1.24rem;
  line-height: 1.58;
  font-variation-settings: "opsz" 16;
  color: var(--ink);
  max-width: 66ch;
}
.prose p { margin-bottom: 0.9em; }
.prose em { font-style: italic; }
.prose .num { font-size: 0.84em; }

/* ---------- page head (inner pages) ---------- */
.page-head {
  padding-block: clamp(48px, 8vw, 96px) clamp(28px, 4vw, 48px);
}
.page-head h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  font-weight: 320;
  line-height: 1;
  letter-spacing: -0.022em;
  margin-top: 14px;
  max-width: 18ch;
}
.page-head h1 em { font-style: italic; color: var(--accent); }
.page-head--title h1 {
  font-size: clamp(2.05rem, 4.6vw, 3.6rem);
  font-weight: 340;
  line-height: 1.08;
  letter-spacing: -0.02em;
  max-width: 24ch;
}
.page-head .lede {
  margin-top: 22px;
  max-width: 62ch;
  font-size: clamp(17px, 1.6vw, 19.5px);
  color: var(--ink-2);
}

/* ---------- hero (home) ---------- */
.hero { padding-block: clamp(36px, 6vw, 80px) clamp(48px, 7vw, 96px); }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}
.hero-id {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: clamp(20px, 3vw, 32px);
}
.hero-id img {
  width: 68px; height: 68px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--rule);
  box-shadow: 0 0 0 4px var(--paper), 0 0 0 5px var(--rule);
}
.hero-id .kicker { line-height: 1.7; }
.hero h1 {
  font-size: clamp(3.3rem, 8.4vw, 7rem);
  font-weight: 300;
  line-height: 0.92;
  letter-spacing: -0.035em;
  font-variation-settings: "opsz" 72;
}
.hero .statement {
  font-family: var(--f-display);
  font-size: clamp(1.55rem, 2.8vw, 2.3rem);
  font-weight: 360;
  line-height: 1.16;
  letter-spacing: -0.01em;
  margin: clamp(18px, 2.4vw, 26px) 0 0;
  color: var(--ink-2);
  font-variation-settings: "opsz" 48;
}
.hero .statement em { font-style: italic; }
.hero .statement .w1 { color: var(--c-refine); }
.hero .statement .w2 { color: var(--c-translate); }
.hero .intro {
  margin: clamp(18px, 2.4vw, 24px) 0 0;
  max-width: 54ch;
  font-size: 18px;
  color: var(--ink-2);
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  padding: 8px 14px 8px 12px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: color-mix(in srgb, var(--card) 80%, transparent);
  font-size: 14.5px;
  color: var(--ink-2);
}
.status .pulse {
  position: relative;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--ok);
  flex: none;
}
.status .pulse::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid var(--ok);
  opacity: 0;
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(0.5); opacity: 0.7; }
  100% { transform: scale(1.6); opacity: 0; }
}
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero .link-row { margin-top: 24px; }

/* the live basin figure */
.basin-fig {
  margin: 0;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.basin-fig header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--rule-2);
}
.basin-fig header .kicker { font-size: 11px; }
.basin-fig .live {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent);
}
.basin-fig .live i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  animation: blink 1.6s steps(2, start) infinite;
}
.basin-fig.is-paused .live i { animation: none; opacity: 0.35; }
@keyframes blink { to { visibility: hidden; } }
.basin-ctl {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 1px solid var(--rule); border-radius: 6px;
  color: var(--ink-2); font: 500 11px/1 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase;
  padding: 6px 8px; cursor: pointer;
}
.basin-ctl:hover { color: var(--ink); border-color: var(--ink-3); }
.basin-ctl .icon { font-size: 12px; }
.basin-ctl .icon-play { display: none; }
.basin-fig.is-paused .basin-ctl .icon-play { display: block; }
.basin-fig.is-paused .basin-ctl .icon-pause { display: none; }
.basin-canvas-wrap { position: relative; }
#basin {
  display: block;
  width: 100%;
  aspect-ratio: 5 / 5.4;
  cursor: crosshair;
  touch-action: manipulation;
}
.basin-fig figcaption {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--rule-2);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-3);
}
.basin-fig figcaption b { color: var(--ink-2); font-weight: 600; }
.basin-legend {
  display: flex; flex-wrap: wrap; gap: 4px 14px;
  margin-top: 8px;
  font-family: var(--f-mono); font-size: 11px; color: var(--ink-3);
}
.basin-legend span { display: inline-flex; align-items: center; gap: 6px; }
.basin-legend .sw { width: 14px; height: 3px; border-radius: 2px; background: var(--channel); }
.basin-legend .sw--dot { width: 6px; height: 6px; border-radius: 50%; background: var(--water); }
.basin-legend .sw--rain { width: 6px; height: 10px; border-radius: 1px; background: var(--rain); }
.basin-legend .sw--q { height: 2px; background: var(--accent); }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .basin-fig { max-width: 560px; }
}

/* ---------- numbers strip ---------- */
.numbers {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.numbers > div {
  padding: 26px 22px 24px;
  border-left: 1px solid var(--rule);
}
.numbers > div:first-child { border-left: 0; padding-left: 0; }
.numbers b {
  display: block;
  font-family: var(--f-display);
  font-weight: 300;
  font-size: clamp(2.4rem, 4.4vw, 3.5rem);
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: lining-nums tabular-nums;
}
.numbers span { display: block; margin-top: 10px; font-size: 14.5px; line-height: 1.45; color: var(--ink-2); }
@media (max-width: 860px) {
  .numbers { grid-template-columns: 1fr 1fr; }
  .numbers > div:nth-child(3) { border-left: 0; padding-left: 0; }
  .numbers > div:nth-child(n + 3) { border-top: 1px solid var(--rule); }
}

/* ---------- the idea ---------- */
.idea-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
}
.callout {
  position: relative;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 26px 24px 22px;
}
.callout .kicker { display: block; margin-bottom: 14px; }
.callout .vs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.callout .vs div {
  border-top: 3px solid var(--c);
  padding-top: 10px;
}
.callout .vs b {
  display: block;
  font-family: var(--f-display);
  font-weight: 300;
  font-size: 3rem;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--c);
}
.callout .vs span { display: block; margin-top: 6px; font-size: 14px; color: var(--ink-2); line-height: 1.4; }
.callout p { font-size: 15.5px; color: var(--ink-2); margin: 0; }
.callout p + p { margin-top: 10px; }
@media (max-width: 860px) {
  .idea-grid { grid-template-columns: 1fr; }
}

/* ---------- five steps ---------- */
.steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-top: clamp(40px, 6vw, 64px);
  counter-reset: step;
}
.step {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--rule);
  border-top: 4px solid var(--c);
  border-radius: 4px 4px var(--radius) var(--radius);
  padding: 18px 16px 16px;
}
.step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 34px; right: -12px;
  width: 10px; height: 10px;
  border-top: 2px solid var(--ink-3);
  border-right: 2px solid var(--ink-3);
  transform: rotate(45deg);
  z-index: 2;
}
.step .n { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.12em; color: var(--ink-3); text-transform: uppercase; }
.step h3 {
  font-size: 1.9rem;
  font-weight: 400;
  color: var(--c);
  margin: 6px 0 10px;
  letter-spacing: -0.02em;
}
.step p { font-size: 14.5px; line-height: 1.5; color: var(--ink-2); margin: 0 0 14px; }
.step .chips { margin-top: auto; }
.step--core { box-shadow: 0 0 0 1px var(--c), var(--shadow); }
.step--core .core-tag {
  position: absolute; top: 14px; right: 12px;
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--paper); background: var(--c); padding: 3px 6px; border-radius: 3px;
}
.c-access { --c: var(--c-access); }
.c-refine { --c: var(--c-refine); }
.c-translate { --c: var(--c-translate); }
.c-apply { --c: var(--c-apply); }
.c-extend { --c: var(--c-extend); }
@media (max-width: 1080px) {
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .step:not(:last-child)::after { display: none; }
  .step--core { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .steps { grid-template-columns: 1fr; }
}
.after-steps { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; }

/* ---------- tools ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.tools-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.tools-grid .step::after { display: none; }
@media (max-width: 900px) { .tools-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .tools-grid { grid-template-columns: 1fr; } }
.tool {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
  padding-block: clamp(28px, 4vw, 44px);
}
.tool + .tool { border-top: 1px solid var(--rule); }
.tool--flip { grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr); }
.tool--wide-media { grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr); }
.tool--flip .tool-media { order: -1; }
.tool h3 {
  font-size: clamp(2.2rem, 4vw, 3.1rem);
  font-weight: 340;
  letter-spacing: -0.025em;
  margin: 10px 0 6px;
}
.tool .tagline {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 1.28rem;
  line-height: 1.35;
  color: var(--ink-2);
  margin: 0 0 18px;
}
.tool p { color: var(--ink-2); }
.ticks { list-style: none; margin: 0 0 22px; display: grid; gap: 9px; }
.ticks li {
  position: relative;
  padding-left: 22px;
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--ink-2);
}
.ticks li::before {
  content: "";
  position: absolute;
  left: 2px; top: 0.62em;
  width: 9px; height: 9px;
  border-radius: 2px;
  background: var(--c, var(--accent));
  transform: rotate(45deg) scale(0.8);
}
.code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--band);
  color: var(--band-ink);
  border-radius: 8px;
  padding: 12px 12px 12px 16px;
  font-family: var(--f-mono);
  font-size: 14.5px;
  margin: 0 0 20px;
  max-width: 420px;
}
.code code::before { content: "$ "; color: color-mix(in srgb, var(--band-ink) 45%, transparent); }
.copy-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: color-mix(in srgb, var(--band-ink) 10%, transparent);
  color: var(--band-ink);
  border: 0; border-radius: 6px;
  font: 500 11px/1 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase;
  padding: 7px 9px; cursor: pointer;
}
.copy-btn:hover { background: color-mix(in srgb, var(--band-ink) 18%, transparent); }
pre.codeblock {
  background: var(--band);
  color: var(--band-ink);
  border-radius: 10px;
  padding: 18px 20px;
  font-family: var(--f-mono);
  font-size: 13.5px;
  line-height: 1.6;
  overflow-x: auto;
  margin: 0 0 20px;
}
pre.codeblock .c { color: color-mix(in srgb, var(--band-ink) 50%, transparent); }
pre.codeblock .k { color: #f39361; }
pre.codeblock .s { color: #8fd3c9; }
@media (max-width: 900px) {
  .tool, .tool--flip, .tool--wide-media { grid-template-columns: 1fr; }
  .tool--flip .tool-media { order: 0; }
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: clamp(28px, 4vw, 44px);
}
.mini {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 18px 16px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}
.mini:hover { border-color: var(--ink-3); transform: translateY(-2px); }
.mini .kicker { font-size: 10.5px; }
.mini h4 { font-size: 1.35rem; font-weight: 420; letter-spacing: -0.01em; }
.mini p { font-size: 14.5px; line-height: 1.5; color: var(--ink-2); margin: 0; }
.mini .go { margin-top: auto; padding-top: 6px; font-size: 13.5px; font-weight: 600; color: var(--link); display: inline-flex; align-items: center; gap: 6px; }

/* ---------- figures ---------- */
.fig { margin: 0; }
.plate {
  display: block;
  position: relative;
  background: var(--plate);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: clamp(8px, 1.4vw, 16px);
  box-shadow: var(--shadow);
}
.plate img, .plate video { display: block; width: 100%; height: auto; border-radius: 3px; }
button.plate { width: 100%; cursor: zoom-in; font: inherit; color: inherit; text-align: left; }
button.plate::after {
  content: "";
  position: absolute;
  right: 10px; bottom: 10px;
  width: 30px; height: 30px;
  border-radius: 7px;
  background: rgb(27 36 48 / 0.72) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7'/%3E%3C/svg%3E") center / 15px no-repeat;
  opacity: 0;
  transition: opacity 0.15s;
}
button.plate:hover::after, button.plate:focus-visible::after { opacity: 1; }
.fig figcaption {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-3);
  max-width: 76ch;
}
.fig figcaption b {
  font-family: var(--f-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-right: 6px;
}
.fig-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 720px) { .fig-row { grid-template-columns: 1fr; } }

/* lightbox */
dialog.lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(96vw, 1800px);
  max-height: 94vh;
  overflow: visible;
}
dialog.lightbox::backdrop { background: rgb(8 12 18 / 0.86); }
dialog.lightbox img {
  display: block;
  max-width: min(96vw, 1800px);
  max-height: 86vh;
  width: auto; height: auto;
  background: #fff;
  border-radius: 8px;
  padding: 12px;
}
dialog.lightbox p { color: #e9e5dc; font-size: 14px; margin: 10px 4px 0; max-width: 90ch; }
dialog.lightbox .icon-btn {
  position: absolute; top: -48px; right: 0;
  color: #fff; border-color: rgb(255 255 255 / 0.3);
}

/* ---------- publications ---------- */
.pubs { list-style: none; }
.pub {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 4px 22px;
  padding: 20px 0;
  border-top: 1px solid var(--rule);
}
.pub:last-child { border-bottom: 1px solid var(--rule); }
.pub .tag {
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--ink-3);
  padding-top: 5px;
  line-height: 1.5;
}
.pub .tag b { display: block; color: var(--ink); font-weight: 500; font-size: 14px; }
.pub h3 {
  font-family: var(--f-display);
  font-size: 1.28rem;
  font-weight: 430;
  line-height: 1.3;
  letter-spacing: -0.005em;
  font-variation-settings: "opsz" 24;
}
.pub h3 a { color: var(--ink); text-decoration: none; }
.pub h3 a:hover { color: var(--link); text-decoration: underline; text-decoration-color: currentColor; }
.pub .authors { font-size: 14.5px; color: var(--ink-2); margin: 6px 0 2px; }
.pub .authors b { color: var(--ink); font-weight: 650; }
.pub .venue { font-size: 14.5px; color: var(--ink-2); }
.pub .venue i { font-style: italic; }
.pub .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 10px; }
.pub .meta a, .pub .meta button {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.02em;
  color: var(--ink-2); text-decoration: none;
  background: none; border: 0; padding: 0; cursor: pointer;
}
.pub .meta a:hover, .pub .meta button:hover { color: var(--accent); }
.pub .first {
  font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 4px; padding: 3px 6px;
}
.pub-summary { font-size: 15px; color: var(--ink-2); margin: 8px 0 0; max-width: 78ch; }
@media (max-width: 600px) {
  .pub { grid-template-columns: 1fr; }
  .pub .tag { display: flex; gap: 10px; padding-top: 0; }
  .pub .tag b { display: inline; }
}

.filters {
  position: sticky;
  top: var(--header-h);
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 14px 0;
  margin-bottom: 8px;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fchip {
  font-family: var(--f-sans);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}
.fchip:hover { border-color: var(--ink-3); color: var(--ink); }
.fchip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.search {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--card);
  color: var(--ink-3);
}
.search input {
  border: 0; outline: 0; background: transparent;
  font: 15px var(--f-sans); color: var(--ink);
  padding: 9px 0; width: 200px;
}
.search:focus-within { border-color: var(--ink-3); }
.result-count { font-family: var(--f-mono); font-size: 12px; color: var(--ink-3); }
@media (max-width: 720px) {
  .search { margin-left: 0; width: 100%; }
  .search input { width: 100%; }
}
.year-group h2 {
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  margin: 40px 0 0;
  padding-bottom: 10px;
}
.year-group[hidden] { display: none; }
.empty-note { padding: 28px 0; color: var(--ink-3); }

/* ---------- lists: news, timeline, awards ---------- */
.news { list-style: none; }
.news li {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 18px;
  padding: 15px 0;
  border-top: 1px solid var(--rule);
  font-size: 16px;
  color: var(--ink-2);
}
.news li:last-child { border-bottom: 1px solid var(--rule); }
.news time { font-family: var(--f-mono); font-size: 12.5px; color: var(--ink-3); padding-top: 3px; }
.news b { color: var(--ink); font-weight: 600; }
@media (max-width: 560px) {
  .news li { grid-template-columns: 1fr; gap: 2px; }
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 64px);
}
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

.timeline { list-style: none; position: relative; }
.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 16px;
  padding: 0 0 22px;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: 112px; top: 8px; bottom: -8px;
  width: 1px;
  background: var(--rule);
  transform: translateX(-8px);
}
.timeline li:last-child::before { display: none; }
.timeline li::after {
  content: "";
  position: absolute;
  left: 112px; top: 6px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--c, var(--ink-3));
  transform: translateX(-12px);
}
.timeline .when { font-family: var(--f-mono); font-size: 12.5px; color: var(--ink-3); padding-top: 2px; }
.timeline .what { padding-left: 8px; }
.timeline h4 { font-family: var(--f-sans); font-size: 16px; font-weight: 600; letter-spacing: 0; line-height: 1.35; }
.timeline p { font-size: 14.5px; color: var(--ink-2); margin: 3px 0 0; line-height: 1.5; }

.list-plain { list-style: none; }
.list-plain li {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--rule-2);
  font-size: 15.5px;
  color: var(--ink-2);
  line-height: 1.5;
}
.list-plain li > span:first-child { font-family: var(--f-mono); font-size: 12.5px; color: var(--ink-3); padding-top: 2px; }
.list-plain b { color: var(--ink); font-weight: 600; }
.list-head {
  font-family: var(--f-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 6px;
}
.list-head + .list-plain li:first-child { border-top-color: var(--ink); }

/* ---------- about ---------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(200px, 300px) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: start;
}
.portrait { margin: 0; position: sticky; top: calc(var(--header-h) + 24px); }
.portrait img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--rule);
  background: #fff;
}
.portrait figcaption { margin-top: 12px; font-size: 13.5px; color: var(--ink-3); line-height: 1.5; }
@media (max-width: 760px) {
  .about-grid { grid-template-columns: 1fr; }
  .portrait { position: static; max-width: 240px; }
}

/* ---------- contact band + footer ---------- */
.band {
  background: var(--band);
  color: var(--band-ink);
  padding-block: clamp(64px, 9vw, 112px);
  position: relative;
  overflow: hidden;
}
.band .kicker { color: color-mix(in srgb, var(--band-ink) 60%, transparent); }
.band h2 {
  font-size: clamp(2.4rem, 5.6vw, 4.6rem);
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 14px 0 20px;
  max-width: 16ch;
}
.band h2 em { font-style: italic; color: #f39361; }
.band p { max-width: 58ch; color: color-mix(in srgb, var(--band-ink) 80%, transparent); font-size: 18px; }
.band .mail {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--f-display);
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  color: var(--band-ink);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--band-ink) 40%, transparent);
  padding-bottom: 4px;
  margin: 8px 0 28px;
  overflow-wrap: anywhere;
}
.band .mail:hover { border-color: #f39361; color: #f39361; }
.band .link-row a { color: color-mix(in srgb, var(--band-ink) 80%, transparent); }
.band .link-row a:hover { color: #f39361; }
.band-contours {
  position: absolute;
  right: -6%; top: -10%;
  width: 62%;
  height: 120%;
  opacity: 0.13;
  pointer-events: none;
}
.band-contours path { fill: none; stroke: var(--band-ink); stroke-width: 1; }
.band .wrap { position: relative; }

.site-footer {
  padding: 28px 0 40px;
  font-size: 13.5px;
  color: var(--ink-3);
  border-top: 1px solid var(--rule);
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 10px 28px; justify-content: space-between; align-items: center; }
.site-footer a { color: var(--ink-2); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }

/* ---------- research page ---------- */
.doc {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: clamp(28px, 4vw, 64px);
  align-items: start;
}
.toc {
  position: sticky;
  top: calc(var(--header-h) + 28px);
  font-size: 14px;
}
.toc .kicker { display: block; margin-bottom: 12px; font-size: 11px; }
.toc ol { list-style: none; display: grid; gap: 2px; }
.toc a {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 8px;
  align-items: baseline;
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--ink-2);
  text-decoration: none;
  line-height: 1.35;
}
.toc a::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 2px;
  background: var(--c, var(--ink-3));
  transform: translateY(-1px);
}
.toc a:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); color: var(--ink); }
.toc a.is-active { background: color-mix(in srgb, var(--c, var(--ink)) 12%, transparent); color: var(--ink); font-weight: 600; }
.toc .toc-sub a::before { background: transparent; border: 1px solid var(--ink-3); }
@media (max-width: 1000px) {
  .doc { grid-template-columns: 1fr; }
  .toc { position: static; }
  .toc ol { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}

.chapter { padding-top: clamp(48px, 7vw, 88px); }
.chapter-head {
  border-top: 4px solid var(--c);
  padding-top: 18px;
  margin-bottom: clamp(24px, 4vw, 40px);
}
.chapter-head .kicker { color: var(--c); }
.chapter-head .verb {
  font-family: var(--f-display);
  font-weight: 300;
  font-size: clamp(3rem, 7vw, 5.2rem);
  line-height: 0.95;
  letter-spacing: -0.035em;
  color: var(--c);
  margin: 8px 0 12px;
}
.chapter-head h2 { font-size: clamp(1.5rem, 2.6vw, 2.05rem); font-weight: 380; max-width: 34ch; color: var(--ink); }
.chapter-head .prose { margin-top: 18px; font-size: 1.16rem; color: var(--ink-2); }

.finding {
  padding: clamp(28px, 4vw, 40px) 0;
  border-top: 1px solid var(--rule);
}
.finding-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px 20px;
  margin-bottom: 14px;
}
.finding h3 {
  font-size: clamp(1.45rem, 2.4vw, 1.85rem);
  font-weight: 420;
  letter-spacing: -0.015em;
  max-width: 30ch;
}
.finding h3 .sec { font-family: var(--f-mono); font-size: 0.5em; color: var(--c); letter-spacing: 0.06em; vertical-align: 0.35em; margin-right: 8px; }
.finding > p { color: var(--ink-2); max-width: 72ch; }
.results {
  list-style: none;
  display: grid;
  gap: 10px;
  margin: 4px 0 24px;
  max-width: 74ch;
}
.results li {
  position: relative;
  padding-left: 22px;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.55;
}
.results li::before {
  content: "";
  position: absolute;
  left: 3px; top: 0.6em;
  width: 8px; height: 8px;
  background: var(--c, var(--accent));
  border-radius: 1px;
  transform: rotate(45deg);
}
.results li b { color: var(--ink); }
.finding .fig { margin-top: 6px; }
.finding .outputs { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 18px; font-size: 14.5px; }
.finding .outputs a { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.honest {
  border-left: 3px solid var(--c, var(--accent));
  background: color-mix(in srgb, var(--c, var(--accent)) 7%, var(--card));
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  font-size: 15px;
  color: var(--ink-2);
  max-width: 74ch;
  margin: 0 0 22px;
}
.honest b { color: var(--ink); }

.compare {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  margin: 8px 0 18px;
  max-width: 760px;
}
.compare th, .compare td { text-align: left; padding: 9px 12px 9px 0; border-bottom: 1px solid var(--rule-2); vertical-align: top; }
.compare thead th { font-family: var(--f-mono); font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; border-bottom-color: var(--ink); }
.compare--3 td:first-child { color: var(--ink-3); width: 22%; }
.compare td { color: var(--ink-2); }
.table-scroll { overflow-x: auto; }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0;
  border-top: 1px solid var(--rule);
  margin-top: 30px;
}
.meta-grid > div { padding: 14px 18px 14px 0; border-bottom: 1px solid var(--rule); }
.meta-grid .kicker { font-size: 10.5px; display: block; margin-bottom: 4px; }
.meta-grid p { margin: 0; font-size: 15px; color: var(--ink-2); line-height: 1.45; }

.thread-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.thread-grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.thread {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 20px 20px 18px;
}
.thread h3 { font-size: 1.35rem; font-weight: 430; margin: 6px 0 8px; }
.thread p { font-size: 15px; color: var(--ink-2); margin: 0 0 10px; }
.thread .refs { font-family: var(--f-mono); font-size: 12px; color: var(--ink-3); }
.thread .refs a { color: var(--ink-2); }

/* ---------- research: tabs, degree cards, themes, animations ---------- */
.subnav {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: clamp(24px, 4vw, 40px);
  overflow-x: auto;
  scrollbar-width: none;
}
.subnav a {
  padding: 10px 16px 11px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-3);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.subnav a:hover { color: var(--ink); }
.subnav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.subnav a small { font-family: var(--f-mono); font-size: 11px; font-weight: 500; color: var(--ink-3); margin-left: 6px; }

.degrees { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: clamp(28px, 4vw, 40px); }
.degree {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px 24px 22px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-top: 4px solid var(--c);
  border-radius: 4px 4px var(--radius) var(--radius);
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}
.degree:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.degree .kicker { color: var(--c); }
.degree h3 { font-size: clamp(1.3rem, 2.2vw, 1.65rem); font-weight: 400; line-height: 1.2; }
.degree p { font-size: 15px; color: var(--ink-2); margin: 0; }
.degree .go { margin-top: auto; padding-top: 6px; font-weight: 600; font-size: 14.5px; color: var(--link); display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 760px) { .degrees { grid-template-columns: 1fr; } }

.theme-index { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 18px; margin-top: 26px; }
.theme-index a {
  display: grid; grid-template-columns: 30px 1fr; align-items: baseline; gap: 6px;
  padding: 10px 0; border-top: 1px solid var(--rule); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15.5px;
}
.theme-index a span { font-family: var(--f-mono); font-size: 12px; font-weight: 500; color: var(--c); }
.theme-index a:hover { color: var(--c); }
@media (max-width: 860px) { .theme-index { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .theme-index { grid-template-columns: 1fr; } }

.theme {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: clamp(28px, 4.5vw, 60px);
  align-items: start;
  padding-block: clamp(48px, 7vw, 88px);
  border-top: 1px solid var(--rule);
}
.theme > * { min-width: 0; }
.theme .num-big {
  font-family: var(--f-display); font-weight: 300; font-size: clamp(3rem, 6vw, 4.6rem);
  line-height: 0.9; color: var(--c); letter-spacing: -0.04em;
}
.theme h2 { font-size: clamp(1.9rem, 3.4vw, 2.7rem); font-weight: 360; letter-spacing: -0.02em; margin: 10px 0 14px; }
.theme .intro { font-family: var(--f-display); font-size: 1.2rem; line-height: 1.5; color: var(--ink-2); margin-bottom: 18px; }
.theme .results { margin-bottom: 20px; }
.theme .media { display: grid; gap: 16px; position: sticky; top: calc(var(--header-h) + 20px); }
.theme .media-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.theme .media-row .fig figcaption { font-size: 13px; }
.paper-list { list-style: none; display: grid; gap: 4px; margin: 0 0 18px; }
.paper-list li { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 10px; font-size: 14.5px; line-height: 1.45; color: var(--ink-2); padding: 7px 0; border-top: 1px solid var(--rule-2); }
.paper-list li > span:first-child { font-family: var(--f-mono); font-size: 12px; color: var(--c, var(--ink-3)); padding-top: 1px; }
.paper-list a { color: var(--ink); text-decoration: none; }
.paper-list a:hover { color: var(--link); text-decoration: underline; }
.paper-list i { color: var(--ink-3); }
.deg-chip { --dot: var(--ink-3); }
.deg-chip--phd { --dot: var(--c-translate); }
.deg-chip--ms { --dot: var(--c-urban); }
.deg-chip--collab { --dot: var(--slate); }
.c-compound { --c: var(--c-compound); }
.c-urban { --c: var(--c-urban); }
@media (max-width: 960px) {
  .theme { grid-template-columns: 1fr; }
  .theme .media { position: static; }
}
@media (max-width: 520px) { .theme .media-row { grid-template-columns: 1fr; } }

.anim-plate { position: relative; }
.anim-badge {
  position: absolute; top: 10px; left: 10px; z-index: 1;
  display: inline-flex; align-items: center; gap: 6px;
  font: 500 10.5px/1 var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase;
  color: #fff; background: rgb(27 36 48 / 0.78);
  padding: 5px 8px 5px 7px; border-radius: 4px;
  pointer-events: none;
}
.anim-badge::before { content: ""; width: 0; height: 0; border-left: 7px solid #f39361; border-top: 4.5px solid transparent; border-bottom: 4.5px solid transparent; }
@media (prefers-reduced-motion: reduce) { .anim-badge { display: none; } }

/* ---------- product screenshots: browser frame, walkthrough, gallery ---------- */
.browser {
  background: var(--plate);
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.browser-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  background: #eef0f3;
  border-bottom: 1px solid #dde1e6;
}
.browser-bar .dots { display: inline-flex; gap: 6px; flex: none; }
.browser-bar .dots i { width: 10px; height: 10px; border-radius: 50%; background: #d4d8de; }
.browser-bar .dots i:nth-child(1) { background: #f26b5b; }
.browser-bar .dots i:nth-child(2) { background: #f6be4f; }
.browser-bar .dots i:nth-child(3) { background: #5fc454; }
.browser-bar .url {
  flex: 1; min-width: 0;
  font: 500 12px/1 var(--f-mono); color: #4a5563;
  background: #fff; border: 1px solid #dde1e6; border-radius: 6px;
  padding: 6px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.browser-bar .url::before { content: "\1F512\00a0"; filter: grayscale(1); opacity: 0.6; }
.browser-bar .open { font: 600 12px/1 var(--f-sans); color: #1d5fa8; text-decoration: none; white-space: nowrap; }
.browser-bar .open:hover { text-decoration: underline; }
.browser img { display: block; width: 100%; height: auto; }
.browser button.shot { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }

.walkthrough {
  display: grid;
  grid-template-columns: minmax(240px, 0.36fr) minmax(0, 1fr);
  gap: clamp(20px, 3vw, 36px);
  align-items: start;
}
.walk-steps { list-style: none; display: grid; gap: 4px; counter-reset: walk; }
.walk-steps button {
  display: grid; grid-template-columns: 30px 1fr; gap: 2px 12px; align-items: start;
  width: 100%; text-align: left; cursor: pointer;
  padding: 12px 12px 12px 10px;
  background: transparent; border: 1px solid transparent; border-radius: 10px;
  color: var(--ink-2); font: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.walk-steps button:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.walk-steps button[aria-selected="true"] { background: var(--card); border-color: var(--rule); box-shadow: var(--shadow); color: var(--ink); }
.walk-steps .k {
  grid-row: span 2;
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  font: 600 12.5px/1 var(--f-mono); color: var(--c, var(--accent)); border: 1.5px solid currentColor;
}
.walk-steps button[aria-selected="true"] .k { background: var(--c, var(--accent)); color: var(--paper); border-color: transparent; }
.walk-steps b { font-size: 15.5px; font-weight: 600; line-height: 1.3; }
.walk-steps small { font-size: 13.5px; line-height: 1.45; color: var(--ink-3); display: none; }
.walk-steps button[aria-selected="true"] small { display: block; }
.walk-stage { position: relative; min-width: 0; }
.walk-stage .browser img { aspect-ratio: 1440 / 1000; object-fit: cover; object-position: top; }
.walk-caption { margin-top: 12px; font-size: 14px; color: var(--ink-3); display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.walk-nav { display: inline-flex; gap: 6px; flex: none; }
.walk-nav button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--rule); background: var(--card); color: var(--ink-2); cursor: pointer; display: grid; place-items: center; }
.walk-nav button:hover { color: var(--ink); border-color: var(--ink-3); }
.walk-progress { height: 3px; background: var(--rule-2); border-radius: 2px; overflow: hidden; margin-top: 10px; }
.walk-progress i { display: block; height: 100%; width: 0; background: var(--c, var(--accent)); }
.walkthrough.is-playing .walk-progress i { animation: walkbar var(--walk-ms, 5200ms) linear forwards; }
@keyframes walkbar { to { width: 100%; } }
@media (max-width: 900px) {
  .walkthrough { grid-template-columns: 1fr; }
  .walk-steps { grid-auto-flow: column; grid-auto-columns: minmax(170px, 1fr); overflow-x: auto; padding-bottom: 6px; }
  .walk-steps button[aria-selected="true"] small { display: none; }
}
@media (prefers-reduced-motion: reduce) { .walkthrough.is-playing .walk-progress i { animation: none; width: 100%; } }

.shot-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.shot-gallery figure { margin: 0; }
.shot-gallery .browser img { aspect-ratio: 1440 / 1000; object-fit: cover; object-position: top center; }
.shot-gallery figcaption { margin-top: 10px; font-size: 14px; line-height: 1.5; color: var(--ink-3); }
.shot-gallery figcaption b { color: var(--ink); font-weight: 600; display: block; font-size: 15px; margin-bottom: 2px; }

/* ---------- talks ---------- */
.talk-map-wrap {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: clamp(12px, 2vw, 24px);
  position: relative;
}
.talk-map { display: block; width: 100%; height: auto; }
.map-land { fill: color-mix(in srgb, var(--ink) 11%, var(--card)); stroke: var(--card); stroke-width: 0.6; }
.map-dot { fill: var(--accent); stroke: var(--card); stroke-width: 1.4; }
.map-halo { fill: var(--accent); opacity: 0.16; pointer-events: none; }
.map-city { cursor: pointer; outline: none; }
.map-city:hover .map-halo, .map-city:focus .map-halo { opacity: 0.4; }
.map-tip {
  position: absolute;
  pointer-events: none;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  line-height: 1.35;
  padding: 7px 10px;
  border-radius: 6px;
  transform: translate(-50%, calc(-100% - 12px));
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.12s;
}
.map-tip.is-on { opacity: 1; }
.map-tip b { display: block; font-weight: 600; }
.map-stats { display: flex; flex-wrap: wrap; gap: 8px 28px; margin-top: 16px; font-size: 14.5px; color: var(--ink-2); }
.map-cities { margin-top: 10px; font-size: 13.5px; color: var(--ink-3); line-height: 1.6; }
.map-stats b { font-family: var(--f-display); font-weight: 400; font-size: 1.6rem; color: var(--ink); margin-right: 6px; }

.talks { list-style: none; }
.talk {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 4px 22px;
  padding: 16px 0;
  border-top: 1px solid var(--rule);
}
.talk .type {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--t, var(--ink-3));
  padding-top: 4px;
}
.talk .type::before { content: "\25CF  "; }
.talk[data-type="oral"] { --t: var(--c-translate); }
.talk[data-type="poster"] { --t: var(--c-refine); }
.talk[data-type="invited"] { --t: var(--c-apply); }
.talk[data-type="coauthor"] { --t: var(--slate); }
.talk h3 { font-family: var(--f-display); font-size: 1.15rem; font-weight: 440; line-height: 1.32; }
.talk .authors { font-size: 14px; color: var(--ink-2); margin-top: 4px; }
.talk .authors b { color: var(--ink); }
.talk .where { font-size: 14px; color: var(--ink-3); margin-top: 2px; }
@media (max-width: 600px) {
  .talk { grid-template-columns: 1fr; }
}

/* ---------- reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); }
.js .reveal.is-in { opacity: 1; transform: none; }
.js .hero .rise { opacity: 0; transform: translateY(12px); animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) forwards; }
.js .hero .rise:nth-child(2) { animation-delay: 0.08s; }
.js .hero .rise:nth-child(3) { animation-delay: 0.16s; }
.js .hero .rise:nth-child(4) { animation-delay: 0.24s; }
.js .hero .rise:nth-child(5) { animation-delay: 0.32s; }
.js .hero .rise:nth-child(6) { animation-delay: 0.4s; }
.js .hero .rise:nth-child(7) { animation-delay: 0.48s; }
.js .hero .basin-fig.rise { animation-delay: 0.3s; }
@keyframes rise { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .js .reveal, .js .hero .rise { opacity: 1; transform: none; transition: none; animation: none; }
  .status .pulse::after, .basin-fig .live i { animation: none; }
}

/* ---------- 404 ---------- */
.lost { min-height: 62vh; display: grid; align-content: center; }
.lost h1 { font-size: clamp(3rem, 9vw, 7rem); font-weight: 300; letter-spacing: -0.04em; line-height: 0.95; margin: 14px 0 18px; }

/* ---------- print ---------- */
@media print {
  .site-header, .band, .basin-fig, .filters, .toc, .site-footer nav { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  body::before { display: none; }
  .doc { grid-template-columns: 1fr; }
  a { color: #000; }
  .reveal { opacity: 1 !important; transform: none !important; }
}
