/* ==========================================================================
   walterdych.github.io — shared styles
   Accent colors follow the figure conventions used in the research:
   rust = advance planning / gesture stroke, blue = incremental planning / posture.
   ========================================================================== */

:root {
  color-scheme: dark;

  --bg: #0d1012;
  --bg-raised: #111518;
  --surface: #151a1d;
  --surface-2: #1b2226;
  --line: #242c31;
  --line-strong: #38444b;

  --ink: #e9ebe8;
  --ink-2: #bcc4c6;
  --muted: #88949a;

  --accent: #e8824f;
  --accent-strong: #f09a6c;
  --accent-ink: #160c06;
  --accent-wash: rgba(232, 130, 79, 0.11);
  --blue: #66a6e4;
  --blue-wash: rgba(102, 166, 228, 0.12);
  --teal: #63bba8;

  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --wrap: 1120px;
  --gutter: 24px;
  --radius: 6px;
  --header-h: 60px;
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f5f4f0;
  --bg-raised: #efeee9;
  --surface: #fbfaf7;
  --surface-2: #f0efea;
  --line: #dddbd3;
  --line-strong: #bdbab0;

  --ink: #15191b;
  --ink-2: #3b4347;
  --muted: #5d676c;

  --accent: #a94a22;
  --accent-strong: #8f3d1b;
  --accent-ink: #fff8f3;
  --accent-wash: rgba(181, 83, 42, 0.10);
  --blue: #2f6aa8;
  --blue-wash: rgba(58, 123, 191, 0.10);
  --teal: #2b7f6e;
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, video { max-width: 100%; display: block; }

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

p { margin: 0 0 1em; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 0.18em;
  transition: color 0.15s, text-decoration-color 0.15s;
}
a:hover { color: var(--accent-strong); text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection { background: var(--accent); color: var(--accent-ink); }

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 200;
  padding: 10px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 500;
}
.skip-link:focus { top: 12px; color: var(--accent-ink); }

.mono {
  font-family: var(--font-mono);
  font-size: 0.78em;
  letter-spacing: 0.02em;
}

.eyebrow {
  margin: 0 0 18px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow b { color: var(--accent); font-weight: 500; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  color: var(--ink);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover { color: var(--ink); }
.brand svg { width: 22px; height: 22px; flex: none; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-links a {
  padding: 6px 10px;
  border-radius: 4px;
  color: var(--ink-2);
  font-size: 14.5px;
  text-decoration: none;
  white-space: nowrap;
}
.nav-links a:hover { color: var(--ink); background: var(--surface-2); }
.nav-links a[aria-current="page"] { color: var(--accent); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.icon-btn:hover { border-color: var(--line-strong); color: var(--ink); background: var(--surface); }
.icon-btn svg { width: 17px; height: 17px; }

.theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }

.nav-toggle { display: none; }

@media (max-width: 860px) {
  .nav-toggle { display: inline-grid; }
  .nav-links {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px var(--gutter) 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }
  .nav-links.is-open { display: flex; }
  .nav-links a {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    font-size: 16px;
  }
  .nav-links a:last-child { border-bottom: 0; }
  .nav-links a:hover { background: transparent; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { color: var(--ink); border-color: var(--muted); background: var(--surface); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--accent-ink);
}
.btn .arrow { transition: transform 0.15s; }
.btn:hover .arrow { transform: translateX(3px); }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  letter-spacing: 0.01em;
  text-decoration: none;
}
.text-link .arrow { transition: transform 0.15s; }
.text-link:hover .arrow { transform: translateX(3px); }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  padding: 72px 0 64px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 85%);
  mask-image: linear-gradient(to bottom, #000 0%, transparent 85%);
  opacity: 0.55;
  pointer-events: none;
}

.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 56px;
  align-items: center;
}

.hero h1 {
  font-size: clamp(2.15rem, 4.4vw, 3.35rem);
  letter-spacing: -0.028em;
  line-height: 1.06;
}
.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero-lede {
  margin: 24px 0 0;
  max-width: 34em;
  color: var(--ink-2);
  font-size: 1.06rem;
}
.hero-lede strong { color: var(--ink); font-weight: 500; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

/* ---------- Figure panel ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.figure { margin: 0; }
.figure-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.figure-head span:last-child { text-align: right; }
.figure-body { padding: 8px 10px 4px; overflow-x: auto; }
.figure-body svg { width: 100%; height: auto; }
@media (max-width: 620px) {
  .figure-body svg { min-width: 560px; }
}
.figure figcaption {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}
.figure figcaption b { color: var(--ink-2); font-weight: 500; }

/* Point-light talker (hero figure) */
.talker .figure-head { align-items: center; padding-block: 7px; }
.talker-meta {
  position: absolute;
  top: 10px;
  left: 14px;
  z-index: 1;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--muted);
  pointer-events: none;
}
.talker-toggle {
  min-width: 58px;
  padding: 4px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}
.talker-toggle:hover { border-color: var(--muted); color: var(--ink); }
.talker-toggle[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}
.talker-stage { position: relative; }
.talker canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 13;
  cursor: grab;
  touch-action: pan-y;
  opacity: 0;
  transition: opacity 0.4s;
}
.talker.is-ready canvas { opacity: 1; }
@media (max-width: 620px) {
  .talker canvas { aspect-ratio: 1 / 1; }
  .talker-meta { font-size: 10px; letter-spacing: 0.02em; }
}
.talker canvas.is-dragging { cursor: grabbing; }
.talker-fallback {
  display: none;
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 24px;
  place-content: center;
  text-align: center;
  color: var(--muted);
  font-size: 14.5px;
}
.talker.is-failed .talker-fallback { display: grid; }
.talker-words {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 0.6em;
  min-height: 3.1em;
  margin: 0;
  padding: 13px 14px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--line-strong);
}
.talker-words span { transition: color 0.12s; }
.talker-words .is-said { color: var(--ink-2); }
.talker-words .is-now { color: var(--accent); }

/* ---------- Readout strip ---------- */

.readout {
  border-bottom: 1px solid var(--line);
  background: var(--bg-raised);
}
.readout-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.readout-item {
  padding: 22px 20px 22px 0;
  border-left: 1px solid var(--line);
  padding-left: 20px;
}
.readout-item:first-child { border-left: 0; padding-left: 0; }
.readout-value {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.1;
  color: var(--ink);
}
.readout-label {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.4;
}

/* ---------- Sections ---------- */

.section {
  padding: 88px 0;
  border-bottom: 1px solid var(--line);
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
  margin-bottom: 44px;
}
.section-num {
  display: block;
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-num b { color: var(--accent); font-weight: 500; }
.section-head h2 {
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  letter-spacing: -0.022em;
  max-width: 22em;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 56px;
  align-items: start;
}
.prose { color: var(--ink-2); max-width: 36em; }
.prose strong { color: var(--ink); font-weight: 500; }
.prose .text-link { margin-top: 12px; }

/* Hypotheses */
.hyp-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.hyp {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 4px 14px;
  padding: 20px 20px 20px 16px;
  border-top: 1px solid var(--line);
}
.hyp:first-child { border-top: 0; }
.hyp-glyph {
  grid-row: span 3;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
}
.hyp-glyph svg { width: 20px; height: 20px; }
.hyp-primary .hyp-glyph {
  border-color: var(--accent);
  background: var(--accent-wash);
  color: var(--accent);
}
.hyp h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  font-size: 1.08rem;
  letter-spacing: -0.01em;
}
.hyp p { margin: 0; color: var(--ink-2); font-size: 15.5px; line-height: 1.5; }
.hyp .hyp-pred {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted);
}
.hyp-primary .hyp-pred { color: var(--accent); }

.tag {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.5;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.tag-accent { border-color: var(--accent); color: var(--accent); }

/* Signal table */
.signals {
  width: 100%;
  border-collapse: collapse;
  border-top: 1px solid var(--line-strong);
}
.signals th,
.signals td {
  padding: 16px 20px 16px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 15.5px;
  line-height: 1.45;
}
.signals thead th {
  padding-block: 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.signals tbody th {
  width: 24%;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}
.signals tbody th .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--muted);
  vertical-align: 0.05em;
}
.signals td { color: var(--ink-2); }
.signals td.instrument { width: 30%; font-family: var(--font-mono); font-size: 13.5px; color: var(--muted); }
.signals td:last-child { padding-right: 0; }
.dot-accent { background: var(--accent) !important; }
.dot-blue { background: var(--blue) !important; }
.dot-teal { background: var(--teal) !important; }
.dot-ink { background: var(--ink-2) !important; }

/* Work cards */
.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.18s, background 0.18s, transform 0.18s;
}
a.card:hover {
  color: inherit;
  border-color: var(--accent);
  background: var(--surface-2);
}
.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.card-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
  line-height: 1.5;
}
.card-glyph {
  flex: none;
  width: 104px;
  height: 56px;
  color: var(--muted);
}
.card-glyph .g-line { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.card-glyph .g-accent { stroke: var(--accent); }
.card-glyph .g-blue { stroke: var(--blue); }
.card-glyph .g-fill { fill: currentColor; }
.card-glyph .g-fill-accent { fill: var(--accent); }
.card-glyph .g-fill-blue { fill: var(--blue); }
.card h3 { font-size: 1.28rem; letter-spacing: -0.015em; margin-bottom: 8px; }
.card p { color: var(--ink-2); font-size: 15.5px; line-height: 1.5; }
.card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.card-foot .text-link { margin-left: auto; color: var(--accent); }
a.card:hover .arrow { transform: translateX(3px); }
.card .arrow { transition: transform 0.15s; }

.card-feature { grid-column: 1 / -1; }

/* Status list */
.status {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line-strong);
}
.status li {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15.5px;
  color: var(--ink-2);
}
.status .state {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 3px;
}
.status .state-done { color: var(--teal); }
.status .state-now { color: var(--accent); }

/* Publication list */
.pubs {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line-strong);
}
.pub {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.pub-year {
  font-family: var(--font-mono);
  font-size: 13px;
  white-space: nowrap;
  color: var(--muted);
  padding-top: 3px;
}
.pub-title { color: var(--ink); font-weight: 500; line-height: 1.4; }
.pub-detail { margin-top: 4px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.pub-detail .me { color: var(--ink-2); font-weight: 500; }
.pub-detail em { font-style: italic; }

/* About / contact */
.contact-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line-strong);
}
.contact-list li {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15.5px;
}
.contact-list .k {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 3px;
}
.contact-list a { overflow-wrap: anywhere; }

/* ---------- Footer ---------- */

.site-footer { padding: 36px 0 44px; }
.footer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px 32px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.footer-links a { color: var(--ink-2); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .hero-grid > div:first-child { max-width: 44em; }
}

@media (max-width: 960px) {
  .hero { padding: 48px 0 48px; }
  .split { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .section { padding: 64px 0; }
  .section-head { grid-template-columns: minmax(0, 1fr); align-items: start; margin-bottom: 32px; }
}

@media (max-width: 720px) {
  :root { --gutter: 16px; }
  body { font-size: 16px; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .readout-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .readout-item { border-left: 0; padding: 18px 12px 18px 0; }
  .readout-item:nth-child(n + 3) { border-top: 1px solid var(--line); }

  .signals thead { display: none; }
  .signals, .signals tbody, .signals tr, .signals th, .signals td { display: block; width: auto; }
  .signals tr { padding: 16px 0; border-bottom: 1px solid var(--line); }
  .signals th, .signals td { padding: 0; border: 0; }
  .signals tbody th { width: auto; margin-bottom: 4px; }
  .signals td.instrument { width: auto; margin-bottom: 6px; }

  .pub, .status li, .contact-list li { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .card-glyph { width: 84px; height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* ==========================================================================
   Inner pages
   ========================================================================== */

/* Chart series colors, checked for separation and contrast on each surface */
:root {
  --series-gesture: #db7440;
  --series-speech: #5795d6;
  --series-neutral: #9aa5aa;
}
:root[data-theme="light"] {
  --series-gesture: #a94a22;
  --series-speech: #2f6aa8;
  --series-neutral: #6c767b;
}

/* ---------- Page head ---------- */

.page-head {
  position: relative;
  padding: 72px 0 0;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.page-head::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 80%);
  mask-image: linear-gradient(to bottom, #000 0%, transparent 80%);
  opacity: 0.55;
  pointer-events: none;
}
.page-head > .wrap { position: relative; }
.page-head h1 {
  max-width: 16em;
  font-size: clamp(2.3rem, 5vw, 3.7rem);
  letter-spacing: -0.03em;
  line-height: 1.04;
}
.page-head .lede {
  max-width: 36em;
  margin: 22px 0 0;
  color: var(--ink-2);
  font-size: 1.18rem;
  line-height: 1.55;
}

.facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 52px 0 0;
  border-top: 1px solid var(--line);
}
.facts > div { padding: 18px 20px 22px; border-left: 1px solid var(--line); }
.facts > div:first-child { padding-left: 0; border-left: 0; }
.facts dt {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.facts dd { margin: 6px 0 0; font-size: 15px; line-height: 1.45; color: var(--ink); }

/* ---------- Article with a side index ---------- */

.article {
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr);
  gap: 64px;
}
.toc {
  position: sticky;
  top: calc(var(--header-h) + 28px);
  align-self: start;
  margin-top: 76px;
  padding-bottom: 40px;
}
.toc-title {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.toc a {
  display: block;
  padding: 6px 0 6px 14px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  text-decoration: none;
}
.toc a:hover { color: var(--ink); border-left-color: var(--accent); }

.article-body { min-width: 0; }
.article-body > section { padding: 72px 0; border-bottom: 1px solid var(--line); }
.article-body > section:last-child { border-bottom: 0; }
.article-body h2 {
  max-width: 20em;
  margin-bottom: 26px;
  font-size: clamp(1.6rem, 2.7vw, 2.15rem);
  letter-spacing: -0.022em;
}
.article-body h3 { margin: 40px 0 12px; font-size: 1.18rem; letter-spacing: -0.01em; }
.article-body .prose { max-width: 40em; }
.article-body .prose + .prose { margin-top: 1em; }
.article-body .figure { margin: 36px 0 0; }
.article-body .hyp-list { max-width: 44em; }

.steps {
  max-width: 42em;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  border-top: 1px solid var(--line-strong);
}
.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 15.5px;
  line-height: 1.5;
}
.steps li::before {
  content: counter(step, decimal-leading-zero);
  padding-top: 2px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--accent);
}
.steps strong { color: var(--ink); font-weight: 500; }

.formula {
  max-width: 44em;
  margin: 24px 0 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
}
.formula small { display: block; margin-top: 6px; font-size: 12.5px; color: var(--muted); white-space: normal; }

.data-table {
  width: 100%;
  margin-top: 28px;
  border-collapse: collapse;
  border-top: 1px solid var(--line-strong);
  font-size: 15px;
  line-height: 1.45;
}
.data-table th,
.data-table td {
  padding: 13px 18px 13px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  color: var(--ink-2);
}
.data-table thead th {
  padding-block: 9px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.data-table tbody th { font-weight: 500; color: var(--ink); }
.data-table .num {
  font-family: var(--font-mono);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--ink);
}
.data-table td:last-child, .data-table th:last-child { padding-right: 0; }
.data-table .is-default th, .data-table .is-default td { background: var(--accent-wash); }
.data-table .is-default th { box-shadow: inset 2px 0 0 var(--accent); padding-left: 12px; }
.table-scroll { overflow-x: auto; }

.tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.tile { padding: 18px 18px 20px; border-left: 1px solid var(--line); }
.tile:first-child { border-left: 0; }
.tile-value {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.55rem;
  font-weight: 500;
  line-height: 1.1;
  color: var(--ink);
}
.tile-label { display: block; margin-top: 6px; font-size: 13.5px; line-height: 1.4; color: var(--muted); }

.findings {
  margin: 32px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line-strong);
}
.findings li {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 8px 32px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.findings h3 { margin: 0; font-size: 1.05rem; line-height: 1.35; letter-spacing: -0.005em; }
.findings p { margin: 0; color: var(--ink-2); font-size: 15.5px; line-height: 1.55; }

.note {
  max-width: 44em;
  margin-top: 28px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.55;
}
.note-label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.key {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.key-gesture { background: var(--series-gesture); }
.key-speech { background: var(--series-speech); }

.refs {
  max-width: 46em;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}
.refs li { padding: 7px 0 7px 1.6em; text-indent: -1.6em; }
.refs em { font-style: italic; }

/* ---------- Charts ---------- */

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  padding: 14px 16px 0;
  font-size: 13.5px;
  color: var(--ink-2);
}
.chart-legend span { display: inline-flex; align-items: center; gap: 8px; }
.chart-legend i { display: inline-block; width: 18px; height: 2px; border-radius: 1px; background: var(--muted); }
.chart-legend i.dot { width: 9px; height: 9px; border-radius: 50%; }
.chart-legend .s-gesture { background: var(--series-gesture); }
.chart-legend .s-speech { background: var(--series-speech); }
.chart-legend .s-neutral { background: var(--series-neutral); }

.chart-unit {
  margin: 0;
  padding: 12px 16px 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.chart-body { padding: 4px 12px 10px; }
.chart-body svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart-failed { padding: 32px 16px; color: var(--muted); font-size: 14.5px; }
.chart-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chart-pair > div + div { border-left: 1px solid var(--line); }
.chart-pair h3 {
  margin: 0;
  padding: 14px 16px 0;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
}

.c-grid { stroke: var(--line); stroke-width: 1; }
.c-axis { stroke: var(--line-strong); stroke-width: 1; }
.c-ref { stroke: var(--line-strong); stroke-width: 1; }
.c-hair { stroke: var(--muted); stroke-width: 1; pointer-events: none; }
.c-tick { font-family: var(--font-mono); font-size: 11px; fill: var(--muted); }
.c-title { font-family: var(--font-sans); font-size: 12.5px; fill: var(--muted); }
.c-label { font-family: var(--font-sans); font-size: 12.5px; fill: var(--ink-2); }
.c-label-strong { font-family: var(--font-mono); font-size: 12px; font-weight: 500; fill: var(--ink); }
.c-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.c-line-halo { stroke: var(--surface); stroke-width: 5; }
.c-line.s-gesture { stroke: var(--series-gesture); }
.c-line.s-speech { stroke: var(--series-speech); }
.c-dot { stroke: var(--surface); stroke-width: 2; }
.c-point { stroke: var(--surface); stroke-width: 1; fill-opacity: 0.8; }
.c-dot.s-gesture, .c-point.s-gesture { fill: var(--series-gesture); }
.c-dot.s-speech, .c-point.s-speech { fill: var(--series-speech); }
.c-dot.s-neutral { fill: var(--series-neutral); }
.c-ring { fill: none; stroke: var(--ink); stroke-width: 1.5; pointer-events: none; }

.chart-tip {
  position: absolute;
  z-index: 5;
  min-width: 150px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.28);
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
  pointer-events: none;
  white-space: nowrap;
}
.chart-tip[hidden] { display: none; }
.tip-head { margin-bottom: 5px; font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.tip-row { display: flex; align-items: center; gap: 8px; }
.tip-row b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.tip-key { flex: none; width: 12px; height: 2px; border-radius: 1px; background: var(--muted); }
.tip-key.dot { width: 8px; height: 8px; margin: 0 2px; border-radius: 50%; }
.tip-key.none { background: transparent; }
.tip-key.s-gesture { background: var(--series-gesture); }
.tip-key.s-speech { background: var(--series-speech); }
.tip-key.s-neutral { background: var(--series-neutral); }

.chart-data { border-top: 1px solid var(--line); }
.chart-data summary {
  padding: 11px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
  cursor: pointer;
}
.chart-data summary:hover { color: var(--ink); }
.chart-data .table-scroll { padding: 0 16px 14px; }
.chart-data .data-table { margin-top: 0; font-size: 14px; }
.chart-data .data-table th, .chart-data .data-table td { padding-block: 8px; }

/* ---------- Inner pages, responsive ---------- */

@media (max-width: 1040px) {
  .article { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
}

@media (max-width: 720px) {
  .page-head { padding-top: 48px; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 36px; }
  .facts > div { padding: 14px 12px 16px 0; border-left: 0; border-bottom: 1px solid var(--line); }
  .facts > div:nth-last-child(-n + 2) { border-bottom: 0; }
  .article-body > section { padding: 56px 0; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { border-left: 0; }
  .tile:nth-child(even) { border-left: 1px solid var(--line); }
  .tile:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .findings li { grid-template-columns: minmax(0, 1fr); }
  .chart-pair { grid-template-columns: minmax(0, 1fr); }
  .chart-pair > div + div { border-left: 0; border-top: 1px solid var(--line); }
}

/* ---------- Plain page head (no facts row) ---------- */

.page-head-plain { padding-bottom: 56px; }

/* ---------- Entries: tools and projects ---------- */

.entries { border-top: 1px solid var(--line-strong); }
.entries-first { margin-top: -24px; border-top: 0; }
.entry {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 8fr);
  gap: 20px 56px;
  padding: 40px 0;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: calc(var(--header-h) + 8px);
}
.entries .entry:last-child { border-bottom: 0; padding-bottom: 0; }
.entry-meta dl { margin: 18px 0 0; }
.entry-meta dl > div { padding: 9px 0; border-top: 1px solid var(--line); }
.entry-meta dt {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.entry-meta dd { margin: 3px 0 0; font-size: 14.5px; line-height: 1.4; color: var(--ink-2); }
.entry-body { max-width: 42em; }
.entry-body h2, .entry-body h3 {
  margin-bottom: 14px;
  font-size: clamp(1.35rem, 2.2vw, 1.7rem);
  letter-spacing: -0.018em;
}
.entry-body p { color: var(--ink-2); }
.entry-note {
  padding-left: 14px;
  border-left: 2px solid var(--line-strong);
  font-size: 15px;
  color: var(--muted) !important;
}
.entry-links { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 18px; }

.outputs {
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}
.outputs li {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--muted);
}
.outputs strong { color: var(--ink-2); font-weight: 500; }
.out-kind {
  padding-top: 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.tag-live { border-color: var(--teal); color: var(--teal); }

/* ---------- Publication links, CV ---------- */

.pub-links { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 8px; }
.pub-title .tag { margin-left: 6px; vertical-align: 0.12em; }
.outputs a { white-space: nowrap; }

.cv { padding-bottom: 40px; }
.cv-block {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 8fr);
  gap: 16px 56px;
  padding: 44px 0;
  border-bottom: 1px solid var(--line);
}
.cv-block:last-child { border-bottom: 0; }
.cv-block > h2 { font-size: 1.3rem; letter-spacing: -0.015em; }
.cv-item { padding-bottom: 22px; }
.cv-item + .cv-item { padding-top: 22px; border-top: 1px solid var(--line); }
.cv-item:last-child { padding-bottom: 0; }
.cv-row { display: flex; justify-content: space-between; align-items: baseline; gap: 6px 20px; flex-wrap: wrap; }
.cv-row strong { font-weight: 500; font-size: 1.05rem; color: var(--ink); }
.cv-date { font-family: var(--font-mono); font-size: 13px; color: var(--muted); white-space: nowrap; }
.cv-role { margin: 4px 0 0; color: var(--ink-2); font-size: 15.5px; }
.cv-item ul { margin: 12px 0 0; padding-left: 1.1em; color: var(--ink-2); font-size: 15.5px; line-height: 1.55; }
.cv-item li { margin-bottom: 4px; }
.cv-item li::marker { color: var(--line-strong); }
.cv-skills { margin: 0; border-top: 1px solid var(--line-strong); }
.cv-skills > div {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.cv-skills dt {
  padding-top: 3px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.cv-skills dd { margin: 0; color: var(--ink-2); font-size: 15.5px; line-height: 1.5; }
.cv-refs p {
  margin: 0;
  padding: 12px 0 12px 1.5em;
  border-bottom: 1px solid var(--line);
  text-indent: -1.5em;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}
.cv-refs p:first-child { padding-top: 0; }
.cv-refs strong { color: var(--ink-2); font-weight: 500; }

@media (max-width: 720px) {
  .cv-block { grid-template-columns: minmax(0, 1fr); padding: 32px 0; }
  .cv-skills > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

@media print {
  .site-header, .site-footer, .toc, .hero-actions, .skip-link { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
}

/* ---------- Camera layout viewer ---------- */

.viewer-controls { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 14px 4px; }
.viewer .b {
  padding: 6px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.viewer .b:hover { border-color: var(--muted); color: var(--ink); background: var(--surface-2); }
.viewer #vis-container > svg { display: block; width: 100%; height: auto; }
.viewer-info {
  min-height: 74px;
  margin: 4px 14px 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
}
.viewer .r { display: flex; gap: 12px; padding: 3px 0; font-size: 14px; }
.viewer .r span:first-child { flex: 0 0 130px; color: var(--muted); }

@media (max-width: 720px) {
  .entry { grid-template-columns: minmax(0, 1fr); padding: 32px 0; }
  .entries-first { margin-top: -16px; }
  .outputs li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .viewer .r { flex-direction: column; gap: 0; }
  .viewer .r span:first-child { flex: none; }
}

/* Trial schematic (research page) */
.tl text { font-family: var(--font-mono); font-size: 10.5px; fill: var(--muted); }
.tl .tl-chan { fill: var(--ink-2); font-size: 11px; }
.tl .tl-unit { font-size: 9.5px; }
.tl .tl-row { stroke: var(--line); stroke-width: 1; }
.tl .tl-event { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 4; }
.tl .tl-event-main { stroke: var(--muted); }
.tl .tl-evlabel { fill: var(--ink-2); }
.tl .tl-bracket { stroke: var(--muted); stroke-width: 1; fill: none; }
.tl .tl-trace { fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tl .tl-resp { stroke: var(--teal); }
.tl .tl-post { stroke: var(--blue); }
.tl .tl-hand { stroke: var(--ink-2); }
.tl .tl-stroke { stroke: var(--accent); stroke-width: 2.8; }
.tl .tl-audio { stroke: var(--ink-2); stroke-width: 1; fill: none; }
.tl .tl-band { fill: var(--accent); opacity: 0.09; }
.tl .tl-word { fill: var(--surface-2); stroke: var(--line-strong); stroke-width: 1; }
.tl .tl-word-text { fill: var(--ink-2); font-size: 11px; }
.tl .tl-affil { fill: var(--accent); stroke: var(--accent); }
.tl .tl-affil-text { fill: var(--accent-ink); font-weight: 500; }
.tl .tl-phase { stroke: var(--line-strong); stroke-width: 2; }
.tl .tl-phase-stroke { stroke: var(--accent); }
.tl .tl-accent { fill: var(--accent); }
.tl .tl-blue { fill: var(--blue); }
.tl .tl-teal { fill: var(--teal); }
.tl .tl-axis { stroke: var(--line-strong); stroke-width: 1; }
