/* SC-WBD public site.
 *
 * Restrained by intent.  The chrome is monochrome; the only colour on the page
 * is a status colour attached to a measured result, so colour always means
 * something.  System fonts only — no CDN, no webfont download, no layout shift.
 */

:root {
  --bg: #ffffff;
  --bg-soft: #f7f7f5;
  --bg-code: #f4f4f1;
  --ink: #17181a;
  --ink-2: #55575c;
  --ink-3: #7d8085;
  --rule: #e3e3df;
  --rule-strong: #c8c8c3;
  --pass: #1a6b41;
  --fail: #9e2620;
  --unknown: #6c6f74;
  --todo-ink: #7a4e00;
  --todo-bg: #fdf6e6;
  --todo-rule: #d9a441;

  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --measure: 36rem;
  --margin-col: 19rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101215;
    --bg-soft: #171a1e;
    --bg-code: #191c21;
    --ink: #e5e7ea;
    --ink-2: #a6a9af;
    --ink-3: #7e8288;
    --rule: #272b31;
    --rule-strong: #3b4047;
    --pass: #5fbf8b;
    --fail: #ee7f74;
    --unknown: #90949a;
    --todo-ink: #f0c069;
    --todo-bg: #211a09;
    --todo-rule: #7a5c1c;
  }
}

/* The viewer's explicit toggle must beat the OS signal in both directions. */
:root[data-theme="light"] {
  --bg: #ffffff; --bg-soft: #f7f7f5; --bg-code: #f4f4f1;
  --ink: #17181a; --ink-2: #55575c; --ink-3: #7d8085;
  --rule: #e3e3df; --rule-strong: #c8c8c3;
  --pass: #1a6b41; --fail: #9e2620; --unknown: #6c6f74;
  --todo-ink: #7a4e00; --todo-bg: #fdf6e6; --todo-rule: #d9a441;
}
:root[data-theme="dark"] {
  --bg: #101215; --bg-soft: #171a1e; --bg-code: #191c21;
  --ink: #e5e7ea; --ink-2: #a6a9af; --ink-3: #7e8288;
  --rule: #272b31; --rule-strong: #3b4047;
  --pass: #5fbf8b; --fail: #ee7f74; --unknown: #90949a;
  --todo-ink: #f0c069; --todo-bg: #211a09; --todo-rule: #7a5c1c;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.62;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ---------------------------------------------------------------- masthead */

.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
}

.masthead-inner {
  max-width: 62rem;
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem 1.6rem;
}

.wordmark {
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  border: 0;
  white-space: nowrap;
}

.masthead nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.15rem;
  margin-left: auto;
}

.masthead nav a {
  font-family: var(--sans);
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
  color: var(--ink-2);
  text-decoration: none;
  border: 0;
  padding: 0.15rem 0;
  border-bottom: 1.5px solid transparent;
}

.masthead nav a:hover { color: var(--ink); border-bottom-color: var(--rule-strong); }
.masthead nav a.active { color: var(--ink); border-bottom-color: var(--ink); }

/* ------------------------------------------------------------------ layout */

.wrap {
  max-width: 62rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.pagehead {
  padding: 3.5rem 0 2rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2.5rem;
}

.kicker {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 0.9rem;
}

.pagehead h1 {
  font-size: clamp(1.85rem, 1.2rem + 2.4vw, 2.9rem);
  line-height: 1.12;
  letter-spacing: -0.018em;
  font-weight: 600;
  margin: 0;
  max-width: 26em;
}

.standfirst {
  font-size: 1.15rem;
  line-height: 1.5;
  color: var(--ink-2);
  max-width: var(--measure);
  margin: 1.15rem 0 0;
}

/* Prose column with a margin rail for notes. */
.prose { position: relative; padding-bottom: 4rem; }

.prose > p,
.prose > h2,
.prose > h3,
.prose > h4,
.prose > ul,
.prose > ol,
.prose > blockquote,
.prose > .callout,
.prose > .todo,
.prose > .keyfig,
.prose > figcaption {
  max-width: var(--measure);
}

.prose h2 {
  font-size: 1.45rem;
  line-height: 1.25;
  letter-spacing: -0.012em;
  font-weight: 600;
  margin: 3rem 0 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
}

.prose h3 {
  font-size: 1.12rem;
  font-weight: 600;
  margin: 2.1rem 0 0.6rem;
}

.prose h4 {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 1.9rem 0 0.5rem;
}

.prose p { margin: 0 0 1.1rem; }
.prose ul, .prose ol { margin: 0 0 1.1rem; padding-left: 1.3rem; }
.prose li { margin: 0 0 0.45rem; }

.prose a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--rule-strong);
}
.prose a:hover { border-bottom-color: var(--ink); }

strong { font-weight: 600; }

blockquote {
  margin: 1.6rem 0;
  padding: 0.1rem 0 0.1rem 1.15rem;
  border-left: 2px solid var(--rule-strong);
  color: var(--ink-2);
  font-style: italic;
}
blockquote p:last-child { margin-bottom: 0; }
blockquote strong { color: var(--ink); }

/* ------------------------------------------------------------ margin notes */

.note { display: inline; }
.note-toggle { display: none; }

.note-ref {
  font-family: var(--sans);
  font-size: 0.68em;
  font-weight: 600;
  vertical-align: super;
  line-height: 0;
  color: var(--ink-3);
  cursor: pointer;
  padding: 0 0.12em;
}
.note-ref:hover { color: var(--ink); }

.note-body {
  float: right;
  clear: right;
  width: var(--margin-col);
  margin-right: calc(-1 * (var(--margin-col) + 1.6rem));
  margin-bottom: 1rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--ink-2);
  position: relative;
  text-align: left;
}

.note-n {
  font-weight: 600;
  color: var(--ink-3);
  margin-right: 0.35em;
}

.note-body .src { font-size: 0.94em; }

/* Inside a table there is no rail to float into — a floated note blows the row
 * height out to the note's height. Collapse them behind their reference the way
 * narrow viewports do. */
.tablewrap .note-body,
figcaption .note-body {
  display: none;
  float: none;
  width: auto;
  margin: 0.55rem 0 0;
  padding: 0.55rem 0.75rem;
  background: var(--bg-soft);
  border-left: 2px solid var(--rule-strong);
}
.tablewrap .note-toggle:checked + .note-ref + .note-body,
figcaption .note-toggle:checked + .note-ref + .note-body { display: block; }
.tablewrap .note-ref { border-bottom: 1px dotted var(--rule-strong); }

/* Narrow viewports: no rail, so notes collapse behind their reference. */
@media (max-width: 62rem) {
  .note-body {
    display: none;
    float: none;
    width: auto;
    margin: 0.7rem 0;
    padding: 0.7rem 0.9rem;
    background: var(--bg-soft);
    border-left: 2px solid var(--rule-strong);
  }
  .note-toggle:checked + .note-ref + .note-body { display: block; }
  .note-ref {
    border-bottom: 1px dotted var(--rule-strong);
  }
}

/* ---------------------------------------------------------- code and paths */

code, kbd, samp {
  font-family: var(--mono);
  font-size: 0.855em;
}

.prose > p code,
.prose li code,
td code, th code,
blockquote code {
  background: var(--bg-code);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.05em 0.32em;
  word-break: break-word;
}

pre {
  background: var(--bg-code);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.9rem 1.05rem;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.55;
  margin: 1.4rem 0;
  max-width: calc(var(--measure) + var(--margin-col) + 1.6rem);
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; }

/* Provenance chip: the file a number came from. */
.src {
  font-family: var(--mono);
  font-size: 0.78em;
  color: var(--ink-3);
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.05em 0.34em;
  white-space: nowrap;
  text-decoration: none;
}
a.src:hover { color: var(--ink); border-color: var(--rule-strong); }

/* ------------------------------------------------------------------ tables */

.tablewrap {
  overflow-x: auto;
  margin: 1.5rem 0;
  max-width: calc(var(--measure) + var(--margin-col) + 1.6rem);
}

table {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--sans);
  font-size: 0.82rem;
  line-height: 1.45;
}

th, td {
  text-align: left;
  padding: 0.5rem 0.85rem 0.5rem 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: baseline;
}

thead th {
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  border-bottom: 1px solid var(--rule-strong);
  white-space: nowrap;
}

td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 0.78rem; }

tbody tr:last-child td { border-bottom: 0; }

/* --------------------------------------------------------------- statuses */

.chip {
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 0.12em 0.5em;
  border-radius: 2px;
  border: 1px solid currentColor;
}
.chip.pass { color: var(--pass); }
.chip.fail { color: var(--fail); }
.chip.unknown { color: var(--unknown); }

/* ------------------------------------------------------- callouts and TODO */

.callout {
  border-left: 2px solid var(--ink);
  background: var(--bg-soft);
  padding: 1rem 1.15rem;
  margin: 1.8rem 0;
  font-size: 1rem;
}
.callout p:last-child { margin-bottom: 0; }
.callout .callout-label {
  display: block;
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.5rem;
}

/* A prompt for Jacob.  Deliberately loud: these must not ship unnoticed. */
.todo {
  background: var(--todo-bg);
  border: 1px solid var(--todo-rule);
  border-left: 4px solid var(--todo-rule);
  border-radius: 3px;
  padding: 0.95rem 1.15rem;
  margin: 1.8rem 0;
  font-family: var(--sans);
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--todo-ink);
}
.todo p { margin: 0 0 0.6rem; max-width: none; }
.todo p:last-child { margin-bottom: 0; }
.todo .todo-label {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  padding: 0.12em 0.5em;
  border: 1px solid currentColor;
  border-radius: 2px;
}
.todo code { background: rgba(128,128,128,0.14); border-radius: 3px; padding: 0.05em 0.3em; }

/* -------------------------------------------------------- index card lists */

.cards {
  list-style: none;
  padding: 0;
  margin: 0 0 2rem;
  max-width: calc(var(--measure) + var(--margin-col) + 1.6rem);
}

.cards li {
  margin: 0;
  border-top: 1px solid var(--rule);
}
.cards li:last-child { border-bottom: 1px solid var(--rule); }

.cards a {
  display: block;
  padding: 1.25rem 0;
  text-decoration: none;
  border: 0;
  color: inherit;
}
.cards a:hover .card-title { border-bottom-color: var(--ink); }

.card-num {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-3);
  display: block;
  margin-bottom: 0.3rem;
}

.card-title {
  font-size: 1.18rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  display: inline;
  border-bottom: 1px solid transparent;
}

.card-desc {
  margin: 0.45rem 0 0;
  color: var(--ink-2);
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 34em;
}

/* --------------------------------------------------------- key figure slab */

.keyfig {
  display: flex;
  flex-wrap: wrap;
  gap: 1.75rem 2.5rem;
  margin: 2rem 0;
  padding: 1.2rem 0;
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-strong);
  max-width: calc(var(--measure) + var(--margin-col) + 1.6rem) !important;
}

.keyfig div { flex: 1 1 8rem; }

.keyfig .n {
  display: block;
  font-family: var(--mono);
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.keyfig .n.fail { color: var(--fail); }
.keyfig .n.pass { color: var(--pass); }

.keyfig .l {
  display: block;
  font-family: var(--sans);
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--ink-3);
  margin-top: 0.4rem;
}

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

.sitefoot {
  border-top: 1px solid var(--rule);
  margin-top: 3rem;
  padding: 2rem 0 3.5rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--ink-3);
}
.sitefoot .wrap > p { max-width: 42rem; margin: 0 0 0.7rem; }
.sitefoot a { color: var(--ink-2); text-decoration: none; border-bottom: 1px solid var(--rule); }
.sitefoot a:hover { color: var(--ink); }

.theme-toggle {
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--ink-3);
  background: none;
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  margin-top: 0.5rem;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--rule-strong); }

/* ------------------------------------------------------------------ misc */

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2.5rem 0;
  max-width: var(--measure);
}

figure { margin: 2rem 0; max-width: calc(var(--measure) + var(--margin-col) + 1.6rem); }
figure svg { max-width: 100%; height: auto; display: block; }
figcaption {
  font-family: var(--sans);
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--ink-3);
  margin-top: 0.7rem;
}

.videos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: 1.75rem;
  margin: 1.8rem 0 2.4rem;
  max-width: calc(var(--measure) + var(--margin-col) + 1.6rem);
}
.videos figure { margin: 0; max-width: none; }
.videos video {
  width: 100%;
  height: auto;
  display: block;
  background: #000;
  border: 1px solid var(--rule);
  border-radius: 4px;
}
.videos figcaption { margin-top: 0.6rem; }

.dl-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.6rem 0; }

.btn {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.55rem 1.05rem;
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  color: var(--ink);
  text-decoration: none !important;
  background: var(--bg);
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { opacity: 0.85; }

.lede { font-size: 1.1rem; line-height: 1.55; }

@media print {
  .masthead, .sitefoot, .theme-toggle { display: none; }
  .note-body { float: none; width: auto; margin: 0.5rem 0; }
}
