:root {
  /* Oxblood: deep red for the engine's answers and the {+} mark, on a warm
     paper. The hero is a ruled register of answers, digits in columns as
     the engine stores them; everything below it stays quiet. */
  --paper: #f6f3f1;
  --panel: #fcfaf9;
  --ink: #221819;
  --muted: #66585a;
  --rule: #dfd5d4;
  --accent: #7c2232;
  --accent-soft: #f2e3e5;
  --accent-ink: #ffffff;
  --wrong: #b4471c;
  --display: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #161011; --panel: #1d1517; --ink: #efe6e7; --muted: #ab9b9d;
    --rule: #352829; --accent: #e58b98; --accent-soft: #2b1a1e; --accent-ink: #1a0f11;
    --wrong: #f29a63; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #161011; --panel: #1d1517; --ink: #efe6e7; --muted: #ab9b9d;
  --rule: #352829; --accent: #e58b98; --accent-soft: #2b1a1e; --accent-ink: #1a0f11;
  --wrong: #f29a63; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.6 var(--body);
}
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
code, pre, kbd { font-family: var(--display); font-size: 0.88em; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
p { margin: 0; max-width: 62ch; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* Header */
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 22px; padding-bottom: 22px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand .word { font: 600 22px/1 var(--display); letter-spacing: -0.02em; }
.mark { width: 52px; height: auto; display: block; }
.mark .brace { fill: none; stroke: var(--ink); stroke-width: 6.5; stroke-linecap: round; stroke-linejoin: round; }
.mark .plus { fill: none; stroke: var(--accent); stroke-width: 10; stroke-linecap: round; transform-box: fill-box; transform-origin: center; transition: transform 0.35s ease; }
.brand:hover .plus, .brand:focus-visible .plus { transform: rotate(90deg); }
nav.main { display: flex; flex-wrap: wrap; gap: 4px 22px; font-size: 15px; }
nav.main a { color: var(--ink); text-decoration: none; }
nav.main a:hover { color: var(--accent); }

/* Hero: the ledger */
.hero {
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background-image: repeating-linear-gradient(to bottom, transparent 0 39px, color-mix(in srgb, var(--rule) 60%, transparent) 39px 40px);
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 48px; align-items: center; padding-top: 72px; padding-bottom: 72px; }
.pitch { display: grid; gap: 22px; }
h1 {
  font: 600 clamp(2.4rem, 5vw, 3.75rem)/1.04 var(--display);
  letter-spacing: -0.035em;
}
h1 .stop { color: var(--accent); }
.lede { font-size: 19px; color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; padding-top: 6px; }
.btn {
  font: 500 15px/1 var(--body);
  padding: 13px 18px;
  border-radius: 6px;
  border: 1px solid var(--ink);
  color: var(--ink);
  background: var(--paper);
  text-decoration: none;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn:hover { text-decoration: none; filter: brightness(1.06); }

figure.ledger {
  margin: 0;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: 0 1px 0 var(--rule), 0 18px 40px -28px color-mix(in srgb, var(--ink) 45%, transparent);
  padding: 20px 22px 18px;
  display: grid; gap: 14px;
}
figure.ledger figcaption { font: 500 13px/1 var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.scroll { overflow-x: auto; }
.ledger table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.ledger th, .ledger td { text-align: left; padding: 12px 14px 12px 0; border-top: 1px solid var(--rule); vertical-align: top; }
.ledger thead th { border-top: 0; padding-top: 0; font: 500 12px/1.3 var(--body); color: var(--muted); }
.ledger tbody th { font: 500 15px/1.4 var(--body); white-space: nowrap; }
.ledger td { font: 400 15px/1.4 var(--display); white-space: nowrap; }
.ledger td.ours { font-weight: 600; color: var(--accent); padding-right: 0; }
.ledger .wrong { color: var(--wrong); text-decoration: underline wavy; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.ledger .none { color: var(--muted); font-style: italic; font-family: var(--body); }
.ledger .note { display: block; font: 400 12px/1.4 var(--body); color: var(--muted); white-space: normal; padding-top: 3px; }
.ledger-note { font-size: 13px; color: var(--muted); max-width: none; }

/* Below the hero */
main section { padding: 80px 0; border-bottom: 1px solid var(--rule); }
main section:last-of-type { border-bottom: 0; }
.section-head { display: grid; gap: 12px; margin-bottom: 36px; }
h2 { font: 600 30px/1.15 var(--display); letter-spacing: -0.025em; }
.section-head p { color: var(--muted); font-size: 18px; }
h3 { font: 600 18px/1.3 var(--body); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 36px 40px; }
.fact { display: grid; gap: 10px; align-content: start; border-top: 2px solid var(--ink); padding-top: 16px; }
.fact p { font-size: 16px; color: var(--muted); }
.fact .ex { display: block; font: 500 14px/1.5 var(--display); color: var(--ink); background: var(--accent-soft); border-radius: 4px; padding: 6px 9px; overflow-x: auto; white-space: nowrap; }

dl.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0; margin: 56px 0 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
dl.stats div { padding: 22px 18px 20px 0; display: grid; gap: 6px; align-content: start; }
dl.stats dt { order: 2; font-size: 14px; color: var(--muted); }
dl.stats dd { order: 1; margin: 0; font: 600 34px/1 var(--display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }

.start-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 40px; align-items: start; }
pre.code, pre.term {
  margin: 0;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 18px 20px;
  overflow-x: auto;
  font: 400 14px/1.6 var(--display);
}
pre.code .c { color: var(--muted); }
pre.code .s { color: var(--accent); }
pre.code .k { color: var(--accent); font-weight: 500; }
pre.term .p { color: var(--muted); user-select: none; }
pre.term .o { color: var(--accent); font-weight: 600; }
.start-side { display: grid; gap: 18px; }
.start-side p { font-size: 16px; }

ul.checks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 40px; }
ul.checks li { border-top: 1px solid var(--rule); padding: 18px 0 20px; display: grid; gap: 6px; align-content: start; }
ul.checks .n { font: 600 28px/1 var(--display); letter-spacing: -0.03em; color: var(--accent); font-variant-numeric: tabular-nums; }
ul.checks p { font-size: 16px; color: var(--muted); }
.caveat { margin-top: 28px; font-size: 15px; color: var(--muted); border-left: 3px solid var(--accent); padding-left: 14px; }

.compare table { border-collapse: collapse; width: 100%; min-width: 760px; font-size: 15px; }
.compare th, .compare td { text-align: left; vertical-align: top; padding: 14px 18px 14px 0; border-top: 1px solid var(--rule); }
.compare thead th { border-top: 0; font: 500 12px/1.3 var(--body); color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.compare tbody tr.us th, .compare tbody tr.us td { background: var(--accent-soft); }
.compare tbody tr.us th { box-shadow: inset 3px 0 0 var(--accent); padding-left: 14px; }
.compare tbody th { font-weight: 600; white-space: nowrap; }
.compare tbody tr:not(.us) th { padding-left: 14px; }
.know { margin-top: 48px; display: grid; gap: 16px; }
.know ul { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px 40px; }
.know li { font-size: 16px; color: var(--muted); }
.know li b { color: var(--ink); font-weight: 600; }

footer.site { border-top: 1px solid var(--rule); background: var(--panel); }
footer.site .wrap { display: flex; flex-wrap: wrap; gap: 18px 40px; align-items: center; justify-content: space-between; padding-top: 32px; padding-bottom: 36px; font-size: 14px; color: var(--muted); }
footer.site .brand .word { font-size: 18px; }
footer.site .mark { width: 40px; }

@media (max-width: 900px) {
  .hero-grid, .start-grid { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .hero-grid { padding-top: 48px; padding-bottom: 56px; }
  main section { padding: 60px 0; }
}
@media (max-width: 480px) {
  .wrap { padding: 0 16px; }
  .lede { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  .mark .plus { transition: none; }
}

/* The reference */
nav.main a[aria-current="page"] { color: var(--accent); font-weight: 500; }
main.ref { border-top: 1px solid var(--rule); }
.ref-grid { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 56px; padding-top: 48px; padding-bottom: 88px; align-items: start; }
.ref-side { position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow-y: auto; font-size: 14px; padding-right: 8px; }
.ref-side .ref-home { display: block; font: 600 13px/1 var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); text-decoration: none; margin-bottom: 14px; }
.ref-side ul { list-style: none; margin: 0; padding: 0; }
.ref-side > ul > li > a { display: block; padding: 5px 0; color: var(--ink); text-decoration: none; }
.ref-side > ul > li.open > a { font-weight: 600; }
.ref-side li ul { margin: 2px 0 10px; border-left: 1px solid var(--rule); }
.ref-side li li a { display: block; padding: 3px 0 3px 12px; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; }
.ref-side li li a code { font-size: 12.5px; }
.ref-side li li a:hover { color: var(--accent); }
.ref-side li li a[aria-current="page"] { color: var(--accent); border-left-color: var(--accent); font-weight: 500; }
.ref-side a:hover { color: var(--accent); }

article.fn, article.index { display: grid; gap: 18px; min-width: 0; }
article.fn > *, article.index > * { margin: 0; }
.crumb { font-size: 14px; color: var(--muted); }
.crumb a { color: var(--muted); }
article h1 { font: 600 clamp(1.8rem, 3.6vw, 2.6rem)/1.1 var(--display); letter-spacing: -0.03em; }
article h1 code { font-size: 1em; }
article .lead { font-size: 19px; max-width: 62ch; }
article h2 { font: 600 20px/1.3 var(--display); letter-spacing: -0.015em; margin-top: 22px; }
article h3 { font: 600 16px/1.3 var(--body); margin-top: 10px; }
pre.proto { margin: 0; background: var(--panel); border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: 6px; padding: 14px 18px; overflow-x: auto; font: 400 14px/1.6 var(--display); }
.prose { display: grid; gap: 14px; }
.prose p, .prose li { max-width: 68ch; }
.prose ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
article code { font-size: 0.9em; }
article a code { color: inherit; }

table.examples { border-collapse: collapse; width: 100%; font-size: 15px; }
table.examples th, table.examples td { text-align: left; vertical-align: top; padding: 10px 18px 10px 0; border-top: 1px solid var(--rule); }
table.examples thead th { border-top: 0; padding-top: 0; font: 500 12px/1.3 var(--body); color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
table.examples td:first-child { white-space: nowrap; }
table.examples td.ans { font: 500 14.5px/1.5 var(--display); color: var(--accent); overflow-wrap: anywhere; min-width: 16ch; }
table.examples td:last-child { padding-right: 0; }
table.examples td.err code { color: var(--wrong); }
table.examples .tag { display: inline-block; font: 500 11.5px/1 var(--body); color: var(--muted); border: 1px solid var(--rule); border-radius: 4px; padding: 3px 5px; margin-left: 4px; vertical-align: 1px; }
table.examples .base { font: 400 12px/1 var(--body); color: var(--muted); margin-left: 4px; white-space: nowrap; }
table.examples .flag { font: italic 400 14px/1.5 var(--body); color: var(--wrong); }
table.examples .and { display: block; font: 400 12px/1.6 var(--body); color: var(--muted); }
p.note { font-size: 13px; color: var(--muted); }
ul.see { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
ul.see li span { color: var(--muted); font-size: 15px; margin-left: 6px; }

article.index section.conventions { display: grid; gap: 12px; border-bottom: 1px solid var(--rule); padding-bottom: 36px; }
article.index section.conventions p { max-width: 70ch; font-size: 16px; }
table.codes { border-collapse: collapse; font-size: 15px; max-width: 760px; }
table.codes th, table.codes td { text-align: left; vertical-align: top; padding: 8px 18px 8px 0; border-top: 1px solid var(--rule); }
table.codes th { white-space: nowrap; font-weight: 500; }
.families-head { font-size: 26px !important; margin-top: 14px !important; }
section.family { display: grid; gap: 10px; scroll-margin-top: 16px; padding-top: 14px; }
section.family p { color: var(--muted); font-size: 16px; max-width: 70ch; }
table.fns { border-collapse: collapse; width: 100%; font-size: 15px; }
table.fns th, table.fns td { text-align: left; vertical-align: top; padding: 9px 18px 9px 0; border-top: 1px solid var(--rule); }
table.fns th { white-space: nowrap; font-weight: 400; width: 1%; }
table.fns td { color: var(--muted); }

@media (max-width: 900px) {
  .ref-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; padding-top: 32px; }
  .ref-side { position: static; max-height: none; border-bottom: 1px solid var(--rule); padding-bottom: 16px; }
  .ref-side > ul { display: flex; flex-wrap: wrap; gap: 2px 16px; }
  .ref-side li ul { display: none; }
}

/* Not found */
main.notfound { border-top: 1px solid var(--rule); }
main.notfound .wrap { display: grid; gap: 20px; align-content: start; min-height: 62vh; padding-top: 96px; padding-bottom: 120px; }
