/* The learning router — shared styling for the project site.

   Its own identity rather than the homepage's terracotta: this corner of the
   site is a measurement report, and the instruments want ink and ochre on warm
   paper. Every colour below was checked for contrast against both surfaces
   before it was used as a mark. */

:root {
  color-scheme: light;
  --ground:  #f1efe9;
  --panel:   #fbfaf7;
  --sunk:    #e9e6dd;
  --ink:     #1b1c22;
  --ink-2:   #4a4c58;
  --muted:   #70727f;
  --line:    #ddd9cd;
  --line-2:  #c9c4b5;

  --accent:  #3d4ba8;   /* the decision */
  --signal:  #a66a00;   /* the measurement */
  --good:    #1d6b55;   /* the ceiling */
  --wash:    #eceef9;

  --display: "Newsreader", Georgia, "Times New Roman", serif;
  --body: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  --shadow: 0 1px 2px rgb(27 28 34 / .04), 0 16px 36px -26px rgb(27 28 34 / .4);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ground: #14151a; --panel: #1b1d24; --sunk: #101117;
    --ink: #eceef5; --ink-2: #c0c4d2; --muted: #8e92a4;
    --line: #282b35; --line-2: #3a3e4b;
    --accent: #8e9bf0; --signal: #d9a23f; --good: #45b391;
    --wash: #1e2130;
    --shadow: 0 1px 2px rgb(0 0 0 / .5), 0 16px 36px -26px rgb(0 0 0 / .9);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #14151a; --panel: #1b1d24; --sunk: #101117;
  --ink: #eceef5; --ink-2: #c0c4d2; --muted: #8e92a4;
  --line: #282b35; --line-2: #3a3e4b;
  --accent: #8e9bf0; --signal: #d9a23f; --good: #45b391;
  --wash: #1e2130;
  --shadow: 0 1px 2px rgb(0 0 0 / .5), 0 16px 36px -26px rgb(0 0 0 / .9);
}

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

body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: var(--body); font-size: 16px; line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 880px; margin: 0 auto; padding: 0 20px 90px; }
@media (max-width: 600px) { .wrap { padding: 0 16px 60px; } }

a { color: var(--accent); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
code, .m { font-family: var(--mono); font-size: .88em; }
code {
  background: var(--sunk); padding: 1px 5px; border-radius: 3px; color: var(--ink-2);
}

/* ---- masthead + nav ---- */
.masthead {
  border-bottom: 1px solid var(--line); margin-bottom: 34px;
  padding: 18px 0 0; background: var(--ground);
}
.masthead .inner {
  max-width: 880px; margin: 0 auto; padding: 0 20px;
  display: flex; flex-wrap: wrap; align-items: baseline;
  justify-content: space-between; gap: 10px 20px;
}
.wordmark {
  font-family: var(--display); font-weight: 700; font-size: 17px;
  letter-spacing: -.01em; text-decoration: none; color: var(--ink);
}
.wordmark span { color: var(--accent); }
.up { font-family: var(--mono); font-size: 11.5px; color: var(--muted); text-decoration: none; }
nav.tabs {
  max-width: 880px; margin: 0 auto; padding: 12px 20px 0;
  display: flex; gap: 2px; flex-wrap: wrap;
}
nav.tabs a {
  font-family: var(--mono); font-size: 12px; letter-spacing: .02em;
  text-decoration: none; color: var(--ink-2);
  padding: 7px 12px; border: 1px solid transparent; border-bottom: none;
  border-radius: 3px 3px 0 0; position: relative; top: 1px;
}
nav.tabs a:hover { color: var(--ink); background: var(--sunk); }
nav.tabs a[aria-current="page"] {
  color: var(--ink); background: var(--ground);
  border-color: var(--line); font-weight: 600;
}

/* ---- type ---- */
.eyebrow {
  font-family: var(--mono); font-size: 11px; letter-spacing: .15em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 12px;
}
h1 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(31px, 5.6vw, 44px); line-height: 1.12; letter-spacing: -.016em;
  margin: 0 0 16px; text-wrap: balance;
}
.standfirst {
  font-family: var(--display); font-size: clamp(18px, 2.5vw, 21px);
  line-height: 1.5; color: var(--ink-2); margin: 0 0 10px; max-width: 36em;
}
h2 {
  font-family: var(--display); font-weight: 600; font-size: 26px;
  letter-spacing: -.012em; margin: 54px 0 12px; text-wrap: balance;
}
h3 {
  font-family: var(--body); font-weight: 600; font-size: 15.5px;
  margin: 30px 0 8px; letter-spacing: .005em;
}
p { margin: 0 0 16px; max-width: 68ch; }
.lede { color: var(--ink-2); }
ul, ol { max-width: 68ch; padding-left: 22px; }
li { margin-bottom: 8px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 46px 0; }

/* ---- panels ---- */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 4px; padding: 20px; margin: 20px 0;
}
.panel.lift { box-shadow: var(--shadow); border-top: 3px solid var(--accent); }
.k {
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted);
}
.bignum {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(38px, 8.5vw, 58px); line-height: 1; letter-spacing: -.03em;
  color: var(--accent); margin: 6px 0 2px; font-variant-numeric: tabular-nums;
}
.bigsub { color: var(--ink-2); margin: 0 0 20px; max-width: 48ch; }

/* ---- bar comparison ---- */
.bars { display: flex; flex-direction: column; gap: 13px; }
.bar { display: grid; grid-template-columns: 140px minmax(0,1fr) 60px; gap: 12px; align-items: center; }
.bar .lbl { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.bar .val {
  font-family: var(--mono); font-size: 13px; font-weight: 600;
  text-align: right; font-variant-numeric: tabular-nums;
}
.track { position: relative; height: 22px; background: var(--sunk); border-radius: 2px; overflow: hidden; }
.fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 2px; transition: width .7s cubic-bezier(.2,.7,.2,1); }
.bar.router .fill { background: var(--accent); }
.bar.router .val { color: var(--accent); }
.bar.base .fill { background: var(--signal); }
.bar.base .val { color: var(--signal); }
.bar.ceil .fill { background: transparent; border-right: 2px dashed var(--good); }
.bar.ceil .val { color: var(--good); }
.seedline {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  margin: 15px 0 0; padding-top: 13px; border-top: 1px solid var(--line);
  overflow-x: auto; white-space: nowrap;
}
@media (max-width: 560px) {
  .bar { grid-template-columns: 102px minmax(0,1fr) 52px; gap: 8px; }
  .bar .lbl { font-size: 11px; }
}

/* ---- controls ---- */
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
label.f {
  display: block; font-family: var(--mono); font-size: 10px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px;
}
input[type=text], select {
  font-family: var(--mono); font-size: 13px; color: var(--ink);
  background: var(--sunk); border: 1px solid var(--line-2);
  border-radius: 3px; padding: 8px 10px; width: 100%;
}
input[type=range] { width: 100%; accent-color: var(--accent); }
button {
  font-family: var(--body); font-size: 13px; font-weight: 600; cursor: pointer;
  color: var(--ink); background: var(--panel);
  border: 1px solid var(--line-2); border-radius: 3px; padding: 9px 14px;
  transition: background .12s ease, border-color .12s ease;
}
button:hover { background: var(--wash); border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { filter: brightness(1.08); }
:root[data-theme="dark"] button.primary,
:root:not([data-theme="light"]) button.primary { color: #11131c; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) button.primary { color: #fff; }
}
button[disabled] { opacity: .5; cursor: not-allowed; }

.verdict {
  font-family: var(--mono); font-size: 13px; line-height: 1.7;
  background: var(--sunk); border: 1px solid var(--line);
  border-left: 3px solid var(--line-2); border-radius: 3px;
  padding: 12px 14px; margin-top: 14px;
  white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-2);
}
.verdict.on { border-left-color: var(--accent); }
.verdict b { color: var(--ink); font-weight: 600; }

/* ---- arms table ---- */
.armhead, .arm {
  display: grid; grid-template-columns: 112px minmax(0,1fr) 54px 50px; gap: 10px;
}
.armhead {
  font-family: var(--mono); font-size: 10px; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted); padding-bottom: 6px;
}
.armhead .r, .arm .n, .arm .mean { text-align: right; }
.arm { align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.arm:first-child { border-top: 1px solid var(--line); }
.arm .id { font-family: var(--mono); font-size: 12px; font-weight: 500; }
.arm .n, .arm .mean {
  font-family: var(--mono); font-size: 12px;
  font-variant-numeric: tabular-nums; color: var(--ink-2);
}
.arm .mean { color: var(--ink); font-weight: 600; }
.arm.lead .id, .arm.lead .mean { color: var(--accent); }
.ci svg { display: block; width: 100%; height: 18px; }
@media (max-width: 520px) {
  .armhead, .arm { grid-template-columns: 94px minmax(0,1fr) 42px 44px; gap: 7px; }
}

/* ---- misc ---- */
.note { font-size: 14px; color: var(--muted); max-width: 68ch; }
.pill {
  display: inline-block; font-family: var(--mono); font-size: 11px;
  padding: 3px 9px; border: 1px solid var(--line-2); border-radius: 999px;
  color: var(--ink-2); margin: 0 6px 7px 0;
}
pre {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
  background: var(--sunk); border: 1px solid var(--line);
  border-radius: 3px; padding: 14px 16px; overflow-x: auto; color: var(--ink-2);
}
pre b { color: var(--ink); font-weight: 600; }
table.data { border-collapse: collapse; width: 100%; font-size: 14px; margin: 18px 0; }
table.data th, table.data td {
  text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.data th {
  font-family: var(--mono); font-size: 10px; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted); font-weight: 500;
}
table.data td.m, table.data td:last-child { font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; }

.callout {
  border-left: 3px solid var(--signal); background: var(--panel);
  border-radius: 0 3px 3px 0; padding: 14px 18px; margin: 22px 0;
}
.callout p:last-child { margin-bottom: 0; }
.callout .k { color: var(--signal); }

footer {
  margin-top: 60px; padding-top: 20px; border-top: 1px solid var(--line);
  font-size: 14px; color: var(--muted);
}
footer p { max-width: 68ch; }
