/* TouchWAM project page */

:root {
  /* one dark family: the navy that tactile images have at zero contact */
  --sensor: #0a0c28;            /* background of every tactile map */
  --ink: #0b0e24;               /* large dark surfaces: hero, touch lab */
  --ink-2: #151a3a;             /* raised elements on dark */
  --ink-line: rgba(255, 255, 255, 0.10);
  --surface: #fff;
  --surface-2: #f6f4ef;
  --surface-3: #ece9e2;
  --paper: #fbfaf7;
  --sand: #f3f1ec;
  --line: #e3e0d8;
  --text: #15171c;
  --muted: #5f6570;
  --faint: #8b9099;

  --touch: #1f9d63;
  --touch-soft: #e6f4ec;
  --hand: #dd7a22;
  --hand-soft: #fbeedf;
  --motion: #2f6bdb;
  --motion-soft: #e7eefc;
  --reflex: #d23f6d;

  --heat-1: #ff3d7f;
  --heat-2: #ff8a3d;
  --heat-3: #ffd27a;

  --f-thumb: #d9534f;
  --f-index: #e8892b;
  --f-middle: #c9a227;
  --f-ring: #3a9a5b;
  --f-little: #2f6bdb;
  --f-wrist: #7b61c4;

  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 20, 30, 0.04), 0 8px 28px rgba(16, 20, 30, 0.06);
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Instrument Serif", ui-serif, Georgia, serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font: 400 17px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
b, strong { font-weight: 600; }
em { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: 0; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.08; }
p { margin: 0; }
button { font: inherit; color: inherit; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.wrap--narrow { max-width: 860px; }

/* projected values */
.est {
  text-decoration: underline dotted rgba(180, 73, 11, 0.7);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.18em;
  cursor: help;
}

/* ------------------------------------------------------------------ nav */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; gap: 24px;
  height: 60px; padding: 0 var(--gutter);
  color: #fff;
  transition: background 0.3s, color 0.3s, box-shadow 0.3s;
}
.nav.is-solid {
  background: rgba(251, 250, 247, 0.82);
  color: var(--text);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  box-shadow: 0 1px 0 var(--line);
}
.nav__brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.01em; text-decoration: none; }
.nav__mark {
  width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, var(--heat-3) 0 18%, var(--heat-2) 34%, var(--heat-1) 58%, transparent 60%),
              radial-gradient(circle, transparent 62%, currentColor 64% 72%, transparent 74%);
}
.nav__links { display: flex; gap: 26px; margin: 0 auto; font-size: 14.5px; }
.nav__links a { text-decoration: none; opacity: 0.78; transition: opacity 0.2s; }
.nav__links a:hover { opacity: 1; }
.nav__cta {
  font-size: 14px; text-decoration: none; padding: 7px 16px; border-radius: 999px;
  border: 1px solid currentColor; opacity: 0.9;
}
.nav__cta:hover { opacity: 1; }

/* ------------------------------------------------------------------ hero */
.hero {
  position: relative;
  min-height: 100vh; min-height: 100svh;
  max-height: 1080px;
  display: flex; align-items: flex-end;
  background: var(--ink);
  color: #fff;
  overflow: hidden;
  isolation: isolate;
  cursor: crosshair;
  touch-action: pan-y;
}
.hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; }
.hero__vignette {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(120% 80% at 18% 100%, rgba(11, 14, 36, 0.86) 0%, rgba(11, 14, 36, 0.35) 45%, transparent 70%),
    linear-gradient(180deg, rgba(11, 14, 36, 0.55) 0%, transparent 18%, transparent 70%, rgba(11, 14, 36, 0.6) 100%);
}
/* the gel field fades out towards the bottom edge, where the key-number card rests on it */
.hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 220px; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgba(11, 14, 36, 0) 0%, var(--ink) 92%);
}
.hero__inner {
  width: 100%; max-width: var(--wrap); margin: 0 auto;
  padding: 120px var(--gutter) calc(clamp(72px, 12vh, 120px) + 56px);
  pointer-events: none;
}
.hero__inner a { pointer-events: auto; }
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font: 500 13px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
  padding: 9px 14px; border-radius: 999px;
  border: 1px solid var(--ink-line); background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(6px);
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--heat-1); box-shadow: 0 0 0 0 rgba(255, 61, 127, 0.6); animation: pulse 2.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 61, 127, 0.55); } 70% { box-shadow: 0 0 0 10px rgba(255, 61, 127, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 61, 127, 0); } }
.hero__title {
  margin-top: 22px;
  font-size: clamp(64px, 13vw, 168px);
  font-weight: 600; letter-spacing: -0.055em; line-height: 0.9;
}
.hero__title span {
  background: linear-gradient(100deg, var(--heat-1) 0%, var(--heat-2) 55%, var(--heat-3) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__subtitle {
  margin-top: 22px; max-width: 760px;
  font-size: clamp(21px, 2.6vw, 32px); line-height: 1.22; letter-spacing: -0.015em;
  color: rgba(255, 255, 255, 0.92);
}
.hero__authors { margin-top: 18px; font-size: 15px; color: rgba(255, 255, 255, 0.58); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 999px;
  font-size: 15px; font-weight: 500; text-decoration: none;
  transition: transform 0.2s, background 0.2s, border-color 0.2s;
}
.btn small { font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.6; }
.btn--light { background: #fff; color: var(--ink); }
.btn--ghost { color: #fff; border: 1px solid rgba(255, 255, 255, 0.22); background: rgba(255, 255, 255, 0.04); backdrop-filter: blur(6px); }
.btn:not(.is-disabled):hover { transform: translateY(-1px); }
.btn--ghost:not(.is-disabled):hover { border-color: rgba(255, 255, 255, 0.5); }
.btn.is-disabled { cursor: default; opacity: 0.72; }

.hud {
  position: absolute; right: var(--gutter); top: 96px; width: 268px;
  padding: 16px 16px 14px; border-radius: 16px;
  background: rgba(11, 14, 36, 0.6);
  border: 1px solid var(--ink-line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  font-size: 12.5px; pointer-events: none;
}
.hud__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; white-space: nowrap; }
.hud__title { font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.09em; color: rgba(255, 255, 255, 0.6); }
.hud__event {
  font: 500 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.06em;
  padding: 5px 8px; border-radius: 999px; color: rgba(255, 255, 255, 0.55); background: rgba(255, 255, 255, 0.06);
  transition: background 0.2s, color 0.2s;
}
.hud__event.is-on { background: rgba(255, 61, 127, 0.18); color: #ffb3c8; }
.hud__event.is-flash { background: var(--heat-1); color: #fff; }
.hud__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 10px; margin: 0; }
.hud__grid dt { color: rgba(255, 255, 255, 0.5); font-size: 11px; margin-bottom: 3px; }
.hud__grid dd { margin: 0; white-space: nowrap; display: flex; align-items: baseline; gap: 3px; font: 500 19px/1.1 var(--mono); color: #fff; font-variant-numeric: tabular-nums; }
.hud__grid dd small { font-size: 11px; color: rgba(255, 255, 255, 0.5); }
.hud__arrow { width: 16px; height: 16px; margin-left: 4px; align-self: center; fill: none; stroke: var(--heat-2); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: opacity 0.2s; }
.hud__spark { display: block; width: 100%; height: 38px; margin-top: 12px; }
.hud__hint { margin-top: 8px; color: rgba(255, 255, 255, 0.5); font-size: 11.5px; }
.hud__key { font-family: var(--mono); color: rgba(255, 255, 255, 0.85); }

.hero__scroll {
  display: none;
  position: absolute; left: 50%; bottom: 22px; width: 26px; height: 42px; margin-left: -13px;
  border: 1.5px solid rgba(255, 255, 255, 0.3); border-radius: 14px;
}
.hero__scroll span { position: absolute; left: 50%; top: 8px; width: 3px; height: 8px; margin-left: -1.5px; border-radius: 2px; background: #fff; animation: wheel 1.8s infinite; }
@keyframes wheel { 0% { opacity: 0; transform: translateY(-3px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(12px); } }

/* ------------------------------------------------------------------ stats */
/* key numbers float as a card over the edge of the hero */
.stats { position: relative; z-index: 2; margin-top: -64px; }
.stats__grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  width: calc(100% - 2 * var(--gutter)); padding: 0 clamp(16px, 2.6vw, 32px);
  background: #fff;
  border: 1px solid var(--line); border-radius: 22px;
  box-shadow: 0 1px 2px rgba(16, 20, 30, 0.04), 0 24px 60px -24px rgba(11, 14, 36, 0.28);
}
.stat { padding: 30px 22px 28px 0; display: flex; flex-direction: column; gap: 6px; }
.stat + .stat { padding-left: 24px; border-left: 1px solid var(--line); }
.stat b { font-size: clamp(30px, 3.6vw, 44px); font-weight: 600; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat > span { color: var(--muted); font-size: 14.5px; line-height: 1.4; }

/* ------------------------------------------------------------------ sections */
.section { padding: clamp(80px, 11vw, 140px) 0; }
.section--sand { background: var(--sand); }
.section__head { max-width: 820px; margin: 0 auto clamp(40px, 5vw, 64px); text-align: center; }
.section__head h2 { font-size: clamp(34px, 4.6vw, 58px); }
.section__head .lede { margin-top: 20px; color: var(--muted); font-size: 18.5px; line-height: 1.6; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 18px;
  font: 500 12.5px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted);
}
.eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.eyebrow--touch { color: var(--touch); }
.eyebrow--hand { color: var(--hand); }
.eyebrow--motion { color: var(--motion); }
.lede { font-size: 18px; }

/* thesis */
.thesis__quote {
  margin: 0; font-size: clamp(28px, 3.6vw, 44px); line-height: 1.16; letter-spacing: -0.025em; font-weight: 500;
}
.thesis__quote em { color: var(--reflex); }
.thesis__body { margin-top: 32px; display: grid; grid-template-columns: 1fr 1fr; gap: 28px; color: #353a43; }
.thesis .figure { margin-top: clamp(48px, 6vw, 80px); }

/* figures */
.figure { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(12px, 2vw, 24px); box-shadow: var(--shadow); }
.figure img { width: 100%; border-radius: 6px; }
.figure figcaption { margin-top: 16px; color: var(--muted); font-size: 14.5px; line-height: 1.55; max-width: 900px; }
.figure figcaption b { color: var(--text); }
.figure--narrow { max-width: 900px; margin-left: auto; margin-right: auto; }
.section .figure + .figure, .cards + .figure, .formats + .figure, .datachart + .cards, .cards + .tablecard { margin-top: 28px; }

/* ------------------------------------------------------------------ touch lab */
/* the page stays light; only what a sensor or the encoder outputs is shown on a dark "screen" */
.touchlab { position: relative; }
.touchlab .section__head h2 em { color: var(--reflex); }
.touchlab__grid { position: relative; }
.touchlab__inputs { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(12px, 2.4vw, 28px); max-width: 1040px; margin: 0 auto; }
.touchlab__wires { display: block; width: 100%; max-width: 1040px; height: 64px; margin: 6px auto 0; overflow: visible; }
.touchlab__wires path { fill: none; stroke: rgba(21, 23, 28, 0.16); stroke-width: 1.5; vector-effect: non-scaling-stroke; transition: stroke 0.25s; }
.touchlab__wires path.is-on { stroke: var(--heat-2); stroke-width: 2; stroke-dasharray: 6 6; animation: flow 0.9s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -12; } }
.pad { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.pad canvas {
  width: 100%; aspect-ratio: 1; display: block; border-radius: 16px; cursor: crosshair; touch-action: none; background: var(--sensor);
  box-shadow: 0 0 0 1px rgba(11, 14, 36, 0.08), 0 18px 36px -20px rgba(11, 14, 36, 0.55);
  transition: box-shadow 0.25s, transform 0.25s;
}
.pad canvas:hover { transform: translateY(-2px); }
.pad.is-read canvas { box-shadow: 0 0 0 2px var(--heat-2), 0 0 0 6px rgba(255, 138, 61, 0.16), 0 18px 36px -20px rgba(11, 14, 36, 0.55); }
.pad figcaption { display: flex; flex-direction: column; gap: 2px; font-size: 14.5px; }
.pad figcaption b { font-weight: 600; }
.pad figcaption span { color: var(--muted); font-size: 13px; }
.touchlab__encoder {
  max-width: 1040px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: clamp(18px, 2.4vw, 28px);
  display: grid; grid-template-columns: 1.25fr 1fr; gap: clamp(20px, 3vw, 40px);
}
.enc__left, .enc__right { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.enc__top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.enc__chip, .enc__label { font: 500 12px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.enc__label { padding-top: 12px; }
.touchlab__reading { color: var(--muted); font-size: 14px; }
.touchlab__reading b { color: var(--text); }
.tokens { display: grid; gap: 6px; padding: 14px 16px; border-radius: 14px; background: var(--ink); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 14px 30px -20px rgba(11, 14, 36, 0.6); }
.tokens__row { display: grid; grid-template-columns: 54px repeat(16, 1fr); gap: 3px; align-items: center; }
.tokens__row span { font: 500 10.5px/1 var(--mono); color: rgba(255, 255, 255, 0.45); }
.tokens__row i { height: 22px; border-radius: 4px; background: var(--ink-2); transition: background-color 0.12s; }
.readout { display: grid; grid-template-columns: 1fr 1.25fr 1fr; gap: 10px; margin: 0; }
.readout div { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.readout dt { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.readout dd { margin: 0; white-space: nowrap; font: 500 15px/1.2 var(--mono); font-variant-numeric: tabular-nums; }
.readout dd.is-wrong { color: #c2412d; }
.touchlab__verdict { font-size: 14px; min-height: 2.6em; color: #3a3f48; }
.touchlab__verdict b { color: var(--touch); }
.touchlab__verdict.is-bad b { color: #c2412d; }
.touchlab__note { margin-top: auto; font-size: 12px; line-height: 1.5; color: var(--faint); }

.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); border: 1px solid var(--ink-line); align-self: flex-start; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 999px; font-size: 13.5px; cursor: pointer; color: rgba(255, 255, 255, 0.7); transition: background 0.2s, color 0.2s; }
.seg button[aria-checked="true"] { background: #fff; color: var(--ink); }
.seg--light { background: #f1efe9; border-color: var(--line); }
.seg--light button { color: var(--muted); }
.seg--light button[aria-checked="true"] { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.seg--sm button { padding: 6px 11px; font-size: 12.5px; }

/* ------------------------------------------------------------------ formats */
.formats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.format {
  position: relative; padding: 28px 26px 26px; border-radius: var(--radius); background: #fff;
  border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden;
  display: flex; flex-direction: column; gap: 12px;
}
.format::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--c); }
.format--touch { --c: var(--touch); --soft: var(--touch-soft); }
.format--hand { --c: var(--hand); --soft: var(--hand-soft); }
.format--motion { --c: var(--motion); --soft: var(--motion-soft); }
.format__index { font: 500 12px/1 var(--mono); color: var(--c); }
.format h3 { font-size: 23px; }
.format p { color: var(--muted); font-size: 15.5px; line-height: 1.6; }
.format a { margin-top: auto; padding-top: 6px; font-size: 14.5px; font-weight: 500; color: var(--c); text-decoration: none; }

/* ------------------------------------------------------------------ slots */
.slots { display: grid; grid-template-columns: 0.8fr 1.35fr; gap: 36px; align-items: start; }
.slots__hand { position: sticky; top: 88px; }
.slots__hand-frame { position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.slots__hand-frame img { width: 100%; opacity: 0.96; }
.slots__hand-frame svg { position: absolute; inset: 22px; width: calc(100% - 44px); height: calc(100% - 44px); overflow: visible; }
.joint { transition: r 0.2s, opacity 0.2s, fill 0.2s; }
.joint__ring { fill: none; stroke-width: 2.5; opacity: 0; transition: opacity 0.2s; }
.joint.is-off { opacity: 0.18; }
.slots__caption { margin-top: 12px; text-align: center; font: 500 13px/1.4 var(--mono); color: var(--muted); min-height: 1.4em; }
.slots__panel { display: flex; flex-direction: column; gap: 22px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 13.5px; cursor: pointer;
  display: inline-flex; gap: 6px; align-items: baseline; transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.chip small { font: 500 11px/1 var(--mono); color: var(--faint); }
.chip:hover { border-color: #c9c4b8; }
.chip[aria-checked="true"] { background: var(--text); border-color: var(--text); color: #fff; }
.chip[aria-checked="true"] small { color: rgba(255, 255, 255, 0.6); }
.strip-block { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 16px 14px; }
.strip-block__head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin-bottom: 12px; font-size: 14.5px; }
.strip-block__head span { color: var(--muted); font-size: 13px; }
.strip { display: grid; grid-template-columns: 52px repeat(24, 1fr); gap: 3px; align-items: center; margin-top: 5px; }
.strip__label { font: 500 11px/1.1 var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell {
  height: 26px; border-radius: 4px; background: var(--c, #ece9e2); position: relative; cursor: default;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.2s;
}
.cell.is-empty { background: repeating-linear-gradient(-45deg, #f2efe9 0 3px, #e7e3da 3px 5px); }
.cell.is-hot { transform: translateY(-3px); box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--text); z-index: 1; }
.cell.is-clash::after { content: ""; position: absolute; left: 50%; bottom: -7px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--reflex); }
.cell.is-flip::before { content: "±"; position: absolute; inset: 0; display: grid; place-items: center; font: 600 11px/1 var(--mono); color: #fff; }
.strip-block__flag { margin-top: 12px; font-size: 13px; color: var(--reflex); min-height: 1.2em; }
.strip-block__flag--ok { color: var(--touch); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend span::before { content: ""; width: 11px; height: 11px; border-radius: 3px; background: var(--c); }
.legend .legend__empty::before { background: repeating-linear-gradient(-45deg, #f2efe9 0 2px, #ddd8cd 2px 4px); }
.callout { padding: 18px 20px; border-radius: 14px; background: var(--hand-soft); border: 1px solid #f1d6b8; font-size: 15px; line-height: 1.6; color: #4a3a2b; }

.frame { margin-top: clamp(48px, 6vw, 72px); padding: 26px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.frame__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 20px; margin-bottom: 18px; }
.frame__head .eyebrow { margin: 0; }
.frame__head p:last-child { color: var(--muted); font-size: 14.5px; }
.frame__bar { display: flex; gap: 2px; height: 46px; }
.frame__seg { flex: var(--w) 1 0; border-radius: 5px; background: var(--c); opacity: 0.9; transition: opacity 0.2s, transform 0.2s; cursor: default; }
.frame__seg.is-spare { background: repeating-linear-gradient(-45deg, #f2efe9 0 3px, #e3dfd5 3px 5px); }
.frame__bar:hover .frame__seg { opacity: 0.4; }
.frame__bar .frame__seg:hover { opacity: 1; transform: scaleY(1.12); }
.frame__label { margin-top: 12px; font: 500 13px/1.4 var(--mono); color: var(--muted); }

/* ------------------------------------------------------------------ cards */
.cards { display: grid; gap: 18px; margin-top: 28px; }
.cards--3 { grid-template-columns: repeat(3, 1fr); }
.cards--2 { grid-template-columns: repeat(2, 1fr); }
.card { padding: 26px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.card h3 { font-size: 20px; margin-bottom: 10px; display: flex; align-items: center; gap: 10px; }
.card p { color: var(--muted); font-size: 15.5px; line-height: 1.62; }
.card p b { color: var(--text); }
.card--touch { border-top: 3px solid var(--touch); }
.card--reflex { border-top: 3px solid var(--reflex); }
.tag { font: 500 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.06em; padding: 4px 7px; border-radius: 999px; background: #fbe6ed; color: var(--reflex); }

/* data */
.datachart { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.tiers { display: flex; height: 64px; gap: 2px; }
.tier { flex: var(--w) 1 0; border-radius: 6px; background: var(--c); color: #fff; padding: 10px 12px; display: flex; flex-direction: column; justify-content: center; overflow: hidden; min-width: 0; cursor: default; transition: filter 0.2s; }
.tier:hover { filter: brightness(1.08); }
.tier b { font: 600 15px/1.1 var(--sans); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tier span { font-size: 11.5px; opacity: 0.88; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tiers__legend { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-top: 16px; }
.tiers__legend div { font-size: 13px; color: var(--muted); line-height: 1.45; }
.tiers__legend b { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: 13.5px; }
.tiers__legend b::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }
.tiers__legend .mod { font: 500 11px/1 var(--mono); color: var(--faint); }
.islands { margin-top: 18px; display: grid; gap: 7px; }
.island { display: grid; grid-template-columns: 150px 1fr 64px; gap: 10px; align-items: center; font-size: 13px; }
.island span:first-child { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.island i { height: 12px; border-radius: 3px; background: #c9c3b6; }
.island:first-child i { background: var(--hand); }
.island.island--all i { background: var(--text); }
.island b { font: 500 12.5px/1 var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
.touchbar { margin-top: 18px; }
.touchbar__track { display: flex; height: 16px; border-radius: 5px; overflow: hidden; background: #ece9e2; }
.touchbar__track i:nth-child(1) { background: var(--touch); }
.touchbar__track i:nth-child(2) { background: repeating-linear-gradient(-45deg, #5cc290 0 4px, #8ad6ae 4px 8px); }
.touchbar__legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.touchbar__legend span { display: inline-flex; align-items: center; gap: 6px; }
.touchbar__legend span::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }

/* ------------------------------------------------------------------ charts */
.chartcard, .tablecard { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); }
.chartcard__bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.chartcard__bar h3, .tablecard h3 { font-size: 18px; }
.chartcard__note { margin-top: 8px; font-size: 12.5px; color: var(--faint); }
.results-pair .chartcard { display: flex; flex-direction: column; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .bars__legend { margin-top: 4px; }
.projtag { font: 500 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.06em; padding: 4px 8px; border-radius: 999px; background: #fdf0e6; color: #b4490b; border: 1px dashed rgba(180, 73, 11, 0.45); white-space: nowrap; }
.chart .grid line { stroke: #eeebe4; }
.chart .axis text, .bars text { fill: var(--faint); font: 400 12px var(--sans); }
.chart .axis-title { fill: var(--muted); font: 500 12px var(--sans); }
.chart .line { fill: none; stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; transition: opacity 0.2s, stroke-width 0.2s; }
.chart .dot { stroke: #fff; stroke-width: 2; transition: opacity 0.2s; }
.chart .endlabel { font: 500 12.5px var(--sans); }
.chart .cross { stroke: #c9c4b8; stroke-dasharray: 3 3; }
.chart .series.is-focus .line { stroke-width: 3.4; }
.chart .series.is-focus .dot { r: 5; }
.tip {
  position: fixed; z-index: 100; pointer-events: none; opacity: 0; transform: translate(-50%, calc(-100% - 12px));
  background: var(--ink); color: #fff; padding: 10px 12px; border-radius: 10px; font-size: 12.5px; line-height: 1.5;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); transition: opacity 0.12s; white-space: nowrap;
}
.tip.is-on { opacity: 1; }
.tip b { font-weight: 600; }
.tip .tip__row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tip .tip__row i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); display: inline-block; margin-right: 6px; }
.tip .tip__row span:last-child { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.bars { display: grid; gap: 10px; margin-top: 10px; }
.bars__row { display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: center; }
.bars__row > span { font-size: 13px; color: var(--muted); }
.bars__stack { display: grid; gap: 3px; }
.bars__bar { position: relative; height: 9px; border-radius: 0 4px 4px 0; background: var(--c); width: 0; transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); cursor: default; }
.bars__legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.bars__legend span { display: inline-flex; align-items: center; gap: 6px; }
.bars__legend span::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }

.tablecard h3 { margin-bottom: 14px; }
.tablewrap { overflow-x: auto; }
.bench { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 560px; }
.bench th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.bench td { padding: 11px 12px; border-bottom: 1px solid #f0ede6; font-variant-numeric: tabular-nums; }
.bench td.num, .bench th.num { text-align: right; }
.bench td.num { font-family: var(--mono); font-size: 13.5px; }
.bench tr.is-ours td { background: #f2f6ff; font-weight: 600; }
.bench tr.is-ours td:first-child { border-left: 3px solid var(--motion); }
.bench .touchmark { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--touch); margin-left: 7px; vertical-align: middle; }
.bench .best { color: var(--motion); }

/* gallery */
.gallery { display: grid; gap: 22px; }

/* bibtex */
.bib { position: relative; margin-top: 4px; background: var(--ink); color: #e8ebf3; border-radius: var(--radius); padding: 26px 28px; overflow-x: auto; }
.bib pre { margin: 0; font: 400 14px/1.7 var(--mono); }
.bib__copy { position: absolute; top: 14px; right: 14px; border: 1px solid var(--ink-line); background: rgba(255, 255, 255, 0.06); color: #fff; border-radius: 8px; padding: 6px 12px; font-size: 12.5px; cursor: pointer; }
.bib__copy:hover { background: rgba(255, 255, 255, 0.12); }

.footer { border-top: 1px solid var(--line); padding: 36px 0 48px; }
.footer__inner { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: center; justify-content: space-between; }
.footer__draft { font-size: 13px; color: var(--faint); max-width: 640px; }


/* ------------------------------------------------------------------ hand lab */
.handlab { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; align-items: stretch; }
.handlab__stage {
  position: relative; min-height: 600px; border-radius: var(--radius); overflow: hidden;
  background: radial-gradient(120% 90% at 50% 30%, #ffffff 0%, #f6f4ef 55%, #ebe7de 100%);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.handlab__stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: pan-y; }
.handlab__stage canvas:active { cursor: grabbing; }
.handlab__top { position: absolute; inset: 16px 16px auto 16px; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; pointer-events: none; }
.handlab__top > * { pointer-events: auto; }
.handlab__title { display: flex; flex-direction: column; gap: 2px; }
.handlab__title b { font-size: 22px; letter-spacing: -0.02em; }
.handlab__title span { font: 500 12px/1.3 var(--mono); color: var(--muted); }
/* slots vs. order: a frame behind each hand says which reading it is */
.handlab__panes { position: absolute; inset: 0; pointer-events: none; animation: panein 0.35s ease-out; }
.handlab__panes[hidden] { display: none; }
@keyframes panein { from { opacity: 0; } to { opacity: 1; } }
.hl-pane { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 6px; padding: 12px 10px 11px; border-radius: 20px; text-align: center; }
.hl-pane--ours { background: linear-gradient(180deg, rgba(46, 158, 91, 0.1) 0%, rgba(46, 158, 91, 0.03) 60%, rgba(255, 255, 255, 0) 100%); border: 1.5px solid rgba(46, 158, 91, 0.5); box-shadow: 0 14px 34px -18px rgba(23, 99, 58, 0.45), inset 0 0 0 4px rgba(255, 255, 255, 0.45); }
.hl-pane--base { background: rgba(139, 147, 161, 0.05); border: 1.5px dashed rgba(139, 147, 161, 0.6); }
.hl-pane__head { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 0; }
.hl-pane__tag { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px 5px 8px; border-radius: 999px; font: 600 11px/1 var(--sans); letter-spacing: 0.02em; white-space: nowrap; }
.hl-pane__tag svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.hl-pane--ours .hl-pane__tag { background: var(--touch); color: #fff; box-shadow: 0 2px 8px rgba(46, 158, 91, 0.3); }
.hl-pane--base .hl-pane__tag { background: #fff; color: #5f6570; border: 1px solid #d6d9de; padding-left: 10px; }
.hl-pane__head b { font: 600 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.07em; white-space: nowrap; }
.hl-pane--ours .hl-pane__head b { color: #17633a; }
.hl-pane--base .hl-pane__head b { color: #8b5a6b; }
.hl-pane small { font-size: 11.5px; line-height: 1.35; color: var(--muted); max-width: 210px; }
.hl-pane--ours small { color: #2b6b45; }
@media (max-width: 560px) {
  .hl-pane small, .handlab__hint { display: none; }
  .hl-pane { padding: 10px 6px; border-radius: 16px; }
  .hl-pane__tag { font-size: 10.5px; padding: 4px 8px 4px 7px; }
  .hl-pane__head { gap: 5px; }
  .hl-pane__head b { font-size: 9.5px; letter-spacing: 0.05em; }
  .handlab__stage.is-compare { min-height: 600px; }
}
.handlab__loading { position: absolute; inset: 0; display: grid; place-items: center; font: 500 13px var(--mono); color: var(--muted); pointer-events: none; }
.handlab__loading[hidden] { display: none; }
.handlab__hint { position: absolute; right: 18px; top: 60px; font: 500 11px/1 var(--mono); color: var(--faint); pointer-events: none; }
.handlab__presets { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.preset {
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.86); backdrop-filter: blur(6px);
  border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 500; cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.15s;
}
.preset:hover { border-color: #c9c4b8; transform: translateY(-1px); }
.preset.is-on { background: var(--text); color: #fff; border-color: var(--text); }

.handlab__panel { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.hl-block { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.hl-label { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; font-size: 14px; font-weight: 600; }
.hl-label span { font-weight: 400; font-size: 12.5px; color: var(--muted); }
.chips--sm { gap: 5px; }
.chips--sm .chip { padding: 4px 10px; font-size: 12.5px; }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; }
.quick__row { display: grid; grid-template-columns: 52px 1fr 26px; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.quick__row b { font: 500 11.5px/1 var(--mono); color: var(--faint); text-align: right; }
.quick input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; }
.quick input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--c) 0 var(--p, 0%), #ece9e2 var(--p, 0%)); }
.quick input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: #ece9e2; }
.quick input[type="range"]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--c); }
.quick input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -5px; border-radius: 50%; background: #fff; border: 2px solid var(--c); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18); }
.quick input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--c); }

.eq { display: grid; grid-template-columns: 5fr 4fr 4fr 4fr 5fr 2fr; gap: 10px; }
.eq__name { font: 500 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--c); margin-bottom: 6px; }
.eq__bars { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 3px; }
.eq__col { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.eq__track {
  position: relative; width: 100%; height: 112px; border-radius: 5px; background: #f1eee8; overflow: hidden;
  cursor: ns-resize; touch-action: none; outline-offset: 2px;
}
.eq__track:focus-visible { outline: 2px solid var(--c); }
.eq__fill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: var(--c); border-radius: 4px; }
.eq__zero { position: absolute; left: 0; right: 0; bottom: 50%; height: 1px; background: rgba(0, 0, 0, 0.18); display: none; }
.eq__col.is-aa .eq__zero { display: block; }
.eq__col.is-aa .eq__fill { opacity: 0.8; }
.eq__tag { font: 500 9px/1.1 var(--mono); color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: clip; max-width: 100%; }
.eq__sign { font: 600 11px/1 var(--mono); color: var(--reflex); height: 11px; }
.eq__col.is-off .eq__track { background: repeating-linear-gradient(-45deg, #f2efe9 0 3px, #e3dfd5 3px 5px); cursor: not-allowed; }
.eq__col.is-off .eq__fill { display: none; }
.eq__col.is-off .eq__tag { opacity: 0.45; }
.eq__col:not(.is-off):hover .eq__track { box-shadow: inset 0 0 0 1.5px var(--c); }
.eq__legend { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 12px; color: var(--muted); }
.eq__legend-off { width: 12px; height: 12px; border-radius: 3px; background: repeating-linear-gradient(-45deg, #f2efe9 0 2px, #d9d4c8 2px 4px); }
.eq__legend-sign { margin-left: 10px; font: 600 12px/1 var(--mono); color: var(--reflex); }
.hl-note { font-size: 14px; line-height: 1.55; color: var(--muted); min-height: 3.2em; padding: 0 4px; }
.hl-note b { color: var(--text); }
.hl-note code { font: 500 12.5px var(--mono); color: var(--text); background: #efece5; padding: 1px 5px; border-radius: 4px; }
.hl-note .flip { font-family: var(--sans); font-style: normal; color: var(--reflex); font-size: 12.5px; }
.hl-note__order { color: var(--reflex); }
#slots .callout { margin-top: 20px; }


/* ------------------------------------------------------------------ interactive figures */
.dg-fig { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(14px, 2vw, 24px); }
.dg-fig + .dg-fig, .cards + .dg-fig, .formats + .dg-fig, .dg-fig + .cards { margin-top: 28px; }
.dg-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 18px; margin-bottom: 10px; }
.dg-head h3 { font-size: 18px; }
.dg-head p { color: var(--muted); font-size: 13.5px; }
.dg-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.dg { display: block; width: 100%; min-width: 780px; height: auto; font-family: var(--sans); user-select: none; }
.dg text { font-family: var(--sans); }
.dg .dn { cursor: pointer; outline: none; transition: opacity 0.35s, transform 0.25s; transform-box: fill-box; transform-origin: center; }
.dg .dn .dn-box { transition: stroke-width 0.2s, filter 0.25s; }
.dg .dn:hover .dn-box, .dg .dn.is-hot .dn-box { stroke-width: 2.4; filter: drop-shadow(0 4px 8px rgba(20, 24, 40, 0.14)); }
.dg .dn.is-hot { transform: translateY(-1.5px); }
.dg .de { fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: opacity 0.25s, stroke-width 0.2s; stroke-dasharray: 5 6; animation: dgflow 1.6s linear infinite; }
.dg .de--video { stroke: #3b6fd8; } .dg .de--action { stroke: #e2852a; } .dg .de--touch { stroke: #2e9e5b; }
.dg .de--text { stroke: #7b5cc4; } .dg .de--state { stroke: #d9567e; } .dg .de--reflex { stroke: #d23f6d; } .dg .de--gray { stroke: #9aa1ad; }
.dg .de.is-hot { stroke-width: 2.8; animation-duration: 0.6s; }
@keyframes dgflow { to { stroke-dashoffset: -22; } }
.dg .noisy { filter: blur(1.2px) saturate(0.6) brightness(1.08); opacity: 0.9; }
.dg .badge { pointer-events: none; }
.dg.arch.mode-train .only-infer, .dg.arch.mode-infer .only-train { opacity: 0; pointer-events: none; }
.dg .only-infer, .dg .only-train { transition: opacity 0.35s; }
.dg .gate { transition: fill 0.3s; }
.dg .dn.is-hot .gate { fill: #e0f3e7; }
.dg-panel { margin-top: 12px; padding: 14px 16px; border-radius: 12px; background: var(--sand); min-height: 76px; font-size: 14.5px; line-height: 1.6; color: #3a3f48; }
.dg-panel p + p { margin-top: 4px; }
.dg-panel__title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 600; color: var(--text); font-size: 15.5px; }
.dg-panel__idle { color: var(--muted); }
.dg-panel__idle b { color: var(--text); }
.dg-tag { font: 500 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.05em; padding: 4px 7px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--muted); }
.dg-tag--frozen { color: #2c55ad; border-color: #c7d6f6; }
.dg-tag--trained { color: #a35a14; border-color: #f3d3b1; }
.dg-tag--design, .dg-tag--inference { color: var(--reflex); border-color: #f2c3d2; }
.dg-tag--trainingonly { color: #5f6570; }
.dg-key { margin-left: 14px; font-size: 13px; white-space: nowrap; }
.dg-key i { font-style: normal; margin-right: 4px; }
.k-frozen { color: #3b6fd8; } .k-trained { color: #e2852a; font-size: 10px; }
.dg-static { font-size: 12.5px; color: var(--faint); text-decoration: none; border-bottom: 1px dotted var(--faint); }
.dg-static:hover { color: var(--muted); }
.dg-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.dg-foot p { font-size: 13px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .dg .de { animation: none; } }


/* figure controls */
.dg-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.btn-mini { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 500; cursor: pointer; min-width: 64px; }
.btn-mini:hover { border-color: #c9c4b8; }
.scrub { width: 180px; accent-color: var(--reflex); }
.dg-head h3 .tag { vertical-align: middle; margin-left: 6px; }

/* encoder extras */
.dg.encoder .rt-cell { transition: fill 0.18s, opacity 0.18s, stroke-width 0.18s; cursor: crosshair; }
.dg.overview .tok-pulse rect, .dg.encoder .tok-pulse rect { animation: tokpulse 2.4s ease-in-out infinite; }
@keyframes tokpulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
.dg .mask-cell { animation: maskblink 3s ease-in-out infinite; }
@keyframes maskblink { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.dg.overview .neq { pointer-events: none; }
.dg.overview .dn:hover .slot-col, .dg.overview .dn.is-hot .slot-col { stroke: var(--hand); stroke-width: 2.4; }

/* reflex simulation */
.rx__objects { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 2px 0 14px; }
.rx__objects > span { font: 600 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.05em; color: #5f6570; }
.rx { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; align-items: stretch; }
.rx__stage { position: relative; min-height: 460px; border-radius: 14px; overflow: hidden; background: radial-gradient(120% 90% at 50% 28%, #fdfcfa 0%, #eeebe3 100%); touch-action: pan-y; }
.rx__stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
.rx__stage canvas.is-over { cursor: pointer; }
.rx__status { position: absolute; left: 14px; top: 14px; display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px 7px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.94); box-shadow: 0 2px 10px rgba(20, 24, 40, 0.08); font-size: 13px; font-weight: 600; color: var(--c, #17633a); transition: color 0.2s; }
.rx__status i { width: 9px; height: 9px; border-radius: 50%; background: var(--c, #2e9e5b); box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.05); transition: background 0.2s; }
.rx__clock { position: absolute; right: 14px; top: 14px; font: 500 12px var(--mono); color: var(--muted); background: rgba(255, 255, 255, 0.88); padding: 6px 10px; border-radius: 8px; }
.rx__hint { position: absolute; left: 0; right: 0; bottom: 12px; text-align: center; font-size: 12.5px; color: var(--faint); pointer-events: none; margin: 0; }
.rx__loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px; margin: 0; }
.rx__loading[hidden] { display: none; }
.rx__side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.rx__label { font: 600 11px/1.3 var(--mono); text-transform: uppercase; letter-spacing: 0.05em; color: #5f6570; display: flex; justify-content: space-between; align-items: center; gap: 4px 10px; flex-wrap: wrap; margin: 0; }
.rx__label span { text-transform: none; letter-spacing: 0; font: 400 12px var(--sans); color: var(--faint); display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.rx__ring { width: 11px; height: 11px; border-radius: 50%; border: 1.5px dashed #6fcf97; display: inline-block; }
.rx__key { width: 14px; height: 3px; border-radius: 2px; display: inline-block; background: var(--c); }
.rx__key--dash { background: repeating-linear-gradient(90deg, var(--c) 0 4px, transparent 4px 7px); }
.rx__pads { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rx-pad { margin: 0; min-width: 0; }
.rx-pad canvas { width: 100%; aspect-ratio: 1; border-radius: 10px; display: block; background: var(--sensor); }
.rx-pad figcaption { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; font-size: 12px; color: var(--muted); margin-top: 5px; }
.rx-pad figcaption b { font: 600 12px var(--mono); color: var(--text); white-space: nowrap; }
.rx__plot { width: 100%; height: 158px; display: block; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.rx__read { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.rx__read div { background: var(--sand); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.rx__read dt { font-size: 11.5px; color: var(--muted); }
.rx__read dd { margin: 2px 0 0; font: 600 15px var(--mono); white-space: nowrap; transition: color 0.2s; }
.rx__read dd.is-hot { color: var(--reflex); }
.btn-mini--push { background: var(--reflex); border-color: var(--reflex); color: #fff; }
.btn-mini--push:hover { background: #b8305b; border-color: #b8305b; }
.btn-mini--push:disabled { opacity: 0.55; cursor: default; }
@media (max-width: 960px) { .rx { grid-template-columns: 1fr; } .rx__stage { min-height: 380px; } }
@media (max-width: 560px) { .rx__clock { top: 58px; left: 14px; right: auto; } .rx__status { font-size: 12.5px; } }

/* corpus matrix */
#data-matrix { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.mx { min-width: 680px; display: grid; grid-template-columns: 132px var(--cols); gap: 6px 4px; align-items: stretch; }
.mx__corner { font-size: 12.5px; color: var(--faint); font-style: italic; align-self: end; padding-bottom: 4px; }
.mx__corner--src { align-self: start; padding-top: 2px; }
.mx__head { display: grid; grid-template-rows: 46px 1fr auto; justify-items: center; align-items: end; gap: 4px; text-align: center; padding: 4px 2px; border-radius: 10px; transition: background 0.2s, opacity 0.2s; min-width: 0; cursor: default; }
.mx__pics { display: flex; gap: 4px; height: 44px; align-items: flex-end; align-self: start; }
.mx__pics img { height: 44px; width: auto; max-width: 52px; object-fit: contain; border-radius: 4px; }
.mx__head b { font-size: 13px; line-height: 1.2; }
.mx__head b span { font-weight: 500; color: var(--muted); }
.mx__head em { font-style: normal; font: 600 15px var(--sans); color: #1f3f86; }
.mx__row { display: flex; align-items: center; gap: 6px; font-size: 13.5px; cursor: default; }
.mx__row i { width: 11px; height: 11px; border-radius: 3px; background: var(--c); flex: none; }
.mx__row b { text-transform: capitalize; color: var(--c); }
.mx__row span { margin-left: auto; font: 600 12.5px var(--mono); color: var(--c); padding-right: 6px; }
.mx__cell { height: 30px; border-radius: 7px; background: #f3f1ec; border: 1px dashed #e0dbd0; transform-origin: left; transition: opacity 0.2s, transform 0.5s cubic-bezier(.2,.8,.2,1), box-shadow 0.2s; position: relative; overflow: hidden; }
.mx__cell.is-on { background: var(--c); border: 0; opacity: 0.92; }
.mx__cell.is-est { background: repeating-linear-gradient(-45deg, #bfe6cd 0 6px, #e6f5ec 6px 12px); border: 1.5px dashed var(--touch); }
.mx__cell.is-est span { position: absolute; inset: 0; display: grid; place-items: center; font: 600 11.5px var(--sans); color: #17633a; white-space: nowrap; overflow: hidden; }
#data-matrix:not(.is-in) .mx__cell.is-on, #data-matrix:not(.is-in) .mx__cell.is-est { transform: scaleX(0); }
.mx__src { font-size: 11.5px; line-height: 1.35; color: var(--muted); text-align: center; padding: 0 2px; transition: opacity 0.2s; }
.mx__head.is-hot { background: #f6f4ef; }
.mx__cell.is-hot { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--c); }
.mx__row.is-hot b { text-decoration: underline; text-underline-offset: 3px; }
.mx__src.is-hot { color: var(--text); }
.mx__note { margin-top: 12px; font-size: 12.5px; color: var(--faint); font-style: italic; }

/* hands lollipop */
.lp { display: grid; gap: 5px; margin-top: 14px; }
.lp__row { display: grid; grid-template-columns: 112px 30px 1fr; align-items: center; gap: 8px; font-size: 13.5px; cursor: default; padding: 1px 0; border-radius: 6px; }
.lp__row:hover { background: #f6f4ef; }
.lp__row.is-top .lp__name { font-weight: 700; }
.lp__name { text-align: right; color: #3a3f48; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp__dof { font: 600 11.5px/1 var(--mono); color: #fff; background: rgba(221, 122, 34, var(--a)); border-radius: 999px; padding: 4px 0; text-align: center; }
.lp__track { position: relative; height: 18px; }
.lp__bar { position: absolute; left: 0; top: 7px; height: 4px; border-radius: 2px; background: #f0c79e; width: var(--w); transition: width 0.8s cubic-bezier(.2,.8,.2,1); }
.lp__row.is-top .lp__bar { background: var(--hand); }
.lp__dot { position: absolute; top: 3px; left: calc(var(--w) - 6px); width: 12px; height: 12px; border-radius: 50%; background: var(--hand); transition: left 0.8s cubic-bezier(.2,.8,.2,1); }
.lp__track em { position: absolute; left: calc(var(--w) + 10px); top: 0; font: 500 12px/18px var(--mono); color: #3a3f48; white-space: nowrap; transition: left 0.8s cubic-bezier(.2,.8,.2,1); }
#data-hands:not(.is-in) .lp__bar { width: 0; }
#data-hands:not(.is-in) .lp__dot, #data-hands:not(.is-in) .lp__track em { left: 0; }
.lp__axis { display: grid; grid-template-columns: 112px 30px 1fr; gap: 8px; margin-top: 4px; }
.lp__axis div { position: relative; height: 36px; border-top: 1px solid var(--line); }
.lp__axis b { position: absolute; left: var(--w); top: 4px; transform: translateX(-50%); font: 400 11px var(--sans); color: var(--faint); }
.lp__axis i { position: absolute; right: 0; top: 18px; font-size: 11px; color: var(--faint); }
.lp__note { margin-top: 10px; font-size: 13px; color: #3a3f48; }

/* tactile signals */
#data-signals { display: grid; gap: 14px; margin-top: 14px; }
.sg { display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: center; }
.sg img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; background: var(--sensor); }
.sg p { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.sg p b { color: var(--text); font-size: 15px; margin-right: 4px; }
.sg__bar { display: flex; align-items: center; gap: 3px; height: 22px; }
.sg__bar i { height: 22px; width: var(--w); border-radius: 6px; transition: width 0.8s cubic-bezier(.2,.8,.2,1), filter 0.2s; cursor: default; }
.sg__bar i:hover { filter: brightness(1.08); }
.sg__robot { background: #3fae6e; } .sg__human { background: #bfe6cd; }
.sg__bar em { font: 600 13px var(--mono); color: #17633a; margin-left: 8px; white-space: nowrap; }
#data-signals:not(.is-in) .sg__bar i { width: 0; }
.sg__legend { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.sg__k { width: 22px; height: 10px; border-radius: 4px; display: inline-block; margin-left: 10px; }
.sg__k--robot { background: #3fae6e; margin-left: 0; } .sg__k--human { background: #bfe6cd; }
.data-pair .card > p { font-size: 13.5px; }

/* predictions */
.pred__grid { display: grid; grid-template-columns: 1fr 1.15fr; gap: 22px; align-items: start; }
.pred__time { font: 600 14px var(--mono); color: var(--reflex); min-width: 64px; text-align: right; }
.pv__stage { position: relative; aspect-ratio: 480 / 384; border-radius: 12px; overflow: hidden; background: #111; cursor: ew-resize; touch-action: pan-y; --wipe: 50%; }
.pv__stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pv__predwrap { position: absolute; inset: 0; clip-path: inset(0 0 0 var(--wipe)); }
.pv__pred { filter: blur(1.4px) contrast(0.94) saturate(0.95); }
.pv__stage.is-obs .pv__predwrap { filter: grayscale(1) brightness(1.2); opacity: 0.45; }
.pv__wipe { position: absolute; top: 0; bottom: 0; left: var(--wipe); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15); pointer-events: none; }
.pv__wipe::after { content: "\2194"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 28px; height: 28px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 14px; color: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); }
.pv__tag { position: absolute; top: 10px; font: 600 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.05em; padding: 5px 8px; border-radius: 999px; color: #fff; }
.pv__tag--rec { left: 10px; background: rgba(95, 101, 112, 0.85); }
.pv__tag--pred { right: 10px; background: rgba(47, 107, 219, 0.9); }
.pv__time { position: absolute; left: 10px; bottom: 10px; font: 500 12px var(--mono); color: #fff; background: rgba(0, 0, 0, 0.45); padding: 4px 8px; border-radius: 6px; }
.pt { display: grid; gap: 6px; }
.pt img { width: 100%; border-radius: 8px; display: block; background: var(--sensor); }
.pt__label { font: 600 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.05em; color: #5f6570; }
.pt__label--pred { color: #2f6bdb; margin-top: 6px; }
.pt__predwrap { position: relative; }
.pt__pred { filter: blur(1.6px); transition: opacity 0.25s; }
.pt__predwrap.is-hidden .pt__pred { opacity: 0.08; }
.pt__given { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; font-style: italic; color: var(--muted); border: 1.5px dashed #c3c7cf; border-radius: 8px; background: #f6f7f9; }
.pt__given[hidden] { display: none; }
.pred__cap { font-size: 13px; color: var(--muted); margin-top: 8px; }
.pred__note { margin-top: 12px; font-size: 12.5px; color: #b4490b; }

/* perturbation dumbbell */
#fig-perturb .chips { margin: 4px 0 14px; }
.db { display: grid; gap: 6px; }
.db__row { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 12px; font-size: 13.5px; padding: 4px 0; border-radius: 8px; cursor: default; }
.db__row:hover { background: #f6f4ef; }
.db__name { text-align: right; color: #3a3f48; }
.db__row.is-ours .db__name { font-weight: 700; color: var(--text); }
.db__track { position: relative; height: 26px; margin-right: 40px; }
.db__bar { position: absolute; top: 11px; height: 4px; border-radius: 2px; background: #d7dbe2; transition: left 0.5s, width 0.5s; }
.db__pt { position: absolute; top: 6px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; transition: left 0.5s; }
.db__pt--c { background: #6b7280; }
.db__pt--p { background: #fff; border: 3px solid #6b7280; box-sizing: border-box; }
.db__row.is-mine .db__pt--c { background: #8fb0ee; } .db__row.is-mine .db__pt--p { border-color: #8fb0ee; } .db__row.is-mine .db__bar { background: #d6e3fb; }
.db__row.is-ours .db__pt--c { background: #2f6bdb; } .db__row.is-ours .db__pt--p { border-color: #2f6bdb; } .db__row.is-ours .db__bar { background: #b7cdf5; }
.db__v { position: absolute; top: 5px; font: 500 11.5px/16px var(--mono); color: var(--muted); font-style: normal; transition: left 0.5s; white-space: nowrap; }
.db__v--c { transform: translateX(12px); }
.db__v--p { transform: translateX(calc(-100% - 12px)); }
.db__axis { display: grid; grid-template-columns: 150px 1fr; gap: 12px; }
.db__axis div { position: relative; height: 24px; border-top: 1px solid var(--line); margin-right: 40px; }
.db__axis b { position: absolute; top: 4px; transform: translateX(-50%); font: 400 11px var(--sans); color: var(--faint); }
.db__legend { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.db__k { width: 12px; height: 12px; border-radius: 50%; display: inline-block; margin-left: 10px; }
.db__k--c { background: #6b7280; margin-left: 0; } .db__k--p { border: 3px solid #6b7280; box-sizing: border-box; }
.db__legend .projtag { margin-left: auto; }
@media (max-width: 860px) {
  .pred__grid { grid-template-columns: 1fr; }
  .db__row { grid-template-columns: 96px 1fr; } .db__axis { grid-template-columns: 96px 1fr; }
  .lp__row, .lp__axis { grid-template-columns: 92px 28px 1fr; }
  .scrub { width: 120px; }
}

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1060px) {
  .touchlab__encoder { grid-template-columns: 1fr; }
  .cards--3, .formats { grid-template-columns: 1fr; }
  .hud { width: 250px; top: 84px; }
  .hud__grid dd { font-size: 15.5px; }
}
@media (max-width: 1060px) {
  .handlab { grid-template-columns: 1fr; }
  .handlab__stage { min-height: 520px; }
}
@media (max-width: 860px) {
  .hud { display: none; }
  .slots { grid-template-columns: 1fr; }
  .slots__hand { position: static; max-width: 340px; margin: 0 auto; }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .nav__links { display: none; }
  .nav__cta { margin-left: auto; }
  .stats__grid { grid-template-columns: 1fr 1fr; }
  .stat { padding: 22px 12px 20px 0; }
  .stat + .stat { padding-left: 0; border-left: 0; }
  .stat:nth-child(2n) { padding-left: 16px; border-left: 1px solid var(--line); }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .thesis__body { grid-template-columns: 1fr; gap: 16px; }
  .touchlab__inputs { gap: 10px; }
  .pad figcaption span { display: none; }
  .readout { grid-template-columns: 1fr; }
  .cards--2 { grid-template-columns: 1fr; }
  .strip { grid-template-columns: 38px repeat(24, 1fr); gap: 2px; }
  .cell { height: 20px; border-radius: 3px; }
  .handlab__stage { min-height: 440px; }
  .quick { grid-template-columns: 1fr; }
  .eq { grid-template-columns: 1fr 1fr 1fr; row-gap: 14px; }
  .eq__track { height: 90px; }
  .preset { padding: 6px 11px; font-size: 12.5px; }
  .tiers { height: auto; flex-direction: column; }
  .tier { flex: none; height: auto; padding: 8px 12px; }
  .tiers__legend { grid-template-columns: 1fr; }
  .island { grid-template-columns: 110px 1fr 52px; }
  .bars__row { grid-template-columns: 1fr; gap: 4px; }
  .hero__subtitle br { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .pulse, .hero__scroll span { animation: none; }
}

/* ================================================================== dark theme
   Same navy family as the hero and the tactile maps. Light stays the default stylesheet;
   everything below only applies with <html data-theme="dark">. */
[data-theme="dark"] {
  color-scheme: dark;
  --paper: #080a17;
  --sand: #0c0f20;
  --surface: #11142a;
  --surface-2: #181c37;
  --surface-3: #20254a;
  --line: #232843;
  --line-2: #323856;
  --text: #e8eaf2;
  --muted: #a3a9b8;
  --faint: #7c8396;
  --touch-soft: rgba(46, 158, 91, 0.14);
  --hand-soft: rgba(221, 122, 34, 0.13);
  --motion-soft: rgba(47, 107, 219, 0.16);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.025) inset, 0 22px 44px -26px rgba(0, 0, 0, 0.75);
  --dg-future: #1a1e38;
  --dg-line: #323856;
}
[data-theme="dark"] .nav.is-solid { background: rgba(8, 10, 23, 0.8); color: var(--text); box-shadow: 0 1px 0 var(--line); }
[data-theme="dark"] .thesis__body { color: #c3c8d4; }

/* surfaces */
[data-theme="dark"] :is(.stats__grid, .figure, .format, .slots__hand-frame, .strip-block, .frame, .card, .datachart,
  .chartcard, .tablecard, .hl-block, .dg-fig, .rx__plot) { background: var(--surface); border-color: var(--line); }
[data-theme="dark"] .stats__grid { box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 24px 60px -24px rgba(0, 0, 0, 0.8); }
[data-theme="dark"] .bib { background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
[data-theme="dark"] .touchlab__wires path:not(.is-on) { stroke: rgba(255, 255, 255, 0.16); }
[data-theme="dark"] .touchlab__verdict { color: #c3c8d4; }
[data-theme="dark"] :is(.readout dd.is-wrong, .touchlab__verdict.is-bad b) { color: #ff8f8f; }
[data-theme="dark"] .pad:not(.is-read) canvas { box-shadow: 0 0 0 1px var(--line-2), 0 18px 36px -20px rgba(0, 0, 0, 0.8); }
[data-theme="dark"] .tokens { box-shadow: inset 0 0 0 1px var(--line-2); }
[data-theme="dark"] .tip { background: var(--surface-3); box-shadow: 0 0 0 1px var(--line-2), 0 10px 28px rgba(0, 0, 0, 0.5); }

/* controls */
[data-theme="dark"] .chip { background: var(--surface-2); border-color: var(--line-2); color: var(--text); }
[data-theme="dark"] .chip:hover { border-color: var(--faint); }
[data-theme="dark"] .chip[aria-checked="true"] { background: var(--text); border-color: var(--text); color: var(--paper); }
[data-theme="dark"] .chip[aria-checked="true"] small { color: rgba(8, 10, 23, 0.55); }
[data-theme="dark"] .preset { background: rgba(17, 20, 42, 0.86); border-color: var(--line-2); color: var(--text); }
[data-theme="dark"] .preset:hover { border-color: var(--faint); }
[data-theme="dark"] .preset.is-on { background: var(--text); color: var(--paper); border-color: var(--text); }
[data-theme="dark"] .seg--light { background: var(--surface-3); border-color: var(--line); }
[data-theme="dark"] .seg--light button { color: var(--muted); }
[data-theme="dark"] .seg--light button[aria-checked="true"] { background: #2f3660; color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
[data-theme="dark"] .btn-mini { background: var(--surface-2); border-color: var(--line-2); color: var(--text); }
[data-theme="dark"] .btn-mini:hover { border-color: var(--faint); }
[data-theme="dark"] .btn-mini--push { background: var(--reflex); border-color: var(--reflex); color: #fff; }
[data-theme="dark"] .quick input[type="range"]::-webkit-slider-runnable-track { background: linear-gradient(90deg, var(--c) 0 var(--p, 0%), var(--surface-3) var(--p, 0%)); }
[data-theme="dark"] .quick input[type="range"]::-moz-range-track { background: var(--surface-3); }
[data-theme="dark"] .quick input[type="range"]::-webkit-slider-thumb { background: var(--surface); }
[data-theme="dark"] .quick input[type="range"]::-moz-range-thumb { background: var(--surface); }

/* tags and notes */
[data-theme="dark"] .tag { background: rgba(210, 63, 109, 0.16); }
[data-theme="dark"] .projtag { background: rgba(180, 73, 11, 0.16); color: #f0a868; border-color: rgba(240, 168, 104, 0.45); }
[data-theme="dark"] .dg-tag { background: var(--surface-2); border-color: var(--line-2); }
[data-theme="dark"] .dg-tag--frozen { color: #8fb0ff; border-color: rgba(59, 111, 216, 0.45); }
[data-theme="dark"] .dg-tag--trained { color: #f0a868; border-color: rgba(226, 133, 42, 0.45); }
[data-theme="dark"] :is(.dg-tag--design, .dg-tag--inference) { border-color: rgba(210, 63, 109, 0.5); }
[data-theme="dark"] .dg-panel { color: #c3c8d4; }
[data-theme="dark"] .callout { border-color: rgba(221, 122, 34, 0.35); color: #e8d4c0; }
[data-theme="dark"] .hl-note code { background: var(--surface-3); }
[data-theme="dark"] .pred__note { color: #f0a868; }

/* hatched "nothing here" fills */
[data-theme="dark"] :is(.cell.is-empty, .frame__seg.is-spare, .eq__col.is-off .eq__track) { background: repeating-linear-gradient(-45deg, #151931 0 3px, #20254a 3px 5px); }
[data-theme="dark"] :is(.legend .legend__empty::before, .eq__legend-off) { background: repeating-linear-gradient(-45deg, #151931 0 2px, #2a3052 2px 4px); }
[data-theme="dark"] .cell { background: var(--c, var(--surface-3)); }
[data-theme="dark"] :is(.cell.is-hot) { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--text); }
[data-theme="dark"] .eq__track { background: var(--surface-3); }
[data-theme="dark"] .touchbar__track { background: var(--surface-3); }

/* charts and figures drawn in HTML */
[data-theme="dark"] .chart .grid line { stroke: var(--line); }
[data-theme="dark"] .chart .dot { stroke: var(--surface); }
[data-theme="dark"] .chart .cross { stroke: var(--line-2); }
[data-theme="dark"] .bench td { border-bottom-color: var(--line); }
[data-theme="dark"] .bench tr.is-ours td { background: rgba(47, 107, 219, 0.14); }
[data-theme="dark"] .mx__cell { background: var(--surface-2); border-color: var(--line-2); }
[data-theme="dark"] .mx__cell.is-on { background: var(--c); }
[data-theme="dark"] .mx__cell.is-est { background: repeating-linear-gradient(-45deg, rgba(46, 158, 91, 0.42) 0 6px, rgba(46, 158, 91, 0.14) 6px 12px); }
[data-theme="dark"] .mx__cell.is-est span { color: #a6e8c4; }
[data-theme="dark"] .mx__cell.is-hot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--c); }
[data-theme="dark"] .mx__head em { color: #9dbbff; }
[data-theme="dark"] :is(.mx__head.is-hot, .lp__row:hover, .db__row:hover) { background: var(--surface-2); }
[data-theme="dark"] :is(.lp__name, .lp__track em, .lp__note, .db__name) { color: #c3c8d4; }
[data-theme="dark"] .lp__bar { background: rgba(221, 122, 34, 0.4); }
[data-theme="dark"] .sg__human, [data-theme="dark"] .sg__k--human { background: rgba(127, 215, 166, 0.38); }
[data-theme="dark"] .sg__bar em { color: #7fd7a6; }
[data-theme="dark"] .db__bar { background: var(--line-2); }
[data-theme="dark"] .db__pt--c { background: #8b93a5; }
[data-theme="dark"] .db__pt--p { background: var(--surface); border-color: #8b93a5; }
[data-theme="dark"] .db__row.is-mine .db__bar { background: rgba(143, 176, 238, 0.32); }
[data-theme="dark"] .db__row.is-ours .db__bar { background: rgba(47, 107, 219, 0.55); }
[data-theme="dark"] .db__row.is-ours .db__name { color: var(--text); }
[data-theme="dark"] .db__k--c { background: #8b93a5; }
[data-theme="dark"] .db__k--p { border-color: #8b93a5; }
[data-theme="dark"] .pt__given { background: var(--surface-2); border-color: var(--line-2); }

/* 3D stages */
[data-theme="dark"] .handlab__stage { background: radial-gradient(120% 90% at 50% 30%, #1c2244 0%, #111530 55%, #0a0c1d 100%); border-color: var(--line); }
[data-theme="dark"] .rx__stage { background: radial-gradient(120% 90% at 50% 28%, #1c2244 0%, #0c0f24 100%); }
[data-theme="dark"] :is(.rx__status, .rx__clock) { background: rgba(17, 20, 42, 0.9); box-shadow: 0 0 0 1px var(--line); }
[data-theme="dark"] .rx__status { color: color-mix(in srgb, var(--c, #2e9e5b) 62%, #fff); }
[data-theme="dark"] .rx__read div { background: var(--surface-2); }
[data-theme="dark"] .hl-pane--base .hl-pane__tag { background: var(--surface-2); color: var(--muted); border-color: var(--line-2); }
[data-theme="dark"] .hl-pane--ours .hl-pane__head b, [data-theme="dark"] .hl-pane--ours small { color: #7fd7a6; }
[data-theme="dark"] .hl-pane--base .hl-pane__head b { color: #e3a3b9; }
[data-theme="dark"] .hl-pane--ours { box-shadow: 0 14px 34px -18px rgba(46, 158, 91, 0.5), inset 0 0 0 4px rgba(255, 255, 255, 0.03); }

/* SVG figures: the figure scripts write light colours as attributes; map them to the dark set */
[data-theme="dark"] .dg :not(text)[fill="#fff"], [data-theme="dark"] .dg [fill="#fafaf8"] { fill: var(--surface-2); }
[data-theme="dark"] .dg :is([fill="#f4f2ee"], [fill="#f3f1ec"], [fill="#f2efe9"], [fill="#f1eee8"]) { fill: var(--surface-3); }
[data-theme="dark"] .dg [fill="#dcd7cc"] { fill: #2c3254; }
[data-theme="dark"] .dg [fill="#15171c"] { fill: var(--text); }
[data-theme="dark"] .dg [fill="#5f6570"] { fill: var(--muted); }
[data-theme="dark"] .dg :is([fill="#3a3f48"], [fill="#3a3f4b"], [fill="#2a2f39"]) { fill: #c3c8d4; }
[data-theme="dark"] .dg [fill="#8b9099"] { fill: var(--faint); }
[data-theme="dark"] .dg :is([fill="#1f3f86"], [fill="#2c55ad"]) { fill: #9dbbff; }
[data-theme="dark"] .dg :is([fill="#17633a"], [fill="#1f7a46"]) { fill: #7fd7a6; }
[data-theme="dark"] .dg [fill="#4d3a86"] { fill: #c3b2ff; }
[data-theme="dark"] .dg :is([fill="#8a4610"], [fill="#a35a14"]) { fill: #f2b27a; }
[data-theme="dark"] .dg :is([fill="#8e2f50"], [fill="#8e1f45"]) { fill: #ff9fbf; }
[data-theme="dark"] .dg [fill="#1c2f66"] { fill: #6f8fe0; }
[data-theme="dark"] .dg [fill="#e3ecfc"] { fill: rgba(59, 111, 216, 0.18); }
[data-theme="dark"] .dg [fill="#c9dbfb"] { fill: rgba(59, 111, 216, 0.34); }
[data-theme="dark"] .dg [fill="#fdeedd"] { fill: rgba(226, 133, 42, 0.16); }
[data-theme="dark"] .dg [fill="#fbd9b5"] { fill: rgba(226, 133, 42, 0.32); }
[data-theme="dark"] .dg [fill="#e0f3e7"] { fill: rgba(46, 158, 91, 0.16); }
[data-theme="dark"] .dg [fill="#bfe6cd"] { fill: rgba(46, 158, 91, 0.32); }
[data-theme="dark"] .dg :is([fill="#f3faf6"], [fill="#f6fbf8"]) { fill: rgba(46, 158, 91, 0.07); }
[data-theme="dark"] .dg [fill="#efe9fb"] { fill: rgba(123, 92, 196, 0.2); }
[data-theme="dark"] .dg :is([fill="#fce6ee"], [fill="#fbe4ec"]) { fill: rgba(210, 63, 109, 0.17); }
[data-theme="dark"] .dg [fill="#eef0f3"] { fill: rgba(139, 147, 161, 0.16); }
[data-theme="dark"] .dg :is([stroke="#b9bfca"], [stroke="#c3c7cf"], [stroke="#c9c4b8"], [stroke="#d6d0c4"], [stroke="#e3e0d8"], [stroke="#dcd7cc"]) { stroke: var(--line-2); }
[data-theme="dark"] .dg [stroke="#eeebe4"] { stroke: var(--line); }
[data-theme="dark"] .dg [stroke="#15171c"] { stroke: var(--text); }
[data-theme="dark"] .dg .dn.is-hot .gate { fill: rgba(46, 158, 91, 0.28); }
[data-theme="dark"] .dg .dn:hover .dn-box, [data-theme="dark"] .dg .dn.is-hot .dn-box { filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.55)); }

/* light / dark switch in the nav */
.theme { display: inline-flex; align-items: center; gap: 2px; padding: 3px; margin-left: 4px; border-radius: 999px; border: 1px solid currentColor; border-color: color-mix(in srgb, currentColor 28%, transparent); }
.theme button { display: grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 50%; background: transparent; color: inherit; opacity: 0.55; cursor: pointer; transition: background 0.2s, opacity 0.2s; }
.theme button:hover { opacity: 0.9; }
.theme button[aria-checked="true"] { opacity: 1; background: color-mix(in srgb, currentColor 16%, transparent); }
.theme svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* page version switch (v1 = frozen full page in v1/, v2 = current page) */
.ver { display: inline-flex; align-items: center; gap: 2px; padding: 3px; margin-left: -12px; border-radius: 999px; border: 1px solid color-mix(in srgb, currentColor 28%, transparent); font: 500 12px/1 var(--mono); }
.ver > * { display: grid; place-items: center; min-width: 32px; height: 26px; padding: 0 8px; border-radius: 999px; color: inherit; text-decoration: none; opacity: 0.55; transition: background 0.2s, opacity 0.2s; }
.ver a:hover { opacity: 0.9; }
.ver [aria-current] { opacity: 1; background: color-mix(in srgb, currentColor 16%, transparent); }
[data-theme="dark"] .dg stop[stop-color="#c9dbfb"] { stop-color: #23345f; }
[data-theme="dark"] .dg stop[stop-color="#fbd9b5"] { stop-color: #4a3324; }
[data-theme="dark"] .dg stop[stop-color="#bfe6cd"] { stop-color: #1d4a35; }
[data-theme="dark"] .hero::after { background: linear-gradient(180deg, rgba(8, 10, 23, 0) 0%, var(--paper) 92%); }
[data-theme="dark"] .island i { background: #4f5784; }
