@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/fraunces-normal-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D1, U+02D7-02FF, U+1E00-1EFF, U+2010-2027, U+20AC, U+2122, U+2190-21FF, U+2212;
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/fraunces-normal-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/fraunces-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D1, U+02D7-02FF, U+1E00-1EFF, U+2010-2027, U+20AC, U+2122, U+2190-21FF, U+2212;
}
@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/fraunces-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/source-serif-4-normal-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D1, U+02D7-02FF, U+1E00-1EFF, U+2010-2027, U+20AC, U+2122, U+2190-21FF, U+2212;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/source-serif-4-normal-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/source-serif-4-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D1, U+02D7-02FF, U+1E00-1EFF, U+2010-2027, U+20AC, U+2122, U+2190-21FF, U+2212;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/source-serif-4-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plex Sans";
  font-style: normal;
  font-weight: 500 600;
  font-display: swap;
  src: url("fonts/IBMPlexSans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D1, U+02D7-02FF, U+1E00-1EFF, U+2010-2027, U+20AC, U+2122, U+2190-21FF, U+2212;
}
@font-face {
  font-family: "Plex Sans";
  font-style: normal;
  font-weight: 500 600;
  font-display: swap;
  src: url("fonts/IBMPlexSans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/IBMPlexMono-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D1, U+02D7-02FF, U+1E00-1EFF, U+2010-2027, U+20AC, U+2122, U+2190-21FF, U+2212;
}
@font-face {
  font-family: "Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/IBMPlexMono-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/IBMPlexMono-600-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D1, U+02D7-02FF, U+1E00-1EFF, U+2010-2027, U+20AC, U+2122, U+2190-21FF, U+2212;
}
@font-face {
  font-family: "Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/IBMPlexMono-600-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+FEFF, U+FFFD;
}

:root {
  --display: "Fraunces", Georgia, serif;
  --serif: "Source Serif 4", Georgia, serif;
  --ui: "Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --bg: #f5f0e4;
  --surface: #ebe4d4;
  --surface-elev: #e1d8c4;
  --ink: #171512;
  --ink-muted: #464037;
  --accent: #7a4e05;
  --accent-soft: rgba(122, 78, 5, 0.14);
  --accent-ink: #fdfaf2;
  --left: #a62c19;
  --right: #114c78;
  --danger: #9e1c1c;
  --ok: #175c37;
  --rule: rgba(23, 21, 18, 0.17);
  --rule-strong: rgba(23, 21, 18, 0.34);

  --sr-line: rgba(23, 21, 18, 0.34);
  --sr-ink: #171512;
  --sr-acc: #7a4e05;
  --sr-ok: #175c37;

  --to-top-bg: #ebe4d4;
  --to-top-fg: #171512;
  --bar-h: 46px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0b0e;
    --surface: #151319;
    --surface-elev: #1e1b24;
    --ink: #f3ede0;
    --ink-muted: #c4baa8;
    --accent: #e0b15c;
    --accent-soft: rgba(224, 177, 92, 0.16);
    --accent-ink: #120f08;
    --left: #f27461;
    --right: #63bce8;
    --danger: #ff7b7b;
    --ok: #78d19e;
    --rule: rgba(243, 237, 224, 0.16);
    --rule-strong: rgba(243, 237, 224, 0.34);

    --sr-line: rgba(243, 237, 224, 0.32);
    --sr-ink: #f3ede0;
    --sr-acc: #e0b15c;
    --sr-ok: #78d19e;

    --to-top-bg: #1e1b24;
    --to-top-fg: #f3ede0;
  }
}

html[data-theme="dark"] {
  --bg: #0c0b0e;
  --surface: #151319;
  --surface-elev: #1e1b24;
  --ink: #f3ede0;
  --ink-muted: #c4baa8;
  --accent: #e0b15c;
  --accent-soft: rgba(224, 177, 92, 0.16);
  --accent-ink: #120f08;
  --left: #f27461;
  --right: #63bce8;
  --danger: #ff7b7b;
  --ok: #78d19e;
  --rule: rgba(243, 237, 224, 0.16);
  --rule-strong: rgba(243, 237, 224, 0.34);

  --sr-line: rgba(243, 237, 224, 0.32);
  --sr-ink: #f3ede0;
  --sr-acc: #e0b15c;
  --sr-ok: #78d19e;

  --to-top-bg: #1e1b24;
  --to-top-fg: #f3ede0;
}

[hidden] { display: none !important; }
svg[hidden] { display: none !important; }

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

html {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.62;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--bar-h) + var(--browser-safe-top, env(safe-area-inset-top)) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  overflow-x: clip;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 0.9rem/1 var(--ui);
  text-decoration: none;
}
.skip-link:focus { left: 12px; top: 12px; }

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 14px;
  height: calc(var(--bar-h) + var(--browser-safe-top, env(safe-area-inset-top)));
  padding: var(--browser-safe-top, env(safe-area-inset-top)) 18px 0;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  font: 500 0.9rem/1 var(--ui);
}

.home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--ui);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.home:hover, .home:focus-visible { color: var(--accent); }
.home-disc { flex-shrink: 0; color: var(--accent); }

.topnav {
  display: flex;
  align-items: center;
  gap: 14px;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
  min-width: 0;
}
.topnav::-webkit-scrollbar { display: none; }
.topnav a {
  color: var(--ink-muted);
  text-decoration: none;
  padding: 12px 2px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.topnav a:hover, .topnav a:focus-visible { color: var(--ink); }
.topnav a[aria-current="true"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.spacer { flex: 1 1 auto; }

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--ui);
  font-weight: 600;
  font-size: 0.82rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.chip:hover, .chip:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--rule-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  flex-shrink: 0;
}
.icon-btn svg { display: block; }
.icon-btn svg[hidden] { display: none !important; }
.icon-btn:hover, .icon-btn:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.progress-track {
  position: fixed;
  left: 0;
  right: 0;
  top: calc(var(--bar-h) + var(--browser-safe-top, env(safe-area-inset-top)) - 1px);
  height: 2px;
  z-index: 95;
  pointer-events: none;
}
.progress-fill {
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform-origin: left center;
  transform: scaleX(0);
}

/* Reading rail */
.rail {
  position: fixed;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}
.rail a {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 18px;
  height: 18px;
  text-decoration: none;
}
.rail-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--rule-strong);
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.rail a[aria-current="true"] .rail-dot,
.rail a:hover .rail-dot,
.rail a:focus-visible .rail-dot {
  background: var(--accent);
  transform: scale(1.45);
}
.rail-label {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--surface-elev);
  border: 1px solid var(--rule);
  color: var(--ink);
  font: 500 0.78rem/1.2 var(--ui);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease;
}
.rail a:hover .rail-label,
.rail a:focus-visible .rail-label {
  opacity: 1;
}
@media (max-width: 1240px) {
  .rail { display: none; }
}

/* Main layout */
main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 20px 64px;
}

section {
  scroll-margin-top: calc(var(--bar-h) + var(--browser-safe-top, env(safe-area-inset-top)) + 20px);
}

.hero-header {
  max-width: 86ch;
  margin: 0 0 14px;
}

.kicker {
  margin: 0 0 6px;
  font: 600 0.78rem/1.3 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.5rem, 2.55vw, 2.15rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.standfirst {
  margin: 0;
  font-size: clamp(0.98rem, 1.25vw, 1.1rem);
  line-height: 1.5;
  color: var(--ink-muted);
  max-width: 74ch;
}

.formula-inline { font-family: var(--mono); }
.tbl-cap { padding: 10px 14px; text-align: left; font-weight: 600; }
.lab-stack-gap { margin-top: 12px; }
.calc-badge { border-top: none; padding-top: 0; font-weight: 600; }
.calc-share-row { margin: 14px 0 0; border-bottom: none; padding-bottom: 0; }

/* Workbench */
.workbench {
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
  margin-bottom: 18px;
}

.workbench-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  border-bottom: 1px solid var(--rule);
}

.stage-pane {
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stage-pane + .stage-pane {
  border-left: 1px solid var(--rule);
}

.pane-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.pane-title {
  font: 600 0.8rem/1.2 var(--mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
}
.pane-sub {
  font: 400 0.78rem/1.2 var(--mono);
  color: var(--ink-muted);
}

.canvas-wrap {
  position: relative;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow: hidden;
}
.canvas-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  cursor: pointer;
}

.telemetry-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding-top: 2px;
}
.tel-cell {
  border-top: 1px solid var(--rule);
  padding-top: 6px;
  min-width: 0;
}
.tel-k {
  display: block;
  font: 400 0.7rem/1.2 var(--mono);
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tel-v {
  display: block;
  font: 600 0.96rem/1.3 var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}
.tel-v.is-warn { color: var(--danger); }
.tel-v.is-ok { color: var(--ok); }

/* Studio Console */
.console {
  padding: 14px 16px 16px;
  background: var(--surface-elev);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.console-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 0.92rem/1.1 var(--ui);
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary[data-on="true"] {
  background: transparent;
  color: var(--accent);
}
.btn-primary:hover, .btn-primary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.radius-control {
  flex: 1 1 240px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.radius-control label {
  font: 500 0.8rem/1.2 var(--mono);
  color: var(--ink-muted);
  white-space: nowrap;
}
.radius-control input[type="range"] {
  flex: 1 1 auto;
  min-width: 90px;
  accent-color: var(--accent);
  min-height: 36px;
}

.seg-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.ctrl-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.ctrl-label {
  font: 600 0.72rem/1.2 var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.seg-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.seg-btn {
  min-height: 36px;
  padding: 4px 9px;
  border: 1px solid var(--rule-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  font: 500 0.8rem/1.2 var(--ui);
  cursor: pointer;
  white-space: nowrap;
}
.seg-btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
  font-weight: 600;
}
.seg-btn:hover, .seg-btn:focus-visible {
  border-color: var(--accent);
}

.select-input {
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid var(--rule-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  font: 500 0.85rem/1.2 var(--ui);
  width: 100%;
}

.live-status {
  margin: 0;
  font: 400 0.85rem/1.45 var(--ui);
  color: var(--ink);
  padding-top: 6px;
  border-top: 1px solid var(--rule);
}

/* Share row */
.share-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 12px 0 36px;
  padding: 10px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.share-label {
  font: 500 0.82rem/1.2 var(--ui);
  color: var(--ink-muted);
}
.share-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--sr-line);
  background: transparent;
  color: var(--sr-ink);
  text-decoration: none;
  cursor: pointer;
}
.sr-btn:hover, .sr-btn:focus-visible {
  border-color: var(--sr-acc);
  color: var(--sr-acc);
}
.share-feedback {
  font: 400 0.82rem/1.2 var(--ui);
  color: var(--sr-ok);
  min-height: 1em;
}
@media (pointer: coarse) {
  .sr-btn { width: 44px; height: 44px; }
}

/* Editorial Chapters */
.chapter {
  padding: 44px 0 12px;
  border-top: 1px solid var(--rule);
}
.chapter-head {
  max-width: 68ch;
  margin-bottom: 22px;
}
.chapter-num {
  display: block;
  font: 600 0.78rem/1.2 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
h2 {
  margin: 0 0 10px;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.38rem, 2.3vw, 1.92rem);
  line-height: 1.18;
  color: var(--ink);
}
.prose {
  max-width: 65ch;
  font-size: 1.04rem;
  line-height: 1.66;
}
.prose p {
  margin: 0 0 15px;
}
.prose strong { color: var(--ink); }

.finding-band {
  margin: 20px 0 24px;
  padding: 16px 20px;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  max-width: 65ch;
}
.finding-band p { margin: 0; }
.finding-kicker {
  display: block;
  font: 600 0.74rem/1.2 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}

/* Interactive Labs inside chapters */
.lab-panel {
  margin: 22px 0 26px;
  padding: 16px;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  background: var(--surface);
}
.lab-split {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.9fr);
  gap: 18px;
  align-items: start;
}
.lab-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.slider-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.slider-row label {
  display: flex;
  justify-content: space-between;
  font: 500 0.82rem/1.2 var(--ui);
  color: var(--ink);
}
.slider-row input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  min-height: 34px;
}
.lab-readout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--rule);
}

/* Figures & Tables */
.archival-fig {
  margin: 24px 0;
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}
.archival-fig img {
  display: block;
  width: 100%;
  height: auto;
}
.archival-fig figcaption {
  padding: 12px 16px;
  font: 400 0.88rem/1.5 var(--ui);
  color: var(--ink-muted);
  border-top: 1px solid var(--rule);
}
.archival-fig figcaption a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.table-scroll {
  margin: 20px 0 24px;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
}
table {
  width: 100%;
  border-collapse: collapse;
  font: 400 0.9rem/1.45 var(--ui);
  text-align: left;
}
th, td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
th {
  font: 600 0.76rem/1.3 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  background: var(--surface-elev);
}
td.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
tr:last-child td { border-bottom: none; }

/* Micron scale bar */
.micron-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 20px 0 24px;
}
.micron-item {
  padding: 10px 12px;
  border-top: 2px solid var(--accent);
  background: var(--surface);
}
.micron-val {
  display: block;
  font: 600 1.05rem/1.2 var(--mono);
  color: var(--ink);
}
.micron-desc {
  display: block;
  margin-top: 4px;
  font: 400 0.8rem/1.35 var(--ui);
  color: var(--ink-muted);
}

/* Custom Cut Calculator */
.calc-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.15fr);
  gap: 20px;
  margin: 20px 0;
}
.calc-box, .calc-result {
  padding: 18px;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  background: var(--surface);
}
.calc-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.calc-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}
.calc-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: 500 0.86rem/1.2 var(--ui);
  cursor: pointer;
}
.btn-ghost:hover, .btn-ghost:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

/* Chronology & Sources */
.chrono-list {
  list-style: none;
  padding: 0;
  margin: 18px 0 24px;
  max-width: 68ch;
}
.chrono-list li {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
}
.chrono-year {
  font: 600 0.9rem/1.4 var(--mono);
  color: var(--accent);
}
.sources-list {
  padding-left: 20px;
  max-width: 68ch;
  font: 400 0.92rem/1.55 var(--ui);
}
.sources-list li { margin-bottom: 8px; }
.sources-list a { color: var(--accent); }

/* Canonical Footer */
.site-footer {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 20px 48px;
  border-top: 1px solid var(--rule-strong);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  align-items: center;
  font: 400 0.88rem/1.5 var(--ui);
  color: var(--ink-muted);
}
.site-footer a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.site-footer a:hover, .site-footer a:focus-visible { color: var(--accent); }

/* Responsive */
@media (max-width: 920px) {
  .workbench-grid,
  .lab-split,
  .calc-grid {
    grid-template-columns: 1fr;
  }
  .stage-pane + .stage-pane {
    border-left: none;
    border-top: 1px solid var(--rule);
  }
  .seg-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .micron-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  main { padding: 18px 14px 48px; }
  .topbar { padding-left: 12px; padding-right: 12px; gap: 10px; }
  .telemetry-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .seg-row { grid-template-columns: 1fr; }
  .calc-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .micron-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chrono-list li { grid-template-columns: 1fr; gap: 2px; }
}
