/* Shared styles for the CAP and ProAct project pages.
   Layout and chrome follow the GLOVES project page; chart tokens follow the
   validated data-viz palette (ours = blue slot 1, baseline = de-emphasis gray). */

:root {
  color-scheme: light;
  --ink: #20211f;
  --ink-2: #343630;
  --muted: #646860;
  --faint: #898781;
  --paper: #fbfbf8;
  --surface: #ffffff;
  --wash: #f4f4ef;
  --line: #e4e3dc;
  --line-strong: #c9ccc3;
  --accent: #1c5cab;
  --accent-ink: #184f95;
  --accent-wash: rgba(42, 120, 214, 0.1);
  --shadow: 0 12px 34px rgba(32, 33, 31, 0.07);

  /* chart roles */
  --ours: #2a78d6;
  --base: #898781;
  --grid: #ecebe5;
  --axis: #c3c2b7;
  --good: #0ca30c;
  --bad: #d03b3b;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;

  --serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  line-height: 1.65;
}

img, video { display: block; max-width: 100%; }
button, a, select { font: inherit; }
a { color: var(--accent); }
h1, h2, h3, h4, p { overflow-wrap: anywhere; }

.container { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.medium { width: min(1080px, calc(100% - 40px)); }
.narrow { width: min(860px, calc(100% - 40px)); }

/* ---------- top nav ---------- */

.top-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 251, 248, 0.88);
  backdrop-filter: saturate(1.4) blur(10px);
}

.top-nav .container {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 52px;
}

.top-nav .brand {
  color: var(--ink);
  font-weight: 760;
  text-decoration: none;
  white-space: nowrap;
}

.top-nav nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}

.top-nav nav a {
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.top-nav nav a:hover,
.top-nav nav a.active { background: var(--accent-wash); color: var(--accent-ink); }

/* ---------- hero ---------- */

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.hero { padding: 56px 0 40px; text-align: center; }

.venue {
  display: inline-block;
  margin: 0 0 16px;
  padding: 3px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  max-width: 1040px;
  margin: 0 auto 20px;
  font-family: var(--serif);
  font-size: clamp(1.95rem, 5vw, 3.3rem);
  line-height: 1.1;
  letter-spacing: 0;
}

.title-text { color: var(--ink); }

.title-sub { display: block; color: var(--ink); -webkit-text-fill-color: var(--ink); }

h2 {
  margin: 0 0 8px;
  font-size: clamp(1.55rem, 3.4vw, 2.2rem);
  line-height: 1.15;
}

h3 { margin: 0; font-size: 1.08rem; line-height: 1.25; }

.authors {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  max-width: 900px;
  margin: 0 auto;
  font-size: 1.05rem;
  font-weight: 650;
}

.authors span { white-space: nowrap; }
.authors sup { font-size: 0.68em; }
.affiliations, .note { margin: 10px auto 0; color: var(--muted); }
.note { margin-top: 4px; font-size: 0.9rem; }

.paper-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
}

.pill-link,
.paper-links a,
.paper-links .disabled-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 18px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease;
}

.paper-links a:hover { background: #000; transform: translateY(-1px); }

.paper-links .disabled-link {
  border-color: var(--line-strong);
  background: var(--wash);
  color: var(--muted);
  cursor: not-allowed;
}

/* ---------- sections ---------- */

.section { padding: 56px 0; }
.section.alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section.tint { background: #eef2f6; border-top: 1px solid var(--line); }

.section-head { margin-bottom: 26px; }

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-ink);
  font-size: 0.76rem;
  font-weight: 760;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lede { max-width: 760px; margin: 6px 0 0; color: var(--muted); font-size: 1.02rem; }

.prose p { margin: 0 0 14px; color: var(--ink-2); font-size: 1.02rem; text-align: justify; }

.subsection { margin-top: 44px; }
.subsection:first-child { margin-top: 0; }
.subsection > h3 { font-size: clamp(1.2rem, 2.2vw, 1.5rem); font-weight: 760; }
.subsection > .lede { margin-bottom: 16px; }

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

.figure { margin: 0; }
.figure img { width: 100%; height: auto; border-radius: 8px; }
.figure figcaption { margin-top: 10px; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }

/* ---------- stat tiles ---------- */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.kpi {
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.kpi-label { color: var(--muted); font-size: 0.86rem; font-weight: 600; }
.kpi-value { display: block; margin-top: 4px; font-size: 2.1rem; font-weight: 700; line-height: 1.1; }
.kpi-detail { display: block; margin-top: 6px; color: var(--muted); font-size: 0.84rem; line-height: 1.4; }
.kpi-value .delta-unit { font-size: 0.55em; font-weight: 650; color: var(--muted); margin-left: 2px; }

/* ---------- controls ---------- */

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-bottom: 14px;
}

.control-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

.control-label {
  margin-right: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chip {
  min-height: 32px;
  padding: 4px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.88rem;
  transition: background 120ms ease, border-color 120ms ease;
}

.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"], .chip[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-wash);
  color: var(--accent-ink);
  font-weight: 650;
}
.chip:disabled { color: #a0a39a; background: var(--wash); border-color: var(--line); cursor: not-allowed; }

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
}

.segmented button {
  min-height: 30px;
  padding: 3px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
}

.segmented button[aria-pressed="true"] { background: var(--ink); color: #fff; }

.btn {
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
}

.btn.primary { border-color: var(--ink); background: var(--ink); color: #fff; }
.btn:hover { border-color: var(--ink); }

/* ---------- chart cards ---------- */

.chart-card {
  position: relative;
  margin: 0;
  padding: 18px 18px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}


.chart-card-head {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 8px;
}

.chart-card-head > div:first-child { flex: 1 1 280px; min-width: 0; }
.chart-tools { flex: none; }
.chart-title { margin: 0; font-size: 1rem; font-weight: 720; }
.chart-sub { margin: 2px 0 0; color: var(--muted); font-size: 0.86rem; line-height: 1.45; }

.chart-tools { display: flex; gap: 6px; }

.table-toggle {
  padding: 3px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 650;
}

.table-toggle[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); }

.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--sans); }
.chart .tick, .chart .axis-label { fill: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .axis-label { font-size: 11.5px; fill: var(--muted); }
.chart .row-label { fill: var(--ink-2); font-size: 12px; }
.chart .group-label { fill: var(--ink); font-size: 12px; font-weight: 700; }
.chart .value-label { fill: var(--ink); font-size: 11.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.chart .value-label.muted { fill: var(--muted); font-weight: 500; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline-rule { stroke: var(--axis); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:hover + .row-bg, .chart .row-bg.hover { fill: rgba(42, 120, 214, 0.06); }
.chart .row-bg { fill: transparent; }
.chart [data-focusable]:focus { outline: none; }
.chart [data-focusable]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 2px 0 6px;
  color: var(--muted);
  font-size: 0.84rem;
}

.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.legend-swatch.rect { border-radius: 2px; }
.legend-swatch.line { width: 16px; height: 2px; border-radius: 1px; }
.legend-ramp { width: 120px; height: 10px; border-radius: 2px; }

.data-table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}

.data-table th, .data-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table th { color: var(--muted); font-size: 0.74rem; font-weight: 760; text-transform: uppercase; letter-spacing: 0.04em; }
.data-table tr:hover td { background: var(--accent-wash); }
.data-table .best { font-weight: 750; }

.chart-note { margin: 8px 0 0; color: var(--muted); font-size: 0.8rem; line-height: 1.45; }

/* tooltip: one singleton, values lead and labels follow */
.viz-tooltip {
  position: fixed;
  z-index: 50;
  min-width: 140px;
  max-width: 280px;
  padding: 9px 11px;
  border: 1px solid rgba(11, 11, 11, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.35;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 90ms ease, transform 90ms ease;
}

.viz-tooltip.show { opacity: 1; transform: none; }
.viz-tooltip .tt-title { margin-bottom: 6px; color: var(--muted); font-size: 0.76rem; font-weight: 650; }
.viz-tooltip .tt-row { display: grid; grid-template-columns: 14px auto 1fr; align-items: center; gap: 7px; }
.viz-tooltip .tt-row + .tt-row { margin-top: 3px; }
.viz-tooltip .tt-key { width: 12px; height: 2px; border-radius: 1px; }
.viz-tooltip .tt-value { font-weight: 720; font-variant-numeric: tabular-nums; }
.viz-tooltip .tt-name { color: var(--muted); }
.viz-tooltip .tt-foot { margin-top: 7px; padding-top: 6px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.76rem; }

/* ---------- video ---------- */

.video-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #111;
}

.video-frame video { width: 100%; height: auto; }

.video-placeholder {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  padding: 18px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 10px;
  background:
    repeating-linear-gradient(135deg, rgba(0, 0, 0, 0.018) 0 10px, transparent 10px 20px),
    var(--wash);
  color: var(--muted);
  text-align: center;
}

.video-placeholder strong { display: block; color: var(--ink-2); font-size: 0.95rem; }
.video-placeholder code { display: inline-block; margin-top: 6px; padding: 2px 6px; border-radius: 4px; background: rgba(0, 0, 0, 0.05); font-size: 0.76rem; overflow-wrap: anywhere; }
.video-placeholder .ph-icon { width: 34px; height: 34px; margin: 0 auto 8px; opacity: 0.55; }

.outcome {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 720;
}

.outcome::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.outcome.success { background: rgba(12, 163, 12, 0.1); color: #006300; }
.outcome.success::before { content: "✓"; width: auto; height: auto; background: none; font-size: 0.8rem; }
.outcome.fail { background: rgba(208, 59, 59, 0.1); color: #a82727; }
.outcome.fail::before { content: "✕"; width: auto; height: auto; background: none; font-size: 0.74rem; }

/* paired, synchronized rollout viewer */
.pair-viewer { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }

.pair-pane {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.pair-pane header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.pair-pane header h4 { margin: 0; font-size: 0.98rem; }
.pair-pane header .who { display: inline-flex; align-items: center; gap: 8px; }
.pair-pane header .dot { width: 10px; height: 10px; border-radius: 50%; }
.pair-pane video { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; background: #0e0e0e; }

.transport {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.transport input[type="range"] { width: 100%; accent-color: var(--ink); }
.transport .time { color: var(--muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; min-width: 88px; text-align: right; }

/* ---------- method ---------- */

.method-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }

.step-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.step-num {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: var(--accent-wash);
  color: var(--accent-ink);
  font-size: 0.84rem;
  font-weight: 800;
}

.step-card h4 { margin: 0 0 6px; font-size: 1rem; }
.step-card p { margin: 0; color: var(--muted); font-size: 0.92rem; line-height: 1.5; }

.eq-block {
  margin: 14px 0;
  padding: 14px 16px;
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: #f5f8fc;
  overflow-x: auto;
}

.schematic-tag {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ---------- finding cards ---------- */

.finding-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

.finding {
  display: flex;
  flex-direction: column;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.finding .q { margin: 0 0 4px; color: var(--accent-ink); font-size: 0.74rem; font-weight: 760; letter-spacing: 0.08em; text-transform: uppercase; }
.finding h4 { margin: 0 0 6px; font-size: 1.05rem; line-height: 1.3; }
.finding > p { margin: 0 0 10px; color: var(--muted); font-size: 0.92rem; line-height: 1.5; }
.finding .chart { margin-top: 4px; }

/* ---------- results, detail panel, real robot (shared by both pages) ---------- */

/* results */
.results-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(280px, 1fr); gap: 14px; align-items: stretch; margin-bottom: 14px; }
.result-stats { margin-bottom: 14px; }
.result-stats .kpi { padding: 14px 16px; }
.result-stats .kpi-value { font-size: 1.7rem; }

.cell-detail { display: flex; flex-direction: column; gap: 10px; }
.cell-detail .cd-eyebrow { margin: 0; color: var(--muted); font-size: 0.74rem; font-weight: 760; letter-spacing: 0.08em; text-transform: uppercase; }
.cell-detail h4 { margin: 0; font-size: 1.05rem; line-height: 1.3; }
.cell-detail .cd-delta { font-size: 2rem; font-weight: 700; line-height: 1; }
.cell-detail .cd-delta small { margin-left: 4px; color: var(--muted); font-size: 0.9rem; font-weight: 600; }
.cell-detail .cd-thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cell-detail .cd-thumbs figure { margin: 0; }
.cell-detail .cd-thumbs img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 6px; background: #111; }
.cell-detail .cd-thumbs figcaption { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-top: 4px; color: var(--muted); font-size: 0.76rem; font-weight: 650; }
.cell-detail .btn { align-self: flex-start; }
.cell-detail .cd-hint { margin: 0; color: var(--faint); font-size: 0.78rem; }

.small-multiples { display: grid; grid-template-columns: repeat(var(--sm-cols, 3), minmax(0, 1fr)); gap: 8px 22px; }
.small-multiples h4 { margin: 4px 0 0; font-size: 0.92rem; }
.small-multiples .sm-sub { margin: 0; color: var(--muted); font-size: 0.8rem; }
.results-grid .chart-card + .chart-card { margin-top: 0; }
.summary-strip { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0 0 14px; color: var(--muted); font-size: 0.9rem; }
.summary-strip strong { color: var(--ink); font-size: 1.05rem; }

/* real robot */
.real-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.3fr); gap: 14px; align-items: start; }
.task-card { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.task-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.task-card .body { padding: 12px 14px; }
.task-card h4 { margin: 0 0 4px; font-size: 1rem; }
.task-card p { margin: 0; color: var(--muted); font-size: 0.86rem; line-height: 1.45; }
.real-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.real-head h3 { font-size: clamp(1.1rem, 2vw, 1.35rem); }
.real-pairs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.real-pair { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.real-pair h4 { margin: 0 0 10px; font-size: 0.95rem; }
.real-pair .duo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.real-pair figure { margin: 0; }
.real-pair figcaption { display: flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--muted); font-size: 0.8rem; font-weight: 650; }
.real-pair video { width: 100%; aspect-ratio: 16 / 9; border-radius: 8px; background: #111; object-fit: cover; }
.real-pair .video-placeholder { aspect-ratio: 16 / 9; padding: 10px; font-size: 0.78rem; }
.real-pair .video-placeholder strong { font-size: 0.82rem; }


.finding-span, .finding-wide { grid-column: 1 / -1; }
.finding-span > .finding-grid { gap: 14px; }
.finding .body { margin: 0 0 10px; color: var(--muted); font-size: 0.92rem; line-height: 1.5; }

/* ---------- bibtex / footer ---------- */

.bibtex {
  position: relative;
  margin: 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.84rem;
  line-height: 1.55;
  overflow-x: auto;
}

.copy-btn { position: absolute; top: 10px; right: 10px; }

.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.site-footer .container { padding: 26px 0; color: var(--muted); font-size: 0.88rem; text-align: center; }
.site-footer a { color: inherit; }

/* ---------- responsive ---------- */

@media (max-width: 1000px) {
  .results-grid { grid-template-columns: 1fr; }
  .small-multiples { grid-template-columns: 1fr; }
  .real-grid { grid-template-columns: 1fr 1fr; }
  .real-grid > :last-child { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .method-steps, .finding-grid { grid-template-columns: 1fr; }
  .top-nav .brand { display: none; }
  .top-nav nav { margin-left: 0; }
}

@media (max-width: 680px) {
  .container, .medium, .narrow { width: calc(100% - 28px); }
  .hero { padding-top: 36px; }
  .section { padding: 40px 0; }
  .pair-viewer { grid-template-columns: 1fr; }
  .real-pairs, .real-grid { grid-template-columns: 1fr; }
  .authors span { white-space: normal; }
  .prose p { text-align: left; }
  .transport { grid-template-columns: auto minmax(0, 1fr); }
  .transport .time { grid-column: 1 / -1; text-align: left; }
}

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

/* ======================================================================
   Shared page components (used by both project pages)
   ====================================================================== */

/* overview: media + paired baseline/ours bars */
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(250px, 1fr); gap: 16px; align-items: start; }
.overview-video video { aspect-ratio: 16 / 9; width: 100%; background: #111; }
.kpi-stack { display: grid; gap: 8px; }
.kpi-compact { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 12px; padding: 9px 14px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.kpi-compact .kpi-label { color: var(--ink); font-weight: 700; font-size: 0.95rem; }
.kpi-compact .kpi-delta { color: var(--ours-ink); font-weight: 750; font-size: 0.95rem; text-align: right; }
.kpi-bars { grid-column: 1 / -1; display: grid; gap: 4px; margin-top: 4px; }
.kpi-bar { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 8px; align-items: center; }
.kpi-bar .track { height: 10px; border-radius: 5px; background: #f1efe9; overflow: hidden; }
.kpi-bar .fill { height: 100%; border-radius: 5px; }
.kpi-bar b { font-size: 0.88rem; font-variant-numeric: tabular-nums; text-align: right; }
.kpi-legend { display: flex; gap: 16px; margin-top: 2px; color: var(--muted); font-size: 0.84rem; }

/* method: numbered steps driven by visuals */
.mstep { margin-top: 40px; }
.mstep:first-of-type { margin-top: 8px; }
.mstep-head { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; align-items: start; margin-bottom: 14px; }
.mstep-head .step-num { margin: 2px 0 0; }
.mstep-head h3 { font-size: clamp(1.15rem, 2vw, 1.4rem); font-weight: 760; }
.mstep-head p { margin: 4px 0 0; color: var(--muted); font-size: 0.98rem; max-width: 820px; }
.mstep-head .schematic-tag { margin-left: 6px; vertical-align: 1px; }
.slide-figure { margin: 0; padding: 10px; border-radius: 14px; background: #f0f5fc; }
.slide-figure img { width: 100%; height: auto; border-radius: 10px; }
.mstep > .slide-figure { max-width: 1000px; }

/* formula card: label top-left, formula, one-line gloss */
.logit-card { display: grid; gap: 4px; margin-top: 12px; padding: 12px 16px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.logit-label { font-weight: 700; font-size: 0.95rem; }
.logit-eq { color: var(--ink); font-size: 1.02rem; }
.logit-note { color: var(--muted); font-size: 0.86rem; }

/* analysis: takeaway line + three question/answer/chart cards */
.punch { margin-top: 34px; }
.punch:first-of-type { margin-top: 6px; }
.punch-kicker { margin: 0 0 6px; color: var(--ours-ink); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.punch-line { max-width: 940px; margin: 0 0 16px; color: var(--ink); font-size: clamp(1.15rem, 2vw, 1.45rem); font-weight: 700; line-height: 1.35; }
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.trio-card { position: relative; display: flex; flex-direction: column; padding: 16px 16px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.trio-card .chart-card-head { margin-bottom: 4px; padding-right: 64px; }
.trio-card .chart-tools { position: absolute; top: 12px; right: 12px; }
.trio-card .q { margin: 0; color: var(--muted); font-size: 0.74rem; font-weight: 760; letter-spacing: 0.08em; text-transform: uppercase; }
.trio-card .a { margin: 4px 0 2px; font-size: 1.12rem; font-weight: 760; line-height: 1.3; }
.trio-card .setup { margin: 0 0 6px; color: var(--muted); font-size: 0.84rem; line-height: 1.4; }
.trio-card .chart { margin-top: auto; }
.trio-card select, .card-select { align-self: flex-start; margin: 0 0 4px; padding: 3px 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 0.82rem; }
.trio-card .mini-chips { display: flex; gap: 4px; margin: 0 0 4px; }
.trio-card .mini-chips .chip { min-height: 26px; padding: 1px 10px; font-size: 0.8rem; }
.trio-card .stat-line { margin: 8px 0 0; padding-top: 8px; border-top: 1px solid var(--line); font-size: 0.86rem; color: var(--muted); }
.trio-card .stat-line b { color: var(--ink); }

/* real robot: chart + autoplaying paired mosaics */
.real-layout { display: grid; grid-template-columns: minmax(280px, 0.8fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.real-videos { display: grid; gap: 14px; }
.mosaic { margin: 0; }
.mosaic h4 { margin: 0 0 6px; font-size: 1rem; }
.mosaic-grid { display: grid; grid-template-columns: 74px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 4px 8px; }
.mosaic-cols { grid-column: 2; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); color: var(--muted); font-size: 0.8rem; font-weight: 700; text-align: center; }
.mosaic-rows { grid-row: 2; display: grid; grid-template-rows: 1fr 1fr; align-items: center; justify-items: end; font-size: 0.86rem; font-weight: 760; }
.mosaic-rows span { display: inline-flex; align-items: center; gap: 6px; }
.mosaic video, .mosaic .video-placeholder { grid-row: 2; grid-column: 2; width: 100%; border-radius: 8px; }
.mosaic video { background: #111; }

details.notes { margin-top: 10px; color: var(--muted); font-size: 0.85rem; }
details.notes summary { cursor: pointer; font-weight: 650; }

@media (max-width: 1000px) {
  .overview-grid, .trio, .real-layout { grid-template-columns: 1fr; }
  .kpi-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .kpi-stack { grid-template-columns: 1fr; }
}
.kpi-legend { flex-wrap: wrap; gap: 4px 16px; }
.kpi-legend > span:first-child:not(.legend-item) { flex-basis: 100%; }
