:root {
  --bg: #ECEFF1;
  --paper: #F6F8F9;
  --ink: #1B2330;
  --muted: #5A6573;
  --rule: #CDD5DC;
  --reach: #1E5C86;
  --now: #B7791F;
  --track: #DCE2E7;
  --sans: "Archivo", system-ui, sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --measure: 40rem;
  --wide: 68rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141A21; --paper: #1A222B; --ink: #E2E7EB; --muted: #96A1AD;
    --rule: #2C3743; --reach: #6FAEDB; --now: #E0A84A; --track: #26313C;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141A21; --paper: #1A222B; --ink: #E2E7EB; --muted: #96A1AD;
  --rule: #2C3743; --reach: #6FAEDB; --now: #E0A84A; --track: #26313C;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 1.0625rem/1.65 var(--serif);
  font-optical-sizing: auto;
}
a { color: var(--reach); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--reach); outline-offset: 3px; }
code { font: 0.86em var(--mono); background: var(--paper); padding: 0.05em 0.3em; border-radius: 3px; }

.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 16px; }
.prose { max-width: var(--measure); }
@media (min-width: 900px) { .wrap { padding: 0 40px; } }

.back { display: inline-block; margin: 28px 0 0; font: 500 0.875rem var(--sans); color: var(--muted); text-decoration: none; }
.back:hover { color: var(--ink); }

/* Hero */
.hero { padding: 56px 0 40px; }
.hero h1 {
  font: 800 clamp(2.6rem, 8.5vw, 6.2rem)/0.92 var(--sans);
  font-stretch: 125%; letter-spacing: -0.02em; margin: 0 0 28px;
}
.hero h1 span { display: block; font-stretch: 62%; font-weight: 500; color: var(--muted); }
.lede { font-size: 1.25rem; line-height: 1.55; margin: 0 0 14px; }
.meta { font: 400 0.9375rem/1.5 var(--sans); color: var(--muted); margin: 0; }
.hero-media { margin: 36px 0 0; }

/* Headings */
h2 {
  font: 700 clamp(1.6rem, 3.6vw, 2.3rem)/1.1 var(--sans); font-stretch: 112%;
  letter-spacing: -0.01em; margin: 0 0 18px;
}
h3 { font: 650 1.1875rem/1.3 var(--sans); margin: 34px 0 10px; }
section { padding: 64px 0 8px; border-top: 1px solid var(--rule); margin-top: 48px; }
p { margin: 0 0 1em; }
ul.tight { padding-left: 1.2em; margin: 0 0 1em; }
ul.tight li { margin-bottom: 0.45em; }
.paper-ref { font: 400 0.9375rem/1.5 var(--sans); color: var(--muted); margin: -8px 0 22px; }
blockquote {
  margin: 22px 0; padding: 0 0 0 18px; border-left: 3px solid var(--reach);
  font-style: italic; font-size: 1.125rem;
}

/* Ledger: the progress tracks */
.ledger { margin: 28px 0 0; font-family: var(--sans); }
.stages, .lrow { display: grid; grid-template-columns: minmax(10rem, 15rem) 1fr minmax(14rem, 22rem); gap: 0 28px; align-items: center; }
.stages { font-size: 0.8125rem; color: var(--muted); padding-bottom: 8px; border-bottom: 1px solid var(--rule); }
.stages .ticks { display: grid; grid-template-columns: repeat(4, 1fr); }
.lrow { padding: 16px 0; border-bottom: 1px solid var(--rule); color: inherit; text-decoration: none; }
a.lrow:hover .name { text-decoration: underline; text-underline-offset: 0.18em; }
.name { font-weight: 700; font-size: 1.0625rem; }
.src { display: block; font-size: 0.8125rem; color: var(--muted); margin-top: 2px; }
.track { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.track i { height: 14px; background: var(--track); border-radius: 2px; }
.track i.on { background: var(--reach); }
.lrow.live .track i.on { background: var(--now); }
.verdict { font-size: 0.9375rem; line-height: 1.45; }
.verdict b { font-weight: 600; }
.stage-key { display: none; }
@media (max-width: 760px) {
  .stages { display: none; }
  .lrow { grid-template-columns: 1fr; gap: 8px; }
  .stage-key { display: block; font-size: 0.8125rem; color: var(--muted); }
}

/* Timeline */
.timeline { list-style: none; margin: 18px 0 0; padding: 0; font-family: var(--sans); max-width: 48rem; }
.timeline li { display: grid; grid-template-columns: 5.5rem 1fr; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--rule); font-size: 0.9375rem; line-height: 1.45; }
.timeline time { color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline .hw { font-weight: 600; }

/* Figures */
figure { margin: 28px 0; }
video, figure img { display: block; width: 100%; height: auto; border-radius: 4px; background: var(--track); }
figcaption { font: 400 0.875rem/1.45 var(--sans); color: var(--muted); margin-top: 8px; max-width: var(--measure); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 20px; margin: 28px 0; }
.grid2 figure { margin: 0; }

/* Pipeline diagram */
.pipe { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0; margin: 28px 0; font-family: var(--sans); max-width: var(--wide); }
.pipe .box { flex: 1 1 9rem; background: var(--paper); border: 1px solid var(--rule); border-radius: 4px; padding: 12px 14px; font-size: 0.875rem; line-height: 1.4; }
.pipe .box b { display: block; font-size: 0.9375rem; margin-bottom: 4px; }
.pipe .box.priv { border-style: dashed; color: var(--muted); }
.pipe .arrow { flex: 0 0 28px; display: flex; align-items: center; justify-content: center; color: var(--muted); }
@media (max-width: 640px) { .pipe { flex-direction: column; } .pipe .box { flex: none; } .pipe .arrow { flex-basis: 24px; transform: rotate(90deg); } }

/* Numbers table */
table.nums { border-collapse: collapse; font-family: var(--sans); font-size: 0.9375rem; margin: 18px 0 24px; font-variant-numeric: tabular-nums; }
table.nums th, table.nums td { text-align: right; padding: 6px 14px 6px 0; border-bottom: 1px solid var(--rule); }
table.nums th:first-child, table.nums td:first-child { text-align: left; }
table.nums thead th { font-weight: 500; color: var(--muted); font-size: 0.8125rem; }
.scroll-x { overflow-x: auto; }

/* Hardware log with date gutter */
.log { margin: 22px 0 0; }
.entry { display: grid; grid-template-columns: 7rem minmax(0, var(--measure)); gap: 0 28px; padding: 18px 0; border-bottom: 1px solid var(--rule); }
.entry time { font: 500 0.875rem/1.9 var(--sans); color: var(--muted); font-variant-numeric: tabular-nums; }
.entry h4 { font: 650 1.0625rem/1.35 var(--sans); margin: 0 0 6px; }
.entry p:last-child { margin-bottom: 0; }
@media (max-width: 640px) { .entry { grid-template-columns: 1fr; } }

.gait-frame { width: 100%; height: 640px; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); }
@media (max-width: 640px) { .gait-frame { height: 560px; } }

footer { margin: 72px 0 0; padding: 28px 0 48px; border-top: 1px solid var(--rule); font: 400 0.875rem/1.5 var(--sans); color: var(--muted); }

/* Shared across A1 pages */
.crumbs { margin: 28px 0 0; font: 500 0.875rem var(--sans); color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.hero.paper { padding-bottom: 8px; }
.hero.paper h1 { font-size: clamp(2.4rem, 7vw, 4.8rem); }
.status-line { display: flex; align-items: center; gap: 14px; margin: 18px 0 0; font: 500 0.9375rem var(--sans); }
.status-line .track { width: 12rem; flex: none; }

/* Lab reports: hosted copies of artifacts made along the way */
.reports { list-style: none; margin: 18px 0 0; padding: 0; font-family: var(--sans); max-width: 52rem; }
.reports li { display: grid; grid-template-columns: 6rem 1fr; gap: 4px 20px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.reports time { color: var(--muted); font-size: 0.875rem; font-variant-numeric: tabular-nums; padding-top: 2px; }
.reports a { font-weight: 600; font-size: 1rem; }
.reports p { grid-column: 2; margin: 2px 0 0; font-size: 0.9375rem; line-height: 1.45; color: var(--muted); }
.reports .tag { display: inline-block; margin-left: 8px; font-size: 0.75rem; font-weight: 600; color: var(--now); }
@media (max-width: 640px) { .reports li { grid-template-columns: 1fr; } .reports p { grid-column: 1; } }

/* Prev / next between paper pages */
.pager { display: flex; justify-content: space-between; gap: 20px; margin: 64px 0 0; padding-top: 20px; border-top: 1px solid var(--rule); font: 500 0.9375rem var(--sans); }
.pager a { text-decoration: none; }
.pager span { display: block; font-size: 0.8125rem; color: var(--muted); font-weight: 400; }
.pager .next { text-align: right; margin-left: auto; }
.status-line.live .track i.on { background: var(--now); }

/* 16:9 embed */
.yt { position: relative; aspect-ratio: 16 / 9; background: var(--track); border-radius: 4px; overflow: hidden; }
.yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* CAD renders and plots drawn on white: keep them on a light card in dark mode too */
.card-fig img { background: #fff; padding: 8px; }
