/* Loci Showcase Stylesheet
 * Self-contained, buildless, dual-theme ("Obsidian Optics & Archival Paper").
 * Respects prefers-color-scheme by default and persists explicit user choice via [data-theme].
 */

@font-face {
  font-family: "Instrument Sans";
  src: url("fonts/instrument-sans-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-latin.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --font-sans: "Instrument Sans", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Dark Theme: Obsidian Optics */
  --well: #000000;
  --bg: #0b0d0f;
  --bg-subtle: #101317;
  --surface: #13171b;
  --surface-raised: #1a2026;
  --surface-hover: rgba(242, 239, 233, 0.055);
  --header-bg: rgba(11, 13, 15, 0.88);
  --ink: #f2efe9;
  --ink-secondary: #b4bab6;
  --ink-muted: #828a86;
  --line: rgba(242, 239, 233, 0.1);
  --line-strong: rgba(242, 239, 233, 0.2);
  --accent: #5ec2b1;
  --accent-hover: #7ad5c5;
  --accent-soft: rgba(94, 194, 177, 0.13);
  --accent-border: rgba(94, 194, 177, 0.36);
  --accent-ink: #071916;
  --status-dev: #d8b263;
  --code-bg: #0e1215;
  --code-ink: #e8ecea;
  --img-outline: oklch(1 0 0 / 0.1);
  --btn-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.24);

  /* Motion & layout rhythm */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-snap: cubic-bezier(0.2, 0, 0, 1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --container: 1240px;
  --gutter: clamp(1.15rem, 3.4vw, 2.75rem);
  --band-pad: clamp(3.5rem, 6.8vw, 6.25rem);
}

/* Paper bands */
.paper-band {
  --bg: #edebe6;
  --bg-subtle: #e5e2dc;
  --surface: #fbfaf7;
  --surface-raised: #d9d7d2;
  --surface-hover: rgba(16, 22, 20, 0.045);
  --ink: #252420;
  --ink-secondary: #464640;
  --ink-muted: #5b5c55;
  --line: rgba(16, 22, 20, 0.11);
  --line-strong: rgba(16, 22, 20, 0.22);
  --accent: #126156;
  --accent-hover: #0d4b42;
  --accent-soft: rgba(18, 97, 86, 0.09);
  --accent-border: rgba(18, 97, 86, 0.3);
  --accent-ink: #ffffff;
  --img-outline: oklch(0 0 0 / 0.1);
  --btn-shadow: 0 1px 2px rgba(16, 22, 20, 0.12), 0 4px 10px rgba(16, 22, 20, 0.07);
  background: var(--bg);
  color: var(--ink);
}

.paper-band-alt {
  --bg: #e4e1da;
  --surface: #f7f6f2;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f3f1ec;
    --bg-subtle: #edebe6;
    --surface: #ffffff;
    --surface-raised: #d9d7d2;
    --surface-hover: rgba(16, 22, 20, 0.045);
    --header-bg: rgba(243, 241, 236, 0.94);
    --ink: #252420;
    --ink-secondary: #464640;
    --ink-muted: #5b5c55;
    --line: rgba(16, 22, 20, 0.11);
    --line-strong: rgba(16, 22, 20, 0.22);
    --accent: #126156;
    --accent-hover: #0d4b42;
    --accent-soft: rgba(18, 97, 86, 0.09);
    --accent-border: rgba(18, 97, 86, 0.3);
    --accent-ink: #ffffff;
    --status-dev: #8e6318;
    --code-bg: #101518;
    --code-ink: #ecf0ee;
    --img-outline: oklch(0 0 0 / 0.1);
    --btn-shadow: 0 1px 2px rgba(16, 22, 20, 0.14), 0 4px 10px rgba(16, 22, 20, 0.08);
  }

  :root:not([data-theme="dark"]) .paper-band {
    --bg: #edebe6;
    --surface: #faf9f6;
  }

  :root:not([data-theme="dark"]) .paper-band-alt {
    --bg: #f3f1ec;
    --surface: #ffffff;
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f1ec;
  --bg-subtle: #edebe6;
  --surface: #ffffff;
  --surface-raised: #d9d7d2;
  --surface-hover: rgba(16, 22, 20, 0.045);
  --header-bg: rgba(243, 241, 236, 0.94);
  --ink: #252420;
  --ink-secondary: #464640;
  --ink-muted: #5b5c55;
  --line: rgba(16, 22, 20, 0.11);
  --line-strong: rgba(16, 22, 20, 0.22);
  --accent: #126156;
  --accent-hover: #0d4b42;
  --accent-soft: rgba(18, 97, 86, 0.09);
  --accent-border: rgba(18, 97, 86, 0.3);
  --accent-ink: #ffffff;
  --status-dev: #8e6318;
  --code-bg: #101518;
  --code-ink: #ecf0ee;
  --img-outline: oklch(0 0 0 / 0.1);
  --btn-shadow: 0 1px 2px rgba(16, 22, 20, 0.14), 0 4px 10px rgba(16, 22, 20, 0.08);
}

:root[data-theme="light"] .paper-band {
  --bg: #edebe6;
  --surface: #faf9f6;
}

:root[data-theme="light"] .paper-band-alt {
  --bg: #f3f1ec;
  --surface: #ffffff;
}

/* Base Reset & Browser Surface Theming */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  caret-color: var(--accent);
  overflow-x: clip;
}

::selection {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: color 140ms var(--ease-snap);
}

a:hover {
  color: var(--accent-hover);
}

h1, h2, h3, h4, p, figure, dl, dd, ul, pre {
  margin: 0;
}

p {
  text-wrap: pretty;
}

.mono {
  font-family: var(--font-mono);
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.container {
  width: min(var(--container), calc(100% - 2 * var(--gutter)));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 0.7rem 1.1rem;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  left: 0.75rem;
  top: 0.75rem;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  width: min(var(--container), calc(100% - 2 * var(--gutter)));
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 62px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.25rem;
  font-weight: 620;
  letter-spacing: -0.025em;
  color: var(--ink);
  text-decoration: none;
  flex-shrink: 0;
}

.brand:hover {
  color: var(--ink);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(0.85rem, 1.9vw, 1.75rem);
}

.site-nav a {
  text-decoration: none;
  color: var(--ink-secondary);
  font-size: 0.89rem;
  font-weight: 500;
  padding: 0.35rem 0;
  position: relative;
}

.site-nav a:hover {
  color: var(--ink);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}

.header-github {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  color: var(--ink-secondary);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 500;
  padding: 0.42rem 0.7rem;
  border-radius: var(--radius-sm);
  transition: color 140ms var(--ease-snap), background-color 140ms var(--ease-snap);
}

.header-github:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

.nav-download {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.88rem;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: transform 130ms var(--ease-snap), opacity 140ms var(--ease-snap);
}

.nav-download:hover {
  color: var(--bg);
  opacity: 0.9;
}

.nav-download:active {
  transform: scale(0.96);
}

/* Celestial Theme Toggle (44x44 touch target, eclipse transition) */
.theme-toggle {
  appearance: none;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 140ms var(--ease-snap), border-color 140ms var(--ease-snap), background-color 140ms var(--ease-snap);
}

.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

.theme-toggle .celestial-disc {
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(1);
}

.theme-toggle .eclipse-shadow {
  transform: translate(0px, 0px);
}

.theme-toggle .sun-rays {
  transform-box: fill-box;
  transform-origin: center;
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.theme-toggle[aria-checked="true"] .celestial-disc {
  transform: scale(1.26);
}

.theme-toggle[aria-checked="true"] .eclipse-shadow {
  transform: translate(-9.5px, 9.5px);
}

.theme-toggle[aria-checked="true"] .sun-rays {
  opacity: 0;
  transform: scale(0.68) rotate(-25deg);
}

@media (prefers-reduced-motion: no-preference) {
  .theme-toggle[data-animated] .celestial-disc {
    transition: transform 230ms cubic-bezier(0.2, 0.75, 0.25, 1);
  }
  .theme-toggle[data-animated] .eclipse-shadow {
    transition: transform 280ms cubic-bezier(0.2, 0.75, 0.25, 1);
  }
  .theme-toggle[data-animated] .sun-rays {
    transition: opacity 160ms ease-out, transform 250ms cubic-bezier(0.2, 0.75, 0.25, 1);
  }
}

/* Mobile Menu */
.mobile-menu {
  display: none;
  position: relative;
}

.mobile-menu summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 560;
  color: var(--ink);
  cursor: pointer;
}

.mobile-menu summary::-webkit-details-marker {
  display: none;
}

.mobile-menu[open] nav {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  width: min(260px, calc(100vw - 2 * var(--gutter)));
  display: grid;
  padding: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.38);
  z-index: 90;
}

.mobile-menu nav a {
  padding: 0.62rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
}

.mobile-menu nav a:hover {
  background: var(--surface-hover);
  color: var(--accent);
}

/* 1. Hero */
.hero {
  background: var(--bg);
}

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(1.75rem, 5vw, 5rem);
  align-items: end;
  padding: clamp(2.5rem, 4.8vw, 4.25rem) 0 clamp(2rem, 3.8vw, 3.25rem);
}

h1 {
  font-size: clamp(2.15rem, 4.3vw, 3.85rem);
  font-weight: 540;
  line-height: 1.07;
  letter-spacing: -0.03em;
  text-wrap: balance;
  color: var(--ink);
}

.hero-intro > p:first-child {
  color: var(--ink-secondary);
  font-size: clamp(1rem, 1.25vw, 1.125rem);
  line-height: 1.55;
  max-width: 52ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.35rem;
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 44px;
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-sm);
  font-size: 0.93rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 130ms var(--ease-snap), background-color 140ms var(--ease-snap), border-color 140ms var(--ease-snap), color 140ms var(--ease-snap), opacity 140ms var(--ease-snap);
}

.btn-primary {
  background: var(--ink);
  color: var(--bg);
  box-shadow: var(--btn-shadow);
}

.btn-primary:hover {
  color: var(--bg);
  opacity: 0.9;
}

.btn-primary:active,
.btn-secondary:active {
  transform: scale(0.96);
}

.btn-secondary {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
}

.btn-secondary:hover {
  color: var(--ink);
  background: var(--surface-hover);
  border-color: var(--ink-muted);
}

.release-note {
  margin-top: 0.95rem;
  font-size: 0.78rem;
  color: var(--ink-muted);
  letter-spacing: -0.01em;
}

/* Proof Strip */
.proof-strip {
  border-block: 1px solid var(--line);
  background: var(--bg-subtle);
}

.proof-strip-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.75rem;
  padding-block: 0.78rem;
  font-size: 0.76rem;
  color: var(--ink-muted);
}

.proof-group {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
}

.proof-key {
  color: var(--accent);
  font-weight: 600;
}

.proof-vals {
  color: var(--ink-secondary);
}

/* 2. Modality Workbench (#modes) */
.workbench-band {
  scroll-margin-top: 5rem;
  padding-block: clamp(1.5rem, 3vw, 2.5rem) clamp(3rem, 5.5vw, 5rem);
  background: var(--bg);
}

.mode-bar-wrap {
  border-bottom: 1px solid var(--line-strong);
}

.mode-tabs {
  display: flex;
  align-items: stretch;
  gap: clamp(0.9rem, 2.4vw, 2.25rem);
  overflow-x: auto;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}

.mode-tabs::-webkit-scrollbar {
  display: none;
}

.mode-tab {
  position: relative;
  white-space: nowrap;
  padding: 0.85rem 0.1rem 0.8rem;
  color: var(--ink-muted);
  font-size: 0.92rem;
  font-weight: 540;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 140ms var(--ease-snap), border-color 180ms var(--ease-out);
}

.mode-tab:hover {
  color: var(--ink);
}

.mode-tab[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.mode-panel {
  scroll-margin-top: 7.5rem;
  padding-top: clamp(1.25rem, 2.4vw, 1.9rem);
}

.mode-tabs[role="tablist"], .mode-panels.is-enhanced {
  touch-action: pan-y pinch-zoom;
}

.mode-panel[hidden] {
  display: none;
}

.mode-figure {
  display: grid;
  grid-template-columns: minmax(0, 3.25fr) minmax(240px, 1fr);
  gap: clamp(1.4rem, 3vw, 2.75rem);
  align-items: start;
}

.workbench-frame {
  display: block;
  width: 100%;
  aspect-ratio: 2048 / 1442;
  background: var(--well);
  outline: 1px solid var(--img-outline);
  outline-offset: -1px;
  overflow: hidden;
  text-decoration: none;
  cursor: zoom-in;
}

.workbench-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.mode-caption {
  display: grid;
  gap: 0.9rem;
  align-content: start;
  padding-top: 0.2rem;
}

.fig-index {
  font-size: 0.76rem;
  color: var(--accent);
  font-weight: 500;
}

.mode-caption h2 {
  font-size: clamp(1.38rem, 2vw, 1.85rem);
  font-weight: 540;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.mode-caption p {
  color: var(--ink-secondary);
  font-size: 0.94rem;
  line-height: 1.56;
}

.fig-meta {
  display: grid;
  gap: 0.5rem;
  padding-block: 0.85rem;
  border-block: 1px solid var(--line);
  font-size: 0.77rem;
}

.fig-meta > div {
  display: grid;
  gap: 0.12rem;
}

.fig-meta dt {
  color: var(--ink-muted);
}

.fig-meta dd {
  color: var(--ink);
}

.expand-control {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 40px;
  font-size: 0.88rem;
  font-weight: 560;
  color: var(--accent);
  text-decoration: none;
  justify-self: start;
}

.expand-control:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* Shared Section Grammar */
.section {
  border-top: 1px solid var(--line);
  padding-block: var(--band-pad);
  scroll-margin-top: 72px;
}

.masthead > *,
.mode-figure > *,
.section-intro > *,
.specimen-layout > *,
.trace-workbench > *,
.review-layout > *,
.evidence-grid > *,
.films > *,
.section-pair > *,
.field-strip > *,
.auto-deck > *,
.choose-grid > *,
.download-columns > *,
.code-window {
  min-width: 0;
}

.section-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  align-items: end;
  gap: clamp(1rem, 4.5vw, 4.5rem);
  margin-bottom: clamp(1.75rem, 3.6vw, 3rem);
}

.section-intro h1,
.section-intro h2 {
  font-size: clamp(1.55rem, 3.1vw, 2.65rem);
  font-weight: 540;
  line-height: 1.09;
  letter-spacing: -0.028em;
  text-wrap: balance;
}

.section-intro p {
  color: var(--ink-secondary);
  font-size: 0.98rem;
  line-height: 1.58;
  max-width: 58ch;
}

h3 {
  font-size: 1.15rem;
  font-weight: 580;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

/* Subtle Progressive Reveal */
.reveal-ready [data-reveal] {
  opacity: 0;
  transform: translateY(14px);
}

.reveal-ready [data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 420ms var(--ease-out), transform 420ms var(--ease-out);
}

/* 3. Interactive Optical Stack (#specimen) */
.specimen-band {
  background: var(--bg-subtle);
}

.specimen-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.38fr) minmax(290px, 1fr);
  gap: clamp(1.5rem, 3.5vw, 3.25rem);
  align-items: start;
}

.specimen-stage {
  display: grid;
  gap: 0.75rem;
}

.specimen-frame {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  background: var(--well);
  outline: 1px solid oklch(1 0 0 / 0.12);
  outline-offset: -1px;
  overflow: hidden;
  cursor: crosshair;
}

.specimen-fallback,
.specimen-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.specimen-canvas[hidden],
.specimen-fallback[hidden] {
  display: none;
}

.probe-crosshair {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.probe-crosshair::before,
.probe-crosshair::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.42);
}

.probe-crosshair::before {
  left: 0;
  right: 0;
  top: var(--py, 50%);
  height: 1px;
}

.probe-crosshair::after {
  top: 0;
  bottom: 0;
  left: var(--px, 50%);
  width: 1px;
}

.scale-bar {
  position: absolute;
  right: 1rem;
  bottom: 2.85rem;
  width: 15.024%;
  display: grid;
  justify-items: end;
  gap: 0.25rem;
  pointer-events: none;
}

.scale-bar-line {
  width: 100%;
  height: 2px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.scale-bar-label {
  font-size: 0.72rem;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.probe-hud {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.52rem 0.85rem;
  background: rgba(8, 10, 12, 0.84);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: #eaece9;
  font-size: 0.74rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  pointer-events: none;
}

.probe-hint {
  color: #a8b1ac;
}

.probe-vals {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.probe-ch {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
}

.probe-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dot, #fff);
}

.specimen-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.specimen-caption {
  font-size: 0.84rem;
  color: var(--ink-secondary);
}

.specimen-projection {
  font-size: 0.84rem;
  font-weight: 560;
  white-space: nowrap;
}

.specimen-controls {
  display: grid;
  gap: 1.35rem;
  padding: 1.35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.readout-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.readout-pair {
  display: grid;
  gap: 0.15rem;
}

.readout-label {
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.readout-value {
  font-size: 1.55rem;
  font-weight: 560;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.slider-group,
.gain-group {
  display: grid;
  gap: 0.55rem;
}

.slider-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.control-label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink);
}

.slider-selection {
  font-size: 0.74rem;
  color: var(--ink-muted);
  text-align: right;
}

.gain-value {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
}

.gain-note {
  font-size: 0.78rem;
  color: var(--ink-muted);
  line-height: 1.45;
}

.z-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--accent) 0%,
    var(--accent) var(--slider-pct, 25%),
    var(--line-strong) var(--slider-pct, 25%),
    var(--line-strong) 100%
  );
  cursor: pointer;
}

.z-slider:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.z-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.z-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.slider-bounds {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--ink-muted);
}

.channel-group {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.channel-group legend {
  padding: 0;
  margin-bottom: 0.35rem;
}

.channel-list {
  display: grid;
  gap: 0.4rem;
}

.channel-toggle {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-subtle);
  cursor: pointer;
  transition: border-color 140ms var(--ease-snap), background-color 140ms var(--ease-snap);
}

.channel-toggle:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

.channel-toggle input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.channel-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--swatch, #fff);
}

.channel-meta {
  display: grid;
  gap: 0.1rem;
}

.channel-name {
  font-size: 0.88rem;
  font-weight: 560;
  color: var(--ink);
  transition: opacity 140ms var(--ease-snap);
}

.channel-toggle:has(input:not(:checked)) .channel-name {
  opacity: 0.5;
}

.channel-detail {
  font-size: 0.73rem;
  color: var(--ink-muted);
}

.text-action {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0.25rem 0;
  color: var(--accent);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 580;
  cursor: pointer;
  justify-self: start;
}

.text-action:hover {
  text-decoration: underline;
}

.specimen-facts {
  display: grid;
  gap: 0.55rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
}

.specimen-facts > div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 0.5rem;
}

.specimen-facts dt {
  color: var(--ink-muted);
}

.specimen-facts dd {
  color: var(--ink-secondary);
}

/* 4. Interactive Plot <-> Cell <-> Provenance (#workflows) */
.trace-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(300px, 1fr);
  gap: clamp(1.25rem, 2.8vw, 2.25rem);
  align-items: start;
}

.trace-stage-col {
  display: grid;
  grid-template-rows: 1fr auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
}

.trace-image-well {
  position: relative;
  background: var(--well);
  aspect-ratio: 924 / 624;
  width: 100%;
  overflow: hidden;
}

.trace-image-well img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.trace-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.cell-poly {
  fill: rgba(94, 194, 177, 0.04);
  stroke: rgba(142, 245, 215, 0.52);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: fill 130ms var(--ease-snap), stroke 130ms var(--ease-snap), opacity 160ms var(--ease-snap);
}

.cell-poly:hover {
  fill: rgba(94, 194, 177, 0.2);
  stroke: #8ef5d7;
  stroke-width: 2.2;
}

.cell-poly.is-selected {
  fill: rgba(94, 194, 177, 0.28);
  stroke: #ffffff;
  stroke-width: 2.6;
}

.cell-poly.is-muted {
  opacity: 0.22;
}

.trace-stage-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  padding: 0.7rem 0.95rem;
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.trace-filters {
  display: inline-flex;
  gap: 0.35rem;
}

.filter-chip {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink-secondary);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  padding: 0.34rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 140ms var(--ease-snap), color 140ms var(--ease-snap), border-color 140ms var(--ease-snap);
}

.filter-chip:hover {
  color: var(--ink);
  border-color: var(--ink-muted);
}

.filter-chip.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}

.trace-inspector-col {
  display: grid;
  gap: 1rem;
  align-content: space-between;
}

.trace-plot-card,
.provenance-receipt {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
}

.trace-card-head,
.receipt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
}

.trace-card-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
}

.trace-card-sub {
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.trace-scatter {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.plot-grid {
  stroke: var(--line);
  stroke-width: 1;
}

.plot-axis {
  stroke: var(--line-strong);
  stroke-width: 1;
}

.plot-label {
  fill: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.plot-dot {
  fill: var(--accent);
  fill-opacity: 0.78;
  stroke: var(--surface);
  stroke-width: 1.25;
  cursor: pointer;
  transition: r 140ms var(--ease-snap), fill-opacity 140ms var(--ease-snap), stroke 140ms var(--ease-snap);
}

.plot-dot:hover {
  fill-opacity: 1;
  stroke: var(--ink);
}

.plot-dot.is-selected {
  fill: var(--ink);
  fill-opacity: 1;
  stroke: var(--accent);
  stroke-width: 2.5;
}

.plot-dot.is-muted {
  fill-opacity: 0.16;
}

.receipt-title {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--ink);
}

.receipt-badge {
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.receipt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.58rem 0.9rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
}

.receipt-grid > div {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.receipt-grid dt {
  color: var(--ink-muted);
  font-size: 0.7rem;
}

.receipt-grid dd {
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hash-cell {
  color: var(--ink-secondary);
}

/* Cross-Channel Triptych */
.quant-figure {
  margin-top: clamp(2rem, 4vw, 3.25rem);
  padding-top: clamp(1.75rem, 3.2vw, 2.5rem);
  border-top: 1px solid var(--line);
}

.triptych {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.65rem, 1.5vw, 1.2rem);
}

.triptych-well {
  background: var(--well);
  aspect-ratio: 1 / 1;
  outline: 1px solid var(--img-outline);
  outline-offset: -1px;
  overflow: hidden;
}

.triptych-well img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.triptych figcaption {
  margin-top: 0.55rem;
  font-size: 0.88rem;
  font-weight: 540;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
}

.panel-tag {
  font-size: 0.76rem;
  color: var(--accent);
  font-weight: 600;
}

.measurement-stack { position: relative; }
.measurement-stack #measurement-mask { position: absolute; inset: 0; }

.quant-caption {
  margin-bottom: 1.2rem;
  color: var(--ink-secondary);
  max-width: 74ch;
  line-height: 1.58;
}
.quant-caption p { font-size: .95rem; }
.triptych .measurement-inspector figcaption { display: block; }
.panel-legend { display: flex; align-items: baseline; gap: .4rem; }
.measurement-result strong { color: var(--ink); }

/* Linked orthogonal slices and their native projection. */
.volume-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.5rem, 3vw, 2.5rem);
}
.volume-frame {
  display: block;
  overflow: hidden;
  background: var(--well);
  cursor: zoom-in;
  outline: 1px solid var(--img-outline);
  outline-offset: -1px;
}
.volume-frame img { width: 100%; height: auto; aspect-ratio: 1240 / 711; }
.volume-demo figcaption { margin-top: .85rem; }
.volume-demo h3, .quant-caption h3 {
  margin-bottom: .3rem;
  color: var(--ink);
  font-weight: 560;
  font-size: 1.1rem;
}
.volume-demo p { max-width: 60ch; font-size: .93rem; color: var(--ink-secondary); }
.volume-motion { margin-top: 1rem; min-height: 40px; }
.measurement-result {
  display: grid;
  align-content: start;
  gap: .45rem;
  margin-top: .75rem;
  padding-top: .6rem;
  border-top: 1px solid var(--line-strong);
  font-weight: 400;
  line-height: 1.5;
  color: var(--ink-secondary);
}
#measurement-picker:not([hidden]) {
  display: flex;
  align-items: center;
  gap: .55rem;
  width: fit-content;
  flex-wrap: wrap;
  color: var(--ink-secondary);
}
#measurement-picker::before {
  content: '';
  width: .7rem;
  height: .7rem;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--object-ink);
}
#measurement-object {
  font: inherit;
  padding: .3rem .5rem;
  min-height: 36px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
}
#measurement-readout { font-variant-numeric: tabular-nums; }
.example-nav {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.example-nav > a:last-child { font-size: .9rem; }
.wipe-stage:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 5. Model Wipe Slider & Method Disagreement (#review) */
.review-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 3vw, 2.75rem);
  align-items: start;
}

.wipe-module {
  display: grid;
  gap: 0.85rem;
}

.wipe-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.wipe-tab {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink-secondary);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 540;
  padding: 0.48rem 0.82rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 140ms var(--ease-snap), border-color 140ms var(--ease-snap), color 140ms var(--ease-snap);
}

.wipe-tab:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

.wipe-tab.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}

.wipe-stage {
  position: relative;
  aspect-ratio: 1024 / 704;
  width: 100%;
  background: var(--well);
  outline: 1px solid oklch(1 0 0 / 0.12);
  outline-offset: -1px;
  overflow: hidden;
  user-select: none;
}

.wipe-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.wipe-after-clip {
  position: absolute;
  inset: 0;
  clip-path: inset(0 0 0 var(--wipe-pos, 52%));
}

.wipe-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--wipe-pos, 52%);
  width: 2px;
  background: #ffffff;
  transform: translateX(-1px);
  pointer-events: none;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.65);
}

.wipe-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(11, 13, 15, 0.88);
  border: 1.5px solid #ffffff;
  color: #ffffff;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
}

.wipe-pill {
  position: absolute;
  top: 0.7rem;
  padding: 0.22rem 0.55rem;
  border-radius: 4px;
  background: rgba(8, 10, 12, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f2efe9;
  font-size: 0.72rem;
  pointer-events: none;
}

.wipe-pill-left {
  left: 0.7rem;
}

.wipe-pill-right {
  right: 0.7rem;
}

.wipe-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
}

.wipe-caption {
  font-size: 0.77rem;
  color: var(--ink-muted);
}

.disagreement-card {
  display: grid;
  gap: 1rem;
  padding: 1.15rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.disagreement-caption {
  display: grid;
  gap: 0.65rem;
}

.disagreement-caption p {
  font-size: 0.92rem;
  color: var(--ink-secondary);
}

.disagreement-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.9rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
  font-size: 0.77rem;
  color: var(--ink-secondary);
}

.disagreement-stats strong {
  color: var(--accent);
}

/* 6. Engineering Evidence (Archival Paper Band) */
.evidence-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 2.2vw, 1.65rem);
}

.evidence-card {
  display: grid;
  gap: 0.85rem;
  align-content: start;
  padding: clamp(1.25rem, 2.4vw, 1.75rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.evidence-lead {
  color: var(--ink-secondary);
  font-size: 0.93rem;
  line-height: 1.54;
}

.bar-chart {
  display: grid;
  gap: 0.8rem;
  padding-block: 0.35rem;
}

.bar-row {
  display: grid;
  gap: 0.3rem;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: var(--ink-secondary);
}

.bar-label strong {
  color: var(--ink);
}

.accent-num {
  color: var(--accent) !important;
  font-weight: 600;
}

.bar-track {
  height: 8px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 3px;
}

.bar-fill-muted {
  background: var(--ink-muted);
  opacity: 0.55;
}

.bar-fill-accent {
  background: var(--accent);
  min-width: 6px;
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.mini-table th,
.mini-table td {
  text-align: left;
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--line);
}

.mini-table th {
  color: var(--ink-muted);
  font-weight: 500;
  border-bottom-color: var(--line-strong);
}

.mini-table td {
  color: var(--ink);
}

.mini-table tr:last-child td {
  border-bottom: 0;
}

.stat-list {
  display: grid;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.stat-list > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.48rem;
  border-bottom: 1px solid var(--line);
}

.stat-list > div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.stat-list dt {
  color: var(--ink-secondary);
}

.stat-list dd {
  color: var(--ink);
  font-weight: 600;
}

.evidence-plate a {
  display: block;
  outline: 1px solid var(--img-outline);
  overflow: hidden;
  background: #ffffff;
  cursor: zoom-in;
}

.evidence-plate img {
  width: 100%;
  height: auto;
}

.evidence-source {
  margin-top: auto;
  padding-top: 0.55rem;
  font-size: 0.74rem;
  color: var(--ink-muted);
}

/* 7. Loci in Motion (#film) */
.films {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.25rem, 2.5vw, 2rem);
}

.clip figure {
  display: grid;
  gap: 0.85rem;
}

.film-well {
  background: var(--well);
  outline: 1px solid oklch(1 0 0 / 0.12);
  outline-offset: -1px;
  overflow: hidden;
}

.clip video {
  width: 100%;
  height: auto;
  display: block;
}

.film-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.film-transport {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.film-toggle {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 580;
  min-height: 36px;
  padding: 0.3rem 0.78rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 140ms var(--ease-snap), border-color 140ms var(--ease-snap);
}

.film-toggle:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

.clip figcaption p {
  font-size: 0.92rem;
  color: var(--ink-secondary);
}

/* 8. Spatial & Cross-Field Studies */
.section-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 2.2vw, 1.75rem);
}

.spatial-card {
  display: grid;
  gap: 0.75rem;
}

.spatial-well {
  display: block;
  background: var(--well);
  aspect-ratio: 1 / 1;
  outline: 1px solid var(--img-outline);
  outline-offset: -1px;
  overflow: hidden;
  cursor: zoom-in;
}

.spatial-well img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.spatial-card figcaption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.spatial-card figcaption > div {
  display: grid;
  gap: 0.15rem;
}

.spatial-card figcaption strong {
  font-size: 0.96rem;
  color: var(--ink);
}

.spatial-card figcaption span {
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.spatial-meta-bar {
  margin-top: 1.15rem;
  padding-top: 0.95rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
}

.spot-key {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 1rem;
  font-size: 0.78rem;
  color: var(--ink-secondary);
}

.spot-key span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.spot-key b {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.spot-zero { background: #ffffff; border: 1px solid var(--line-strong); }
.spot-low { background: #9fd8ce; }
.spot-mid { background: #46a89a; }
.spot-high { background: #165e55; border: 1px solid rgba(255, 255, 255, 0.3); }

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  color: var(--ink-secondary);
}

.status-chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-dev);
}

.field-strip {
  margin-top: clamp(1.75rem, 3.5vw, 2.75rem);
  padding: clamp(1.15rem, 2.4vw, 1.65rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(240px, 1fr) auto;
  align-items: center;
  gap: 1.25rem 2rem;
}

.field-strip-copy {
  display: grid;
  gap: 0.4rem;
}

.field-strip-copy p {
  font-size: 0.92rem;
  color: var(--ink-secondary);
}

.minor-link {
  font-size: 0.86rem;
  font-weight: 560;
  white-space: nowrap;
}

/* 9. Automate Deck (#repeat) */
.auto-deck {
  display: grid;
  gap: 1.1rem;
}

.auto-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.auto-tab {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink-secondary);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 560;
  padding: 0.52rem 0.95rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 140ms var(--ease-snap), border-color 140ms var(--ease-snap), color 140ms var(--ease-snap);
}

.auto-tab:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

.auto-tab.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}

.auto-panel[hidden] {
  display: none;
}

.code-window {
  background: var(--code-bg);
  color: var(--code-ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.76rem;
  color: #9ba39f;
}

.copy-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: #eef2ef;
  font-family: var(--font-mono);
  font-size: 0.73rem;
  padding: 0.28rem 0.65rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 140ms var(--ease-snap), border-color 140ms var(--ease-snap), color 140ms var(--ease-snap);
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
}

.copy-btn-subtle {
  border-color: var(--line-strong);
  color: var(--ink);
}

.copy-btn-subtle:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

.code-body {
  padding: 1.15rem 1.2rem;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.62;
}

.tok-prompt { color: #5ec2b1; }
.tok-dim { color: #848f8a; }
.tok-accent { color: #7ad5c5; }
.tok-str { color: #e2b878; }

.auto-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.5rem;
  margin-top: 0.9rem;
  font-size: 0.88rem;
  font-weight: 540;
}

.zoo-showcase {
  display: grid;
  gap: 0.8rem;
}

.zoo-showcase figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  font-size: 0.9rem;
  color: var(--ink-secondary);
}

/* 10. Scoped Assistant (#assistant) */
.figure-foot {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem 1.5rem;
  font-size: 0.88rem;
  color: var(--ink-secondary);
}

.figure-foot > div {
  font-size: 0.78rem;
}

.reveal {
  margin-top: 1.15rem;
}

.reveal summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 560;
  padding-block: 0.35rem;
}

.tool-plates {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.tool-plates a {
  display: grid;
  gap: 0.5rem;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 540;
}

.tool-plates img {
  width: 100%;
  height: auto;
  outline: 1px solid var(--img-outline);
  background: var(--well);
}

/* 11. Comparison Matrix & Decision Cards (#compare, Paper Band) */
.matrix-scroll {
  overflow-x: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.compare-matrix {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.compare-matrix th,
.compare-matrix td {
  text-align: left;
  padding: 0.78rem 0.9rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.compare-matrix thead th {
  font-size: 0.86rem;
  font-weight: 640;
  border-bottom: 1px solid var(--line-strong);
  background: var(--bg-subtle);
}

.compare-matrix thead a {
  color: var(--ink);
  text-decoration: none;
}

.compare-matrix thead a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.compare-matrix tbody th {
  font-weight: 580;
  color: var(--ink);
  white-space: nowrap;
}

.compare-matrix tbody td {
  color: var(--ink-secondary);
}

.compare-matrix tbody tr:last-child th,
.compare-matrix tbody tr:last-child td {
  border-bottom: 0;
}

.compare-matrix .col-loci {
  background: var(--accent-soft);
  color: var(--ink);
  font-weight: 520;
}

.compare-matrix thead .col-loci a {
  color: var(--accent);
}

.dot {
  display: inline-block;
  margin-right: 0.25rem;
  font-size: 0.82rem;
}

.dot-full { color: var(--accent); }
.dot-part { color: var(--ink-muted); }
.dot-none { color: var(--line-strong); }

.matrix-key {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  font-size: 0.76rem;
  color: var(--ink-muted);
}

.choose-grid {
  margin-top: clamp(1.75rem, 3.2vw, 2.5rem);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.choose-card {
  padding: 1.15rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: grid;
  gap: 0.45rem;
  align-content: start;
}

.choose-card-loci {
  border-color: var(--accent-border);
  background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface));
}

.choose-card p {
  font-size: 0.89rem;
  color: var(--ink-secondary);
  line-height: 1.52;
}

.interop-note {
  margin-top: 1.35rem;
  font-size: 0.93rem;
  color: var(--ink-secondary);
  max-width: 76ch;
}

.interop-note strong {
  color: var(--ink);
}

/* 12. Download, Formats & Open Project (#download) */
.download-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1.75rem, 4vw, 3.25rem);
  align-items: start;
}

.download-mark {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.download h2 {
  font-size: clamp(1.85rem, 3vw, 2.55rem);
  font-weight: 540;
  letter-spacing: -0.028em;
  line-height: 1.08;
}

.download-primary > p {
  color: var(--ink-secondary);
  font-size: 0.96rem;
  max-width: 46ch;
}

.checksum-box {
  margin-top: 1.25rem;
  padding: 0.75rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 0.4rem;
}

.checksum-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.checksum-box code {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-secondary);
  word-break: break-all;
}

.platform-spec {
  margin-top: 0.8rem;
  font-size: 0.76rem;
  color: var(--ink-muted);
  line-height: 1.5;
}

.download-col {
  display: grid;
  gap: 0.9rem;
  align-content: start;
}

.format-list {
  display: grid;
  gap: 0.7rem;
}

.format-list > div {
  display: grid;
  gap: 0.14rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--line);
}

.format-list dt {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
}

.format-list dd {
  font-size: 0.79rem;
  color: var(--ink-secondary);
}

.resource-links {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.cite-box {
  margin-top: 0.35rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0.55rem;
}

.privacy-line {
  font-size: 0.84rem;
  color: var(--ink-secondary);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg);
  padding-block: 2.25rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  justify-content: space-between;
  gap: 1.25rem 2.5rem;
}

.footer-brand-col {
  display: grid;
  gap: 0.5rem;
  max-width: 54ch;
}

.footer-scope {
  font-size: 0.82rem;
  color: var(--ink-muted);
  line-height: 1.52;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.4rem;
  font-size: 0.86rem;
}

.site-footer nav a {
  color: var(--ink-secondary);
  text-decoration: none;
}

.site-footer nav a:hover {
  color: var(--ink);
}

/* Lightbox Modal (#image-dialog) */
#image-dialog {
  width: min(96vw, 1480px);
  height: min(92vh, 1020px);
  max-width: none;
  max-height: none;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-md);
  background: #0b0d0f;
  color: #f2efe9;
  overflow: hidden;
}

#image-dialog[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

#image-dialog::backdrop {
  background: rgba(4, 6, 8, 0.84);
  backdrop-filter: blur(6px);
}

.dialog-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.72rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: #101317;
}

.dialog-bar h2 {
  font-size: 0.95rem;
  font-weight: 560;
  margin-right: auto;
  color: #f2efe9;
}

.dialog-bar button,
.dialog-bar a {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: #f2efe9;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 540;
  min-height: 36px;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.dialog-bar button[aria-pressed="true"] {
  background: rgba(94, 194, 177, 0.2);
  border-color: #5ec2b1;
  color: #7ad5c5;
}

.dialog-stage {
  position: relative;
  overflow: hidden;
  background: #000000;
  width: 100%;
  height: 100%;
}

.dialog-stage img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.dialog-stage.actual-pixels {
  overflow: auto;
}

.dialog-stage.actual-pixels img {
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  object-fit: none;
}

/* Responsive Breakpoints */
@media (max-width: 1040px) {
  .site-nav,
  .header-github {
    display: none;
  }

  .mobile-menu {
    display: block;
  }

  .mode-figure,
  .specimen-layout,
  .trace-workbench,
  .review-layout,
  .download-columns {
    grid-template-columns: 1fr;
  }

  .workbench-band {
    padding-bottom: 2rem;
  }

  .choose-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field-strip {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

@media (max-width: 740px) {
  .masthead,
  .section-intro,
  .evidence-grid,
  .films,
  .section-pair,
  .tool-plates,
  .choose-grid {
    grid-template-columns: 1fr;
  }

  .hero-break {
    display: none;
  }

  .nav-download {
    display: none;
  }

  .triptych {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 1.15rem;
  }
  .triptych .measurement-inspector {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem;
    align-items: start;
  }
  .triptych .measurement-inspector figcaption { margin-top: 0; }
  .measurement-result { margin-top: .55rem; }
  #measurement-picker:not([hidden]) { column-gap: .35rem; row-gap: .2rem; }
  .volume-pair { grid-template-columns: 1fr; }
  .volume-demo + .volume-demo { padding-top: 1.1rem; border-top: 1px solid var(--line); }

  .receipt-grid {
    grid-template-columns: 1fr;
  }

  .workbench-band {
    padding-bottom: 1.5rem;
  }

  .proof-strip-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .dialog-bar {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal-ready [data-reveal] {
    opacity: 1;
    transform: none;
  }

  .theme-toggle .celestial-disc,
  .theme-toggle .eclipse-shadow,
  .theme-toggle .sun-rays,
  .btn-primary,
  .btn-secondary,
  .mode-tab,
  .cell-poly,
  .plot-dot {
    transition: none !important;
  }
}
