/* dmog.tabnas.dev, drawn as tabnas.dev is drawn: the same colour scales,
   the same semantic tokens, the same three faces. The tokens are
   tabnas/web's src/styles/tokens.css, carried over whole, so the two
   sites read as one family; the fonts are self-hosted under fonts/, so a
   page makes no request anywhere else. Light and dark follow the
   reader's system, and the header's toggle overrides that by stamping
   data-theme on <html>. */

/* 1. The raw brand scales: the source of truth, used only by the
      semantic tokens below, never by a rule. */
:root {
  --green-950: #0b2d1a;
  --green-900: #0e3320;
  --green-800: #123c24;
  --green-700: #14512e;
  --green-600: #1e6b3e;
  --green-500: #2c7045;
  --green-400: #4f9268;
  --green-300: #82b89b;
  --green-200: #b9d7c6;
  --green-100: #dcebe2;
  --green-50: #eef5f0;

  --gold-900: #5c4715;
  --gold-800: #7a5e1c;
  --gold-700: #9e7720;
  --gold-600: #b8912f;
  --gold-500: #cb9e3e;
  --gold-400: #d8b45f;
  --gold-300: #e6cd8b;
  --gold-200: #f0d585;
  --gold-100: #f6e6b8;
  --gold-50: #faf1d8;

  --parch-50: #fdfbf3;
  --parch-100: #faf6ea;
  --parch-200: #f7eed4;
  --parch-300: #ece0bf;
  --parch-400: #e5d4aa;
  --parch-500: #d3c39a;

  --wood-700: #3f2812;
  --wood-600: #553519;
  --wood-500: #8a5a30;
  --wood-400: #b07d3f;
}

/* 2. The semantic tokens, light. Gold is an accent for large text and
      decoration alone: it does not meet 4.5:1 on parchment. */
:root {
  --bg: var(--parch-100);
  /* The gradient ends on the page's own colour, leaving no edge where
     it stops. */
  --gradient-stops: var(--parch-200), var(--parch-100);
  --surface: var(--parch-50);
  --surface-2: var(--parch-200);
  --ink: var(--green-800);
  --ink-soft: #3a4a3f;
  --ink-mute: #5f675e; /* 5:1 on parch-200, the gradient's top */

  --primary: var(--green-700);
  --primary-hover: var(--green-900);
  --on-primary: var(--parch-50);

  --accent: var(--gold-700);
  --accent-strong: var(--gold-500);

  --border: #ddd0af;
  --border-strong: var(--gold-500);
  --ring: color-mix(in srgb, var(--green-700) 55%, transparent);

  --code-bg: var(--parch-200);
  --code-ink: var(--green-900);
  --shadow: 0 1px 2px rgba(11, 45, 26, 0.06), 0 6px 20px rgba(11, 45, 26, 0.1);


  --font-display: "Uncial Antiqua", "Kells Uncial", "Luminari", serif;
  --font-heading: "Cormorant Garamond", Georgia, serif;
  --font-body: Atkinson, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;

  color-scheme: light;
}

/* 2b. Dark, by the system's preference unless the toggle has chosen. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--green-950);
    --gradient-stops: var(--green-900), var(--green-950);
    --surface: var(--green-800);
    --surface-2: #0f3822;
    --ink: #f1e8cd;
    --ink-soft: #cdbf98;
    --ink-mute: #9aa79b;
    --primary: var(--green-300);
    --primary-hover: var(--green-200);
    --on-primary: var(--green-950);
    --accent: var(--gold-300);
    --accent-strong: var(--gold-400);
    --border: #29452f;
    --border-strong: var(--gold-700);
    --ring: color-mix(in srgb, var(--green-300) 55%, transparent);
    --code-bg: #0f3822;
    --code-ink: var(--gold-100);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 26px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}

/* 2c. Dark, chosen with the toggle. The same values as above: a theme
      is one list, and the two blocks are the two ways of asking for it. */
:root[data-theme="dark"] {
  --bg: var(--green-950);
  --gradient-stops: var(--green-900), var(--green-950);
  --surface: var(--green-800);
  --surface-2: #0f3822;
  --ink: #f1e8cd;
  --ink-soft: #cdbf98;
  --ink-mute: #9aa79b;
  --primary: var(--green-300);
  --primary-hover: var(--green-200);
  --on-primary: var(--green-950);
  --accent: var(--gold-300);
  --accent-strong: var(--gold-400);
  --border: #29452f;
  --border-strong: var(--gold-700);
  --ring: color-mix(in srgb, var(--green-300) 55%, transparent);
  --code-bg: #0f3822;
  --code-ink: var(--gold-100);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 26px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

/* 3. The faces, served from fonts/ beside this file. Atkinson
      Hyperlegible for the body, Cormorant Garamond (variable, 400 to 700,
      roman and italic) for headings, Uncial Antiqua for the wordmark. */
@font-face {
  font-family: Atkinson;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/atkinson-regular.woff") format("woff");
}
@font-face {
  font-family: Atkinson;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/atkinson-bold.woff") format("woff");
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/cormorant-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/cormorant-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/cormorant-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/cormorant-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Uncial Antiqua";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/uncial-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Uncial Antiqua";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/uncial-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* 4. The page. The footer sits at the foot of the window on a short page. */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex; flex-direction: column;
  background: var(--bg);
  background-image: linear-gradient(180deg, var(--gradient-stops));
  background-repeat: no-repeat;
  background-size: 100% 600px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

a { color: var(--primary); text-underline-offset: 0.15em; }
a:hover { color: var(--primary-hover); }
strong, b { font-weight: 700; }
img { max-width: 100%; height: auto; }

/* One focus ring for everything a keyboard reaches, in the primary green,
   which is 8.6:1 on parchment and 6.6:1 on the dark green. */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.skip { position: absolute; left: -999rem; }
.skip:focus {
  left: 1rem; top: 1rem; z-index: 60;
  background: var(--surface); color: var(--ink);
  padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 8px;
}

/* The wordmark, in the footer. */
.word {
  font-family: var(--font-display);
  color: var(--primary);
  letter-spacing: 0.01em;
  line-height: 1;
}

/* 5. The header: sticky, translucent over the page, the sections as
      links, the one for this page's section marked. */
.site-header {
  position: sticky; top: 0; z-index: 50; flex: none;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.bar {
  max-width: 77rem; margin: 0 auto; padding: 0.55rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.6rem;
  text-decoration: none; color: var(--ink);
}
.brand .word { font-size: 1.9rem; }

/* The toggle's icon for the theme shown: chosen with the toggle, or
   else the system's. */
.theme-toggle .i-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: block; }
}

.nav {
  margin-left: auto;
  display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end;
  gap: 0.35rem;
}
.nav-link {
  font-size: 0.98rem; color: var(--ink-soft); text-decoration: none;
  padding: 0.45rem 0.7rem; border-radius: 8px; white-space: nowrap;
}
.nav-link:hover { color: var(--ink); background: color-mix(in srgb, var(--accent-strong) 12%, transparent); }
/* This page's section: green, underlined in the gold accent, which is
   3.8:1 on parchment where the lighter gold would be 2.3:1. */
.nav-link[aria-current] {
  color: var(--primary);
  text-decoration: underline 2px var(--accent); text-underline-offset: 0.5em;
}
/* The section's pages, in the menu on a narrow screen alone. */
.menu-pages { display: none; }
.nav .actions { display: flex; align-items: center; gap: 0.25rem; margin-left: 0.4rem; }
.icon-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 9px;
  color: var(--ink-soft); background: none; border: none; cursor: pointer;
  text-decoration: none; padding: 0;
}
.icon-link:hover { color: var(--primary); background: color-mix(in srgb, var(--accent-strong) 12%, transparent); }

.menu-btn {
  display: none; margin-left: auto;
  flex-direction: column; gap: 4px; width: 40px; height: 40px;
  align-items: center; justify-content: center;
  background: none; border: 1px solid var(--border); border-radius: 9px; cursor: pointer;
}
.menu-btn span { display: block; width: 18px; height: 2px; background: var(--ink); border-radius: 2px; }

/* 6. The shell of a documentation page: the page, its contents, and the
      sidebar, which follows them in the document and stands to their left
      on a wide screen. */
.page {
  flex: 1 0 auto; width: 100%;
  max-width: 77rem; margin: 0 auto; padding: 2rem 1.25rem 1rem;
  display: grid; grid-template-columns: 15rem minmax(0, 1fr) 12rem; gap: 2.5rem;
  align-items: start;
}
.page > main { grid-column: 2; grid-row: 1; }
.page > .toc { grid-column: 3; grid-row: 1; }
.page > .sidebar { grid-column: 1; grid-row: 1; }
body.home .page, body.plain .page { display: block; }
body.home .page { max-width: 72rem; }
body.plain .page { max-width: 48rem; }

.sidebar {
  position: sticky; top: 4.5rem; max-height: calc(100vh - 5.5rem); overflow-y: auto;
  overscroll-behavior: contain; font-size: 0.95rem;
}
.sidebar .group { margin-bottom: 1.25rem; }
.sidebar .group-head {
  font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--ink-mute); margin: 0 0 0.4rem;
}
.sidebar .group-head a { color: inherit; text-decoration: none; }
.sidebar .group-head a:hover, .sidebar .group-head a[aria-current="page"] { color: var(--primary); }
.sidebar .subgroup {
  font-family: var(--font-heading); font-style: italic; font-weight: 600; font-size: 1.05rem;
  color: var(--ink-soft); margin: 0.55rem 0 0.1rem 0.6rem; line-height: 1.3;
}
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { margin: 0; }
.side-link {
  display: block; padding: 0.22rem 0.6rem; line-height: 1.45;
  border-radius: 0 7px 7px 0; border-left: 2px solid transparent;
  color: var(--ink-soft); text-decoration: none;
}
.side-link:hover { color: var(--ink); background: color-mix(in srgb, var(--accent-strong) 10%, transparent); }
.side-link[aria-current="page"] { color: var(--primary); border-left-color: var(--primary); font-weight: 700; }

main { min-width: 0; }
article { max-width: 48rem; }
body.home article { max-width: none; }

.toc {
  position: sticky; top: 4.5rem; max-height: calc(100vh - 5.5rem); overflow-y: auto;
  overscroll-behavior: contain; font-size: 0.88rem;
}
.toc .toc-head, .toc-inline summary {
  font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--ink-mute); margin: 0 0 0.5rem;
}
.toc ul, .toc-inline ul { list-style: none; margin: 0; padding: 0; }
.toc li, .toc-inline li { margin: 0.2rem 0; line-height: 1.4; }
.toc li.sub, .toc-inline li.sub { padding-left: 0.9rem; }
.toc a, .toc-inline a { color: var(--ink-soft); text-decoration: none; }
.toc a:hover, .toc-inline a:hover { color: var(--primary); }

/* The contents at the head of the page, where the column beside it is gone. */
.toc-inline { display: none; margin: 0 0 1.75rem; }
.toc-inline details {
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
}
.toc-inline summary { cursor: pointer; padding: 0.7rem 1rem; margin: 0; color: var(--ink-soft); }
.toc-inline ul { padding: 0 1rem 0.85rem; font-size: 0.95rem; }
.toc-inline li { margin: 0.35rem 0; }

.describes {
  margin: 3rem 0 0; padding-top: 1.25rem; border-top: 1px solid var(--border);
  font-size: 0.85rem; color: var(--ink-mute); max-width: 48rem;
}
.describes a { color: var(--ink-soft); }
.describes a:hover { color: var(--primary); }

.pager {
  display: flex; justify-content: space-between; gap: 1rem;
  margin-top: 1.25rem; max-width: 48rem;
}
.pg {
  display: flex; flex-direction: column; gap: 0.15rem; text-decoration: none;
  border: 1px solid var(--border); border-radius: 10px; padding: 0.75rem 1rem;
  color: var(--ink); background: var(--surface); max-width: 48%;
}
.pg span { font-size: 0.75rem; color: var(--ink-mute); }
.pg.next { text-align: right; margin-left: auto; }
.pg:hover { border-color: var(--border-strong); color: var(--ink); }

/* 7. The prose. html's scroll-padding keeps a heading, a term or a row
      jumped to clear of the header. */
h1, h2, h3, h4 {
  font-family: var(--font-heading); font-weight: 700; line-height: 1.2;
  color: var(--ink);
}
h1 { font-size: 2.5rem; margin: 0.2rem 0 0.6rem; }
h2 { font-size: 1.85rem; margin: 2.25rem 0 0.75rem; }
h3 { font-size: 1.4rem; margin: 1.6rem 0 0.5rem; }
h4 { font-size: 1.15rem; margin: 1.4rem 0 0.4rem; }
p { margin: 0 0 1em; }

/* Every heading and option is linkable; the link shows on hover and on
   focus. */
.heading-anchor {
  margin-left: 0.4em; font-family: var(--font-mono); font-size: 0.7em; font-weight: 400;
  color: var(--accent); text-decoration: none; opacity: 0;
  transition: opacity 0.15s ease-in-out;
}
:is(h2, h3, h4, dt):hover > .heading-anchor, .heading-anchor:focus-visible { opacity: 1; }
.heading-anchor:hover { text-decoration: underline; }
dt > .heading-anchor { font-size: 0.85em; }
@media (prefers-reduced-motion: reduce) {
  .heading-anchor { transition: none; }
  .site-header { backdrop-filter: none; }
}
@media (hover: none) { .heading-anchor { opacity: 0.45; } }

.lede { margin-top: 0; font-size: 1.12rem; color: var(--ink-soft); }
.note { margin-top: -0.4rem; color: var(--ink-mute); font-style: italic; }

/* Code in a line breaks only where it must, and never inside a name a
   table, a term or a link shows: --max-size stays one word. */
code, pre, kbd { font-family: var(--font-mono); }
:not(pre) > code {
  font-size: 0.88em; padding: 0.1em 0.3em; border-radius: 4px;
  background: var(--code-bg); color: var(--code-ink); overflow-wrap: break-word;
}
td code, th code, dt code, a > code { white-space: nowrap; }
pre {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 1rem 1.15rem; overflow-x: auto; line-height: 1.5; margin: 1rem 0;
}
pre code { font-size: 0.86rem; color: var(--code-ink); }
kbd {
  font-size: 0.85em; padding: 0.05em 0.35em; white-space: nowrap;
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px;
  background: var(--surface); color: var(--code-ink);
}

/* A box of commands to type has a button that copies them, in a strip
   above the first line. Every line keeps the box's whole width, and none
   runs under the button. The box draws the border, and its block scrolls
   inside it. */
.code-box {
  position: relative; margin: 1rem 0; padding-top: 1.9rem;
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px;
}
.code-box > pre { margin: 0; padding-top: 0.3rem; border: 0; border-radius: 0 0 10px 10px; }
.copy {
  position: absolute; top: 0.4rem; right: 0.45rem;
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.75rem; height: 1.75rem; padding: 0; cursor: pointer;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--code-bg); color: var(--ink-soft);
}
.copy:hover { color: var(--primary); }
.copy svg { width: 1rem; height: 1rem; }
.copy .i-done, .copy.done .i-copy { display: none; }
.copy.done .i-done { display: block; }
/* On paper there is no button, so its strip goes too. */
@media print {
  .copy { display: none; }
  .code-box { padding-top: 0; }
  .code-box > pre { padding-top: 1rem; }
}

/* Text for a screen reader alone: what a copy button did. */
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.table-wrap { overflow-x: auto; margin: 1rem 0; max-width: 100%; }
table { border-collapse: collapse; margin: 1rem 0; font-size: 0.95rem; }
.table-wrap > table { margin: 0; }
th, td { border: 1px solid var(--border); padding: 0.45rem 0.7rem; text-align: left; vertical-align: top; }
th { background: var(--surface-2); }

/* The keys: each binding's keys on one line, the column as narrow as the
   widest of them. */
table.keys { width: 100%; }
table.keys td:first-child { white-space: nowrap; width: 1%; }
table.keys td { line-height: 1.75; }
tr:target > td, dt:target {
  background: color-mix(in srgb, var(--accent-strong) 18%, transparent);
}

ul, ol { padding-left: 1.4rem; }
li { margin: 0.25rem 0; }

/* A list of terms: the term and what it means side by side, and an
   option, whose meaning is long, above its meaning. */
dl:not(.options) {
  display: grid; grid-template-columns: fit-content(45%) minmax(0, 1fr);
  gap: 0.55rem 1.25rem; margin: 1rem 0; align-items: baseline;
}
dl:not(.options) > dt { margin: 0; font-weight: 600; }
dl:not(.options) > dd { margin: 0; }
dl.options > dt { margin-top: 1.4rem; font-weight: 600; }
dl.options > dt:first-child { margin-top: 0.6rem; }
dl.options > dd {
  margin: 0.4rem 0 0 0.15rem; padding-left: 1rem; border-left: 2px solid var(--border);
}
dd > p:first-child { margin-top: 0; }
dd > p:last-child { margin-bottom: 0; }

blockquote {
  margin: 1.25rem 0; padding: 0.1rem 0 0.1rem 1.1rem;
  border-left: 3px solid var(--accent-strong); color: var(--ink-soft);
}
hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* A section's list of its pages: one row a page, under its group. */
.group-blurb { color: var(--ink-mute); max-width: 46rem; margin: 0 0 1rem; font-size: 0.95rem; }
.list { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: 0.6rem; }
.list li { margin: 0; }
.row {
  display: block; border: 1px solid var(--border); border-radius: 10px;
  padding: 0.85rem 1rem; background: var(--surface); text-decoration: none; color: inherit;
}
.row:hover { border-color: var(--border-strong); color: inherit; }
.row-title { display: block; color: var(--primary); font-weight: 700; }
.row-desc { display: block; color: var(--ink-soft); font-size: 0.92rem; margin-top: 0.15rem; }

/* Chips: the formats, and other short lists of names. */
.chips { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; margin: 0.75rem 0 1.25rem; }
.chips-label {
  font-family: var(--font-mono); font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-mute);
}
.chip {
  font-family: var(--font-mono); font-size: 0.82rem; text-decoration: none;
  color: var(--ink-soft); border: 1px solid var(--border); border-radius: 999px;
  padding: 0.25rem 0.7rem; background: var(--surface);
}
a.chip { color: var(--primary); border-color: var(--border-strong); }
a.chip:hover { color: var(--primary-hover); text-decoration: underline; }

/* Cards: the four kinds of documentation, each a link as a whole, and the
   project. */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; margin: 1.25rem 0; }
.card {
  display: block; border: 1px solid var(--border); border-radius: 12px;
  padding: 1.25rem; background: var(--surface); text-decoration: none; color: inherit;
}
.card h3 { font-size: 1.3rem; margin: 0 0 0.4rem; }
.card p { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }
.card p + p { margin-top: 0.6rem; }
a.card h3 { color: var(--primary); }
a.card h3::after { content: " →"; font-family: var(--font-body); font-size: 0.8em; }
a.card:hover { border-color: var(--border-strong); color: inherit; }
a.card:hover h3 { text-decoration: underline; text-underline-offset: 0.15em; }

/* Buttons: a link that is the page's next step. */
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.75rem; padding: 0.55rem 1.25rem; border-radius: 999px;
  border: 1px solid var(--primary); background: var(--surface); color: var(--primary);
  font-weight: 700; line-height: 1.2; text-decoration: none;
}
.button:hover { color: var(--primary-hover); border-color: var(--primary-hover); }
.button.primary { background: var(--primary); color: var(--on-primary); }
.button.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary); }

/* 8. The footer. */
.site-footer {
  flex: none;
  margin-top: 4rem; border-top: 1px solid var(--border); color: var(--ink-soft);
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--accent-strong) 6%, transparent));
}
.site-footer .inner { max-width: 77rem; margin: 0 auto; padding: 3rem 1.25rem 3.5rem; }
.site-footer .cols { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 2rem; }
.site-footer .about .word { font-size: 1.9rem; }
.site-footer .motto {
  font-family: var(--font-heading); font-style: italic; font-weight: 500; color: var(--ink-soft);
  margin: 0.4rem 0 0.5rem; max-width: 34ch; font-size: 1.12rem; line-height: 1.45;
}
.site-footer .byline { font-size: 0.9rem; color: var(--ink-soft); margin: 0 0 1rem; }
.site-footer .byline a { color: var(--ink-soft); }
.site-footer .byline a:hover { color: var(--primary); }
.site-footer .col { display: flex; flex-direction: column; gap: 0.5rem; }
.site-footer .col-head {
  font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--ink-mute); margin: 0 0 0.35rem;
}
.site-footer .col a { color: var(--ink-soft); text-decoration: none; font-size: 0.95rem; }
.site-footer .col a:hover { color: var(--primary); }
.site-footer .legal {
  margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  font-size: 0.85rem; color: var(--ink-mute);
}
.site-footer .legal a { color: var(--ink-mute); }
.site-footer .legal a:hover { color: var(--primary); }

/* 9. The home page: the introduction and a capture, beside each other
      where the screen is wide, then the prose in lines of a readable
      length. */
.intro { text-align: center; padding: 1.5rem 0 0.5rem; }
.intro .word { display: block; font-size: 4.5rem; margin: 0 auto 1rem; }
.intro h1 {
  font-size: clamp(1.8rem, 3.6vw, 2.5rem); line-height: 1.12; text-wrap: balance;
  max-width: 30ch; margin: 0 auto 0.9rem;
}
.intro .lede { max-width: 60ch; margin: 0 auto; }
.intro .actions { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; margin: 1.5rem 0 0; }
.intro .meta { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-mute); margin: 1.25rem 0 0; }
body.home article > p:not(.chips), body.home article > ul { max-width: 70ch; }
.home h2 { font-size: clamp(1.5rem, 3vw, 2rem); }

/* 10. Narrow screens. The contents move to the head of the page, then the
       sidebar to its foot and the header into a menu, which holds the
       section's pages. */
@media (max-width: 1080px) {
  .page { grid-template-columns: 15rem minmax(0, 1fr); }
  .page > .toc { display: none; }
  .toc-inline { display: block; }
}
@media (max-width: 1000px) {
  .page { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 1.5rem 1rem 1rem; }
  .page > main, .page > .sidebar { grid-column: 1; grid-row: auto; }
  .sidebar {
    position: static; max-height: none; overflow: visible;
    margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--border);
  }
  .menu-btn { display: flex; }
  .nav {
    position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; flex-wrap: nowrap; justify-content: flex-start;
    gap: 0.15rem; background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.25rem 1rem; box-shadow: var(--shadow); display: none;
    max-height: calc(100vh - 4rem); overflow-y: auto; overscroll-behavior: contain;
  }
  .nav.open { display: flex; }
  .nav-link { padding: 0.6rem 0.5rem; }
  .nav.open .menu-pages {
    display: block; list-style: none; margin: 0 0 0.4rem 0.5rem; padding: 0 0 0 0.75rem;
    border-left: 2px solid var(--border);
  }
  .menu-pages li { margin: 0; }
  .menu-pages a {
    display: block; padding: 0.4rem 0.5rem; color: var(--ink-soft);
    text-decoration: none; font-size: 0.95rem; line-height: 1.4;
  }
  .menu-pages a:hover { color: var(--primary); }
  .menu-pages a[aria-current="page"] { color: var(--primary); font-weight: 700; }
  .menu-pages .menu-all a { color: var(--ink-mute); font-size: 0.85rem; }
  .nav .actions { margin: 0.4rem 0 0; }
}
@media (max-width: 900px) {
  .site-footer .cols { grid-template-columns: 1fr 1fr; gap: 1.75rem; }
  .site-footer .about { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  h1 { font-size: 2rem; }
  .pager { flex-direction: column; }
  .pg { max-width: none; }
  .pg.next { margin-left: 0; }
}
@media (max-width: 560px) {
  table.keys td:first-child { white-space: normal; }
  dl:not(.options) { display: block; }
  dl:not(.options) > dt { margin-top: 0.9rem; }
  dl:not(.options) > dd { margin: 0.2rem 0 0 1.25rem; }
}
@media (max-width: 680px) {
  .site-footer .cols { grid-template-columns: 1fr; }
}
