/* The four format sites share this sheet. The site's format sets the hue
   through html[data-format]; everything else is common. */

:root {
  --bg: #f6f7f9; --surface: #ffffff; --ink: #1c2028; --muted: #5f6774;
  --line: #d6dae1; --soft: #eceef2; --code: #f0f2f5;
  --pass: #1b6b3a; --pass-bg: #e3f3e8; --fail: #b3261e; --fail-bg: #fbe7e5;
  --warn: #8a5a00; --warn-bg: #fff3d6;
  --h32: #c4611d; --h64: #245da8; --h128: #6b3fa0; --h256: #1e6e5c;
  --t32: #f6dfcf; --t64: #d6e3f6; --t128: #e4daf3; --t256: #d2ebe4;
  --m32: #e2a173; --m64: #7fa5db; --m128: #a98ad2; --m256: #6fb5a1;
  --ref: #7a8291;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151b; --surface: #1a1e26; --ink: #e7e9ed; --muted: #9aa3b0;
    --line: #2c323c; --soft: #222731; --code: #1f242d;
    --pass: #7fd3a0; --pass-bg: #14301f; --fail: #ff8a80; --fail-bg: #3a1a17;
    --warn: #f0c36a; --warn-bg: #3a2c0f;
    --h32: #e88a4a; --h64: #6ea3ea; --h128: #a98ae0; --h256: #55b39c;
    --t32: #3a2416; --t64: #172a45; --t128: #2b1f42; --t256: #15332c;
    --m32: #a35a2a; --m64: #3d6aa8; --m128: #6f4fa3; --m256: #2f7d69;
    --ref: #6b7482;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12151b; --surface: #1a1e26; --ink: #e7e9ed; --muted: #9aa3b0;
  --line: #2c323c; --soft: #222731; --code: #1f242d;
  --pass: #7fd3a0; --pass-bg: #14301f; --fail: #ff8a80; --fail-bg: #3a1a17;
  --warn: #f0c36a; --warn-bg: #3a2c0f;
  --h32: #e88a4a; --h64: #6ea3ea; --h128: #a98ae0; --h256: #55b39c;
  --t32: #3a2416; --t64: #172a45; --t128: #2b1f42; --t256: #15332c;
  --m32: #a35a2a; --m64: #3d6aa8; --m128: #6f4fa3; --m256: #2f7d69;
  --ref: #6b7482;
  color-scheme: dark;
}
html[data-format="32"]  { --hue: var(--h32);  --tint: var(--t32);  --mid: var(--m32); }
html[data-format="64"]  { --hue: var(--h64);  --tint: var(--t64);  --mid: var(--m64); }
html[data-format="128"] { --hue: var(--h128); --tint: var(--t128); --mid: var(--m128); }
html[data-format="256"] { --hue: var(--h256); --tint: var(--t256); --mid: var(--m256); }
[data-k="32"]  { --k-hue: var(--h32);  --k-tint: var(--t32);  --k-mid: var(--m32); }
[data-k="64"]  { --k-hue: var(--h64);  --k-tint: var(--t64);  --k-mid: var(--m64); }
[data-k="128"] { --k-hue: var(--h128); --k-tint: var(--t128); --k-mid: var(--m128); }
[data-k="256"] { --k-hue: var(--h256); --k-tint: var(--t256); --k-mid: var(--m256); }

* { 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(--bg); color: var(--ink); font-family: var(--sans); font-size: 17px; line-height: 1.55; padding-inline: 20px; padding-block: 0 72px; overflow-wrap: anywhere; }
.wrap { max-width: 1060px; margin: 0 auto; }
.prose { max-width: 70ch; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.12; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(40px, 6vw, 64px); letter-spacing: -.012em; }
h2 { font-size: clamp(26px, 3.2vw, 34px); margin: 0 0 14px; }
h3 { font-size: 21px; margin: 26px 0 8px; }
p { margin: 0 0 14px; }
ul, ol { margin: 0 0 14px; padding-left: 22px; }
li { margin-bottom: 6px; }
a { color: var(--hue); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--hue); outline-offset: 2px; }
code, kbd, .mono { font-family: var(--mono); font-size: .92em; }
code { background: var(--code); padding: 1px 5px; border-radius: 3px; }
pre { font-family: var(--mono); font-size: 14px; line-height: 1.5; background: var(--code); padding: 12px 14px; border-radius: 4px; overflow-x: auto; margin: 0 0 14px; }
pre code { background: none; padding: 0; }
strong { font-weight: 600; }
.eyebrow { font-family: var(--mono); font-size: 12.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.tnum { font-variant-numeric: tabular-nums; }
hr { border: 0; border-top: 1px solid var(--line); margin: 0; }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--surface); padding: 8px 12px; border: 1px solid var(--line); z-index: 10; }
.skip:focus { left: 20px; }

/* ---- the ladder nav ---------------------------------------------- */
.ladder { padding-block: 18px 6px; }
.ladder .rungs { display: flex; gap: 10px; align-items: flex-end; }
.ladder a.rung { display: block; text-decoration: none; color: var(--muted); min-width: 0; }
.ladder a.rung[data-k="32"] { flex: 1 1 0; } .ladder a.rung[data-k="64"] { flex: 2 2 0; }
.ladder a.rung[data-k="128"] { flex: 4 4 0; } .ladder a.rung[data-k="256"] { flex: 8 8 0; }
.ladder .name { font-family: var(--mono); font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 5px; }
.ladder .bar { display: flex; height: 14px; border-radius: 2px; overflow: hidden; opacity: .55; }
.ladder .bar i { display: block; height: 100%; }
.ladder .bar .s { background: var(--k-hue); flex: 1 1 0; min-width: 2px; }
.ladder .bar .e { background: var(--k-mid); }
.ladder .bar .f { background: var(--k-tint); }
.ladder a.rung[aria-current="page"] { color: var(--ink); }
.ladder a.rung[aria-current="page"] .bar { opacity: 1; height: 18px; }
.ladder a.rung:hover .bar { opacity: 1; }
.ladder .legend { display: flex; gap: 16px; flex-wrap: wrap; font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 8px; }
.ladder .legend i { display: inline-block; width: 11px; height: 11px; border-radius: 2px; vertical-align: -1px; margin-right: 5px; }
@media (max-width: 560px) { .ladder .name { font-size: 11px; } .ladder .rungs { gap: 6px; } }

/* ---- the hero ------------------------------------------------------- */
.hero { padding-block: 36px 8px; border-top: 1px solid var(--line); margin-top: 10px; }
.hero h1 { margin-top: 8px; }
.hero .tagline { font-family: var(--serif); font-size: clamp(22px, 2.6vw, 28px); color: var(--hue); margin: 6px 0 16px; text-wrap: balance; }
.hero .identity { font-size: 20px; max-width: 62ch; }
.hero .aliases { font-size: 15px; color: var(--muted); max-width: 70ch; }
.hero .aliases b { color: var(--ink); font-weight: 600; }
.herobar { margin-top: 22px; }
.toc { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 15px; }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover { color: var(--hue); text-decoration: underline; }

/* ---- sections ------------------------------------------------------- */
section.sec { padding-block: 44px 8px; }
section.sec > .lead { font-size: 18.5px; color: var(--muted); max-width: 66ch; margin-bottom: 18px; }
section.sec .eyebrow { margin-bottom: 8px; }

/* ---- tables --------------------------------------------------------- */
.tablewrap { overflow-x: auto; margin: 0 0 18px; }
table { border-collapse: collapse; width: 100%; font-size: 15.5px; }
th, td { text-align: left; vertical-align: top; padding: 9px 10px; border-top: 1px solid var(--line); }
thead th { font-weight: 600; font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border-top: 0; }
tbody th { font-weight: 600; white-space: nowrap; }
td.mono, th.mono { font-family: var(--mono); font-size: 14px; }
table.params td:first-child { font-weight: 600; white-space: nowrap; }
tr.this { background: var(--tint); }
tr.loses td { color: var(--muted); }

/* ---- boards (widgets) ---------------------------------------------- */
.board { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 18px 20px 20px; margin: 18px 0 22px; }
.board .head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.board .head .eyebrow { margin: 0; }
.board .head .title { font-family: var(--serif); font-size: 21px; }
.board .note { font-size: 14.5px; color: var(--muted); margin: 8px 0 0; }
.board .note:last-child { margin-bottom: 0; }
.board.sig { border-left: 4px solid var(--hue); }
.board.sig .head .eyebrow { color: var(--hue); }
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.controls label { font-size: 14px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
input[type="text"], input[type="search"], select { font: inherit; font-family: var(--mono); font-size: 15px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 7px 10px; min-width: 0; }
input[type="text"].wide { flex: 1 1 320px; }
input[type="range"] { accent-color: var(--hue); }
button, .btn { font: inherit; font-size: 15px; font-weight: 600; color: var(--ink); background: var(--soft); border: 1px solid var(--line); border-radius: 4px; padding: 7px 14px; cursor: pointer; }
button:hover { border-color: var(--hue); }
button.primary { background: var(--hue); color: #fff; border-color: var(--hue); }
button.ghost { background: transparent; }
button:disabled { opacity: .5; cursor: default; }
.chip { display: inline-block; font-family: var(--mono); font-size: 12.5px; padding: 2px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.chip.pass { background: var(--pass-bg); color: var(--pass); }
.chip.fail { background: var(--fail-bg); color: var(--fail); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.verdict { font-family: var(--mono); font-size: 15px; padding: 10px 12px; border-radius: 4px; background: var(--soft); }
.verdict.pass { background: var(--pass-bg); color: var(--pass); }
.verdict.fail { background: var(--fail-bg); color: var(--fail); }
.verdict.warn { background: var(--warn-bg); color: var(--warn); }
.out { font-family: var(--mono); font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--code); padding: 10px 12px; border-radius: 4px; margin: 0; }
.out.err { background: var(--fail-bg); color: var(--fail); }
.digits { font-family: var(--mono); font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; background: var(--code); padding: 10px 12px; border-radius: 4px; max-height: 260px; overflow: auto; }
.status { font-size: 14px; color: var(--muted); font-family: var(--mono); }

/* the bit bar: three fields at true widths */
.bitbar { display: flex; width: 100%; height: 22px; border-radius: 3px; overflow: hidden; }
.bitbar i { display: block; height: 100%; }
.bitbar .s { background: var(--hue); flex: 1 1 0; min-width: 3px; }
.bitbar .e { background: var(--mid); }
.bitbar .f { background: var(--tint); }
.bitlabels { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 12.5px; color: var(--muted); margin-top: 6px; gap: 12px; }

/* the bits themselves */
.bits { font-family: var(--mono); font-size: 13.5px; line-height: 1.9; overflow-wrap: anywhere; margin: 8px 0 4px; }
.bits b { font-weight: 500; letter-spacing: .04em; padding: 2px 1px; border-radius: 2px; cursor: pointer; }
.bits b.s { background: var(--hue); color: #fff; }
.bits b.e { background: var(--mid); color: var(--ink); }
.bits b.f { background: var(--tint); color: var(--ink); }
.bits b:hover { outline: 2px solid var(--ink); }
.bits .sep { display: inline-block; width: 6px; }
.bits.ro b { cursor: default; } .bits.ro b:hover { outline: 0; }

/* result grids */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 15px; margin: 12px 0 0; }
.kv dt { font-family: var(--mono); font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding-top: 3px; }
.kv dd { margin: 0; min-width: 0; }
.kv dd.mono { font-family: var(--mono); font-size: 14px; overflow-wrap: anywhere; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; gap: 2px 0; } .kv dt { padding-top: 8px; } }

/* the case gallery */
.cases { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin: 16px 0 6px; }
.case { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.case h3 { margin: 0; font-size: 19px; }
.case .expr { font-family: var(--mono); font-size: 14px; color: var(--muted); }
.case .why { font-size: 14.5px; }
.case .res { font-family: var(--mono); font-size: 13.5px; line-height: 1.55; overflow-wrap: anywhere; background: var(--code); padding: 8px 10px; border-radius: 4px; }
.case .res .lbl { color: var(--muted); }
.case .res .diff { color: var(--fail); font-weight: 500; }
.case .res .same { color: var(--pass); font-weight: 500; }
.case footer { font-size: 13.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* attrs table */
.attrs td.mono { white-space: nowrap; }
@media (max-width: 700px) { .attrs td.mono { white-space: normal; overflow-wrap: anywhere; } }
.attrs td.dec { font-family: var(--mono); font-size: 13.5px; overflow-wrap: anywhere; }

/* charts */
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--mono); font-size: 12px; fill: var(--muted); }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; }
.chart .line { fill: none; stroke: var(--hue); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.alt { stroke: var(--k-hue); }
.chart .area { fill: var(--tint); opacity: .6; }
.chart .marker { fill: var(--hue); stroke: var(--surface); stroke-width: 2; }
.chart .ann { fill: var(--ink); font-size: 12.5px; }
.chart .cliff { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 4 3; }
.legendrow { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--muted); margin-top: 8px; }
.legendrow i { display: inline-block; width: 16px; height: 3px; vertical-align: middle; margin-right: 6px; border-radius: 2px; }
.tooltip { position: absolute; pointer-events: none; font-family: var(--mono); font-size: 12.5px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; box-shadow: 0 2px 8px rgba(0,0,0,.12); white-space: nowrap; z-index: 5; }
details.table { margin-top: 8px; font-size: 14px; }
details.table summary { cursor: pointer; color: var(--muted); }

/* footer */
footer.foot { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 14.5px; color: var(--muted); display: grid; gap: 8px; }
footer.foot .mono { font-size: 13px; overflow-wrap: anywhere; }

/* ladder section: the neighbour links */
.neighbours { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 18px 0; }
.neighbours a { display: block; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--k-hue); border-radius: 6px; padding: 14px 16px; }
.neighbours a:hover { border-color: var(--k-hue); }
.neighbours .dom { font-family: var(--mono); color: var(--k-hue); font-weight: 500; display: block; margin-bottom: 4px; }
.neighbours .why { font-size: 14.5px; color: var(--muted); }
@media (max-width: 560px) { .neighbours { grid-template-columns: 1fr; } }

/* the reading list */
.reading li { margin-bottom: 8px; }
