/* Colours are tokens, redefined for dark mode, and the inlined
   illustrations use the same tokens through their classes (.ink, .plus,
   .minus, ...), so they change with the text. */
:root {
  --paper: #fbf9f4;
  --panel: #f1ede3;
  --ink: #1f2328;
  --muted: #6b6f76;
  --rule: #d9d3c5;
  --plus: #0f7a6c;
  --minus: #b5520f;
  --zero: #7a7f87;
  --link: #0b5f7a;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16181c;
    --panel: #22252b;
    --ink: #e6e3dc;
    --muted: #9da3ab;
    --rule: #3a3e46;
    --plus: #4fc2ae;
    --minus: #f0954f;
    --zero: #a3a9b2;
    --link: #7cc7e0;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.125rem/1.65 Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
}
a { color: var(--link); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }

header.site, main, footer.site {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1rem;
}
header.site {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
.brand { color: var(--ink); font-weight: 700; text-decoration: none; font-size: 1.1rem; }
.glyphs { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--plus); }
nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; font-size: 0.95rem; }
nav a { color: var(--muted); text-decoration: none; }
nav a:hover, nav a[aria-current="page"] { color: var(--ink); }
nav a[aria-current="page"] { font-weight: 600; }

main { padding-top: 1.5rem; padding-bottom: 2rem; }
h1, h2, h3 {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
h1 { font-size: 2.2rem; margin: 0.5rem 0 0.5rem; }
h2 { font-size: 1.45rem; margin: 2.5rem 0 0.5rem; }
h3 { font-size: 1.15rem; margin: 1.75rem 0 0.25rem; }
.lede { font-size: 1.25rem; color: var(--muted); margin-top: 0; }

code, pre, .trits {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
}
code { background: var(--panel); padding: 0.1em 0.3em; border-radius: 4px; }
pre {
  background: var(--panel);
  padding: 0.9rem 1rem;
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.45;
}
pre code { background: none; padding: 0; }

table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: 0.98rem; }
th, td { padding: 0.35rem 0.6rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { text-align: left; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 0.9rem; }
.table-wrap { overflow-x: auto; }

figure.illustration { margin: 1.75rem 0; }
figure.illustration svg { display: block; width: 100%; height: auto; max-width: 36rem; margin: 0 auto; }
figcaption { text-align: center; color: var(--muted); font-size: 0.95rem; margin-top: 0.5rem; }

/* The illustrations' palette. */
.ink { fill: var(--ink); }
.muted { fill: var(--muted); }
.plus { fill: var(--plus); }
.minus { fill: var(--minus); }
.zero { fill: var(--zero); }
.paper { fill: var(--paper); }
.panel { fill: var(--panel); }
.line { fill: none; stroke: var(--ink); }
.line-muted { fill: none; stroke: var(--muted); }
.rule { fill: none; stroke: var(--rule); }
.plus-line { fill: none; stroke: var(--plus); }
.minus-line { fill: none; stroke: var(--minus); }
svg text { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
svg .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

.next { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; margin: 1rem 0; }
.next a {
  display: block;
  padding: 1rem 1.1rem;
  background: var(--panel);
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink);
}
.next a strong { display: block; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--link); }

footer.site {
  border-top: 1px solid var(--rule);
  padding-top: 1rem;
  padding-bottom: 2.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}
