/* Layout: one reading column on a cool river-grey ground; a header plate carries the status key, and tables scroll inside their own bands. */
:root {
  --bg: #f4f7f8;
  --surface: #ffffff;
  --fg: #16212a;
  --muted: #536370;
  --rule: #d3dce1;
  --accent: #1c5e89;
  --accent-soft: #e2edf4;
  --ok: #285f37;  --ok-bg: #e2f0e6;
  --warn: #7f5208; --warn-bg: #f7edd6;
  --bad: #95301f; --bad-bg: #f5e1dc;
  --neutral-bg: #e9eef1;
  --code-bg: #ebf0f3;
  --font-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --font-body: "Public Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --measure: 46rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e151a; --surface: #141e25; --fg: #e1e9ed; --muted: #97a7b2; --rule: #283640;
    --accent: #72b3de; --accent-soft: #16303f;
    --ok: #8fd0a0; --ok-bg: #16301f; --warn: #e6bf78; --warn-bg: #342711;
    --bad: #f0a093; --bad-bg: #3a1c17; --neutral-bg: #1d2a33; --code-bg: #1a252d;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e151a; --surface: #141e25; --fg: #e1e9ed; --muted: #97a7b2; --rule: #283640;
  --accent: #72b3de; --accent-soft: #16303f;
  --ok: #8fd0a0; --ok-bg: #16301f; --warn: #e6bf78; --warn-bg: #342711;
  --bad: #f0a093; --bad-bg: #3a1c17; --neutral-bg: #1d2a33; --code-bg: #1a252d;
  color-scheme: dark;
}
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
}
.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 2.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
a { color: var(--accent); text-underline-offset: 2px; overflow-wrap: anywhere; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* Header plate */
.plate {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-top: 4px solid var(--accent);
  border-radius: 6px;
  padding: 1.5rem clamp(1rem, 4vw, 2rem);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 6vw, 2.75rem);
  line-height: 1.05;
  letter-spacing: 0.005em;
  margin: 0;
  text-wrap: balance;
}
.subtitle {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.3rem;
  line-height: 1.2;
  color: var(--accent);
  margin: 0;
  text-wrap: balance;
}
.plate-body { font-size: 0.92rem; color: var(--muted); }
.plate-body p { margin: 0.4rem 0; }
.plate-body > ul {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
  display: grid;
  gap: 0.6rem;
}
.plate-body > ul > li { display: grid; gap: 0.15rem; justify-items: start; }
.plate-body > ul > li > ul { list-style: none; padding: 0; margin: 0; color: var(--fg); }

/* Bottom line: the answer, ahead of everything else in the header */
.bottomline {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: 4px;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.bottomline p { margin: 0; }
.bottomline .bl-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.bottomline .bl-head {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  line-height: 1.2;
  text-wrap: balance;
}
.bottomline .bl-more { font-size: 0.9rem; }

/* Contents */
.toc {
  font-size: 0.9rem;
  border-left: 2px solid var(--rule);
  padding-left: 1rem;
}
.toc h2 {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.5rem;
  border: 0;
  padding: 0;
}
.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2 14rem;
  column-gap: 2rem;
}
.toc li { break-inside: avoid; padding: 0.15rem 0; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }

/* Sections */
.sec {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.sec > * { margin: 0 0 0.9rem; }
.sec h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.75rem;
  line-height: 1.15;
  margin: 0 0 1rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule);
  text-wrap: balance;
  scroll-margin-top: 1rem;
}
.sec h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.3rem;
  line-height: 1.2;
  margin: 1.25rem 0 0.6rem;
  color: var(--accent);
  text-wrap: balance;
  scroll-margin-top: 1rem;
}
.sec p { max-width: 68ch; }
.sec ul, .sec ol { padding-left: 1.4rem; max-width: 68ch; }
.sec li { margin: 0.25rem 0; }
.sec li > ul, .sec li > ol { margin: 0.25rem 0; }
.sec li::marker { color: var(--muted); }
strong { font-weight: 700; }
code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  overflow-wrap: anywhere;
}

/* Tables */
.tw {
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
  min-width: 0;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.88rem;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--rule);
}
th {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--accent-soft);
  white-space: nowrap;
}
tr:last-child td { border-bottom: 0; }
td[style*="right"], th[style*="right"] { font-family: var(--font-mono); white-space: nowrap; }

/* Status chips */
.st {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0.02em;
  padding: 0.12em 0.5em;
  border-radius: 999px;
  white-space: normal;
  vertical-align: 0.05em;
}
.st-ok { color: var(--ok); background: var(--ok-bg); }
.st-warn { color: var(--warn); background: var(--warn-bg); }
.st-bad { color: var(--bad); background: var(--bad-bg); }
.st-muted { color: var(--muted); background: var(--neutral-bg); }
.st-accent { color: var(--accent); background: var(--accent-soft); }

/* Bibliography */
.biblio p { margin: 1.1rem 0 0.3rem; }
.biblio p strong { font-weight: 600; }
.biblio ul {
  list-style: none;
  padding-left: 0.9rem;
  border-left: 2px solid var(--rule);
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0;
}
.biblio li { margin: 0.15rem 0; overflow-wrap: anywhere; }

/* Site navigation, shared by every page */
.sitenav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin-bottom: -1rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sitenav a { color: var(--muted); text-decoration: none; padding-block: 0.25rem; }
.sitenav a:hover { color: var(--accent); text-decoration: underline; }
.sitenav a[aria-current="page"] { color: var(--accent); font-weight: 500; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
@media (max-width: 480px) {
  body { font-size: 15px; }
  .sec h2 { font-size: 1.5rem; }
}
