/*
  llembas.eu — one stylesheet, no build step.

  The look is the LLeMbas server's own: a dark terminal palette ("Moria") with a
  phosphor-leaf brand colour and ithildin-cyan accents, a parchment light theme
  ("Shire"), square corners, hard offset shadows, and a monospace face for the
  chrome. Every colour resolves through a custom property on :root.

  Layout rule: anything that sits side by side lines up by construction —
  shared grid tracks and subgrid, never alignment by coincidence.
*/

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-latin.woff2") format("woff2");
}

/* ---------------------------------------------------------------- tokens */
:root {
  --font-ui: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: var(--font-ui);

  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 1rem;
  --text-md: 1.0625rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;
  --text-2xl: 2rem;
  --text-hero: clamp(2.25rem, 1.4rem + 3.6vw, 4rem);

  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
  --sp-16: 4rem;

  --radius: 2px;
  --press: 2px;
  --border-w: 1px;
  --control-h: 2.5rem;
  --tap-min: 2.75rem;
  --header-h: 3.75rem;
  --page-max: 74rem;
  --prose-max: 46rem;
  --gutter: 1.5rem;

  /* Moria — dark, the default */
  color-scheme: dark;
  --bg: #0B0D10;
  --bg-sunken: #07090B;
  --surface: #11151A;
  --surface-raised: #171C22;
  --surface-hover: #1D232B;
  --border: #26303A;
  --border-strong: #5C6976;
  --ink: #E2E8EC;
  --ink-muted: #A6B2BC;
  --ink-faint: #8794A0;
  --accent: #8FD8E8;
  --accent-hover: #B4E6F1;
  --accent-ink: #061418;
  --accent-soft: rgba(143, 216, 232, 0.12);
  --leaf: #7EE081;
  --leaf-soft: rgba(126, 224, 129, 0.12);
  --warning: #F0A840;
  --warning-soft: rgba(240, 168, 64, 0.13);
  --code-bg: #07090B;
  --shadow-block: var(--press) var(--press) 0 rgba(0, 0, 0, 0.55);
  --shadow-block-accent: var(--press) var(--press) 0 rgba(143, 216, 232, 0.28),
    0 0 22px -6px rgba(143, 216, 232, 0.55);
  --shadow-card: 4px 4px 0 rgba(0, 0, 0, 0.55);
  --glow-title: 0 0 18px rgba(143, 216, 232, 0.35);
  --texture-screen:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse 60% 45% at 50% 18%, rgba(143, 216, 232, 0.10), transparent 70%),
    radial-gradient(ellipse 75% 65% at 50% 35%, transparent 45%, var(--bg) 92%),
    linear-gradient(rgba(143, 216, 232, 0.05) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(143, 216, 232, 0.05) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--bg);
}

/* Shire — light. Applied when the reader's system prefers light and no choice
   is stored, or when the toggle chose it. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #F1EAD6;
    --bg-sunken: #E7DEC6;
    --surface: #F8F3E5;
    --surface-raised: #FCF9F0;
    --surface-hover: #ECE4CF;
    --border: #CBBF9D;
    --border-strong: #2A2E22;
    --ink: #1F2418;
    --ink-muted: #474D3B;
    --ink-faint: #5E6250;
    --accent: #285F3C;
    --accent-hover: #1F4D30;
    --accent-ink: #F8F3E5;
    --accent-soft: rgba(40, 95, 60, 0.12);
    --leaf: #3D6B1C;
    --leaf-soft: rgba(61, 107, 28, 0.1);
    --warning: #7E5200;
    --warning-soft: rgba(126, 82, 0, 0.1);
    --code-bg: #EFE7D1;
    --shadow-block: var(--press) var(--press) 0 var(--border-strong);
    --shadow-block-accent: var(--press) var(--press) 0 var(--border-strong);
    --shadow-card: 4px 4px 0 var(--border-strong);
    --glow-title: none;
    --texture-screen:
      radial-gradient(ellipse 80% 70% at 50% 30%, transparent 50%, var(--bg) 95%),
      radial-gradient(rgba(31, 36, 24, 0.14) 0.8px, transparent 1.1px) 0 0 / 6px 6px,
      var(--bg);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F1EAD6;
  --bg-sunken: #E7DEC6;
  --surface: #F8F3E5;
  --surface-raised: #FCF9F0;
  --surface-hover: #ECE4CF;
  --border: #CBBF9D;
  --border-strong: #2A2E22;
  --ink: #1F2418;
  --ink-muted: #474D3B;
  --ink-faint: #5E6250;
  --accent: #285F3C;
  --accent-hover: #1F4D30;
  --accent-ink: #F8F3E5;
  --accent-soft: rgba(40, 95, 60, 0.12);
  --leaf: #3D6B1C;
  --leaf-soft: rgba(61, 107, 28, 0.1);
  --warning: #7E5200;
  --warning-soft: rgba(126, 82, 0, 0.1);
  --code-bg: #EFE7D1;
  --shadow-block: var(--press) var(--press) 0 var(--border-strong);
  --shadow-block-accent: var(--press) var(--press) 0 var(--border-strong);
  --shadow-card: 4px 4px 0 var(--border-strong);
  --glow-title: none;
  --texture-screen:
    radial-gradient(ellipse 80% 70% at 50% 30%, transparent 50%, var(--bg) 95%),
    radial-gradient(rgba(31, 36, 24, 0.14) 0.8px, transparent 1.1px) 0 0 / 6px 6px,
    var(--bg);
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + var(--sp-4));
}
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  overflow-x: clip;
}
main { flex: 1 0 auto; }
img, svg { max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, h4 {
  font-family: var(--font-ui);
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0 0 var(--sp-4);
  text-wrap: balance;
}
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); margin-top: var(--sp-12); }
h3 { font-size: var(--text-lg); margin-top: var(--sp-8); }
h4 { font-size: var(--text-base); margin-top: var(--sp-6); }
p, ul, ol, dl { margin: 0 0 var(--sp-4); }
ul, ol { padding-left: 1.4em; }
li + li { margin-top: var(--sp-1); }
strong { font-weight: 650; }
hr { border: 0; border-top: var(--border-w) solid var(--border); margin: var(--sp-10) 0; }
code, kbd, pre { font-family: var(--font-mono); font-size: 0.9em; }
:not(pre) > code {
  background: var(--surface-raised);
  border: var(--border-w) solid var(--border);
  padding: 0.05em 0.35em;
  border-radius: var(--radius);
  overflow-wrap: anywhere;
}
kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0.05em 0.4em;
  border: var(--border-w) solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-raised);
  box-shadow: 1px 1px 0 var(--border-strong);
  text-align: center;
  white-space: nowrap;
}
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; margin: -1px; padding: 0; border: 0;
}

.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: -10rem;
  z-index: 100;
  padding: var(--sp-2) var(--sp-4);
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-ui);
  font-weight: 700;
}
.skip-link:focus { top: var(--sp-2); color: var(--accent-ink); }

.wrap {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Section labels: [ FEATURES ] */
.label {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 var(--sp-3);
}
.label::before { content: "[\00a0"; color: var(--leaf); }
.label::after { content: "\00a0]"; color: var(--leaf); }

/* ---------------------------------------------------------------- header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: var(--border-w) solid var(--border);
}
.site-header__inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sp-4);
  height: var(--header-h);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--tap-min);
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: var(--text-md);
}
.brand:hover { color: var(--ink); }
.brand img { width: 28px; height: 28px; image-rendering: pixelated; }
.brand b { color: var(--leaf); font-weight: 800; }

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--sp-1);
}
.site-nav li + li { margin: 0; }
.site-nav a {
  display: inline-flex;
  align-items: center;
  height: var(--control-h);
  padding: 0 var(--sp-3);
  color: var(--ink-muted);
  text-decoration: none;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 600;
  border: var(--border-w) solid transparent;
}
.site-nav a:hover { color: var(--ink); background: var(--surface-hover); }
.site-nav a[aria-current="page"] {
  color: var(--leaf);
  border-color: var(--border);
  background: var(--surface);
}
.site-nav a[aria-current="page"]::before { content: "["; margin-right: 0.3em; }
.site-nav a[aria-current="page"]::after { content: "]"; margin-left: 0.3em; }

.header-tools { display: flex; gap: var(--sp-2); align-items: center; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: var(--control-h);
  height: var(--control-h);
  padding: 0;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--ink);
  box-shadow: var(--shadow-block);
  cursor: pointer;
  font: inherit;
}
.icon-btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.icon-btn:active { transform: translate(var(--press), var(--press)); box-shadow: none; }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="light"] .theme-toggle .i-sun { display: block; }
:root[data-theme="light"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="dark"]) .theme-toggle .i-moon { display: none; }
}
.menu-toggle { display: none; }

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--control-h);
  padding: var(--sp-2) var(--sp-4);
  border: var(--border-w) solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  text-align: center;
  box-shadow: var(--shadow-block);
  cursor: pointer;
}
.btn:hover { background: var(--surface-hover); color: var(--ink); }
.btn:active { transform: translate(var(--press), var(--press)); box-shadow: none; }
.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--shadow-block-accent);
}
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn[aria-disabled="true"] { opacity: 0.6; cursor: default; box-shadow: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--sp-3); }

/* ------------------------------------------------------------------ hero */
.hero {
  background: var(--texture-screen);
  border-bottom: var(--border-w) solid var(--border);
  padding: var(--sp-16) 0 var(--sp-12);
}
.hero__grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--sp-8);
  align-items: center;
}
.hero__leaf {
  width: 128px;
  height: 128px;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 24px var(--leaf-soft));
}
.hero h1 {
  font-size: var(--text-hero);
  margin: 0 0 var(--sp-3);
  text-shadow: var(--glow-title);
  letter-spacing: -0.02em;
}
.hero h1 .ll { color: var(--leaf); }
.hero__tagline {
  font-family: var(--font-ui);
  color: var(--ink-muted);
  margin: 0 0 var(--sp-4);
}
.hero__tagline::before { content: "> "; color: var(--accent); }
.hero__pitch { font-size: var(--text-lg); max-width: 40rem; margin: 0 0 var(--sp-6); }

.page-head {
  background: var(--texture-screen);
  border-bottom: var(--border-w) solid var(--border);
  padding: var(--sp-12) 0 var(--sp-10);
}
.page-head h1 { font-size: clamp(1.75rem, 1.3rem + 2vw, 2.75rem); text-shadow: var(--glow-title); margin-bottom: var(--sp-3); }
.page-head p.lead { font-size: var(--text-lg); color: var(--ink-muted); max-width: 44rem; margin-bottom: var(--sp-6); }
.page-head .banner {
  display: block;
  width: 100%;
  max-width: 56rem;
  margin-top: var(--sp-8);
  border: var(--border-w) solid var(--border);
  box-shadow: var(--shadow-card);
}

/* -------------------------------------------------------------- sections */
.section { padding: var(--sp-12) 0; }
.section + .section { border-top: var(--border-w) solid var(--border); }
.section > .wrap > h2:first-of-type,
.section h2.section__title { margin-top: 0; }
.section__intro { color: var(--ink-muted); max-width: var(--prose-max); margin-bottom: var(--sp-8); }

/* Card grid: tracks shrink below their minimum rather than overflow. */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: var(--sp-6);
}
.grid--wide { grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); }

.card {
  background: var(--surface);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-6);
  box-shadow: var(--shadow-card);
  min-width: 0;
}
.card h3 { margin: 0 0 var(--sp-3); font-size: var(--text-md); }
.card p:last-child, .card ul:last-child { margin-bottom: 0; }
.card ul { padding-left: 1.2em; }
.card--muted { box-shadow: none; }

/* Product cards: every part on a shared row track (subgrid), so tags,
   titles, descriptions and buttons line up across the row whatever their text. */
.products {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  grid-auto-rows: auto;
  gap: var(--sp-6);
}
.product {
  display: grid;
  grid-row: span 5;
  grid-template-rows: subgrid;
  row-gap: var(--sp-3);
  background: var(--surface);
  border: var(--border-w) solid var(--border);
  padding: var(--sp-6);
  box-shadow: var(--shadow-card);
  min-width: 0;
}
.product__top { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.product__icon {
  width: 3rem; height: 3rem;
  display: grid; place-items: center;
  border: var(--border-w) solid var(--border);
  background: var(--bg-sunken);
  color: var(--leaf);
  font-family: var(--font-ui);
  font-weight: 800;
}
.product__icon img { width: 32px; height: 32px; image-rendering: pixelated; }
.product h3 { margin: 0; font-size: var(--text-lg); align-self: end; }
.product p { margin: 0; color: var(--ink-muted); }
.product ul { margin: 0; padding-left: 1.2em; font-size: 0.95rem; }
.product .btn-row { align-self: end; }

.tag {
  display: inline-flex;
  align-items: center;
  height: 1.6rem;
  padding: 0 var(--sp-2);
  border: var(--border-w) solid var(--leaf);
  color: var(--leaf);
  background: var(--leaf-soft);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.tag--soon { border-color: var(--warning); color: var(--warning); background: var(--warning-soft); }
.tag--next { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* Quick-start columns: heading, text, code on shared rows. */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
  gap: var(--sp-3) var(--sp-8);
}
.step {
  display: grid;
  grid-row: span 3;
  grid-template-rows: subgrid;
  min-width: 0;
}
.step h3 { margin: 0; }
.step p { margin: 0; color: var(--ink-muted); }
.step .code { margin: 0; }

/* ------------------------------------------------------------ code block */
.code {
  margin: 0 0 var(--sp-6);
  border: var(--border-w) solid var(--border);
  background: var(--code-bg);
  border-radius: var(--radius);
  min-width: 0;
  max-width: 100%;
}
.code__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  min-height: 2.5rem;
  padding: 0 var(--sp-2) 0 var(--sp-4);
  border-bottom: var(--border-w) solid var(--border);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.code pre {
  margin: 0;
  padding: var(--sp-4);
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
  tab-size: 2;
}
.code pre code { white-space: pre; }
.code .c { color: var(--ink-faint); }
.code .p { color: var(--leaf); user-select: none; }
.copy-btn {
  min-height: 2rem;
  padding: 0 var(--sp-3);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--ink-muted);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
}
.copy-btn:hover { color: var(--ink); border-color: var(--border-strong); }
.copy-btn[data-state="done"] { color: var(--leaf); border-color: var(--leaf); }

/* ----------------------------------------------------------------- table */
.table-wrap {
  overflow-x: auto;
  margin: 0 0 var(--sp-6);
  border: var(--border-w) solid var(--border);
  max-width: 100%;
}
table { border-collapse: collapse; width: 100%; font-size: 0.9375rem; }
th, td {
  text-align: left;
  vertical-align: top;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: var(--border-w) solid var(--border);
}
tr:last-child td { border-bottom: 0; }
th {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  background: var(--surface);
  white-space: nowrap;
}
td code { white-space: nowrap; }
td.wrap-code code { white-space: normal; }

/* ----------------------------------------------------------------- notes */
.note {
  border: var(--border-w) solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  padding: var(--sp-4) var(--sp-5);
  margin: 0 0 var(--sp-6);
}
.note--warn { border-left-color: var(--warning); background: var(--warning-soft); }
.note > :last-child { margin-bottom: 0; }
.note strong:first-child { font-family: var(--font-ui); }

/* ------------------------------------------------------------------ prose */
.prose { max-width: var(--prose-max); min-width: 0; }
.prose > h2:first-child { margin-top: 0; }
.prose li > ul { margin: var(--sp-1) 0 0; }

.feature-list { list-style: none; padding: 0; margin: 0; }
.feature-list li { padding-left: 1.4em; position: relative; }
.feature-list li::before { content: "›"; position: absolute; left: 0.2em; color: var(--leaf); font-family: var(--font-ui); font-weight: 700; }

/* Two-column page layout for long product pages and docs. */
.with-toc {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr);
  gap: var(--sp-10);
  align-items: start;
  padding-block: var(--sp-10) var(--sp-16);
}
.side-nav {
  position: sticky;
  top: calc(var(--header-h) + var(--sp-6));
  max-height: calc(100vh - var(--header-h) - var(--sp-10));
  overflow-y: auto;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
}
.side-nav summary {
  display: none;
  list-style: none;
  cursor: pointer;
  min-height: var(--tap-min);
  align-items: center;
  padding: 0 var(--sp-4);
  border: var(--border-w) solid var(--border);
  background: var(--surface);
  font-weight: 650;
}
.side-nav summary::-webkit-details-marker { display: none; }
.side-nav summary::after { content: "▾"; margin-left: auto; color: var(--leaf); }
.side-nav details[open] summary::after { content: "▴"; }
.side-nav h2 {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  margin: var(--sp-5) 0 var(--sp-2);
}
.side-nav h2:first-child { margin-top: 0; }
.side-nav ul { list-style: none; margin: 0; padding: 0; }
.side-nav li + li { margin-top: 0; }
.side-nav a {
  display: flex;
  align-items: center;
  min-height: 2.25rem;
  padding: var(--sp-1) var(--sp-3);
  border-left: 2px solid var(--border);
  color: var(--ink-muted);
  text-decoration: none;
  line-height: 1.35;
}
.side-nav a:hover { color: var(--ink); border-left-color: var(--border-strong); background: var(--surface-hover); }
.side-nav a[aria-current="page"] { color: var(--leaf); border-left-color: var(--leaf); background: var(--leaf-soft); font-weight: 650; }

.doc-foot {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: var(--sp-4);
  margin-top: var(--sp-12);
  padding-top: var(--sp-6);
  border-top: var(--border-w) solid var(--border);
}
.doc-foot a {
  display: grid;
  gap: var(--sp-1);
  padding: var(--sp-4);
  border: var(--border-w) solid var(--border);
  background: var(--surface);
  text-decoration: none;
  font-family: var(--font-ui);
  font-weight: 650;
  box-shadow: var(--shadow-block);
}
.doc-foot a span { font-size: var(--text-xs); color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.doc-foot a.next { text-align: right; }
.breadcrumb { font-family: var(--font-ui); font-size: var(--text-sm); color: var(--ink-faint); margin-bottom: var(--sp-3); }
.breadcrumb a { color: var(--ink-muted); }

/* Docs index list */
.doc-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: var(--sp-4);
  margin: 0 0 var(--sp-10);
  padding: 0;
  list-style: none;
}
.doc-cards li + li { margin: 0; }
.doc-cards a {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: var(--sp-2);
  height: 100%;
  padding: var(--sp-5);
  border: var(--border-w) solid var(--border);
  background: var(--surface);
  color: var(--ink-muted);
  text-decoration: none;
  box-shadow: var(--shadow-block);
}
.doc-cards a:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.doc-cards strong { font-family: var(--font-ui); color: var(--accent); }

/* Changelog / roadmap */
.release {
  border: var(--border-w) solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  padding: var(--sp-6);
  margin-bottom: var(--sp-8);
  min-width: 0;
}
.release__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-2) var(--sp-4);
  margin-bottom: var(--sp-4);
}
.release__head h2 { margin: 0; font-size: var(--text-xl); }
.release__meta { font-family: var(--font-ui); font-size: var(--text-sm); color: var(--ink-faint); }

.status-list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--sp-3); }
.status-list li + li { margin: 0; }
.status-list li {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: var(--sp-4);
  align-items: start;
  padding: var(--sp-4);
  border: var(--border-w) solid var(--border);
  background: var(--surface);
}
.status-list .tag { justify-self: start; }
.status-list strong { display: block; font-family: var(--font-ui); }
.status-list p { margin: var(--sp-1) 0 0; color: var(--ink-muted); }

/* ---------------------------------------------------------------- footer */
.site-footer {
  border-top: var(--border-w) solid var(--border);
  background: var(--bg-sunken);
  padding: var(--sp-10) 0 var(--sp-8);
  font-size: var(--text-sm);
  color: var(--ink-muted);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: var(--sp-8);
}
.site-footer h2 {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  margin: 0 0 var(--sp-3);
}
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li + li { margin-top: 0; }
.site-footer li a {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  color: var(--ink-muted);
  text-decoration: none;
}
.site-footer li a:hover { color: var(--accent); text-decoration: underline; }
.footer-brand p { margin: var(--sp-3) 0 0; max-width: 22rem; }
.footer-legal {
  margin-top: var(--sp-8);
  padding-top: var(--sp-5);
  border-top: var(--border-w) solid var(--border);
  font-size: var(--text-xs);
  color: var(--ink-faint);
}
.footer-legal p { margin: 0 0 var(--sp-2); }

/* 404 */
.notfound { padding: var(--sp-16) 0; text-align: center; background: var(--texture-screen); min-height: 60vh; }
.notfound .code404 { font-family: var(--font-ui); font-size: clamp(3rem, 2rem + 6vw, 6rem); font-weight: 800; color: var(--leaf); text-shadow: var(--glow-title); margin: var(--sp-4) 0; line-height: 1; }
.notfound .btn-row { justify-content: center; }
.notfound img { width: 96px; height: 96px; image-rendering: pixelated; }

/* ------------------------------------------------------------ narrow (≤48rem) */
@media (max-width: 64rem) {
  .with-toc { grid-template-columns: 12rem minmax(0, 1fr); gap: var(--sp-6); }
}
@media (max-width: 48rem) {
  :root {
    --gutter: 1rem;
    --text-base: 1rem;
    --text-xl: 1.3rem;
    --text-2xl: 1.6rem;
    --control-h: var(--tap-min);
  }
  .menu-toggle { display: inline-grid; }
  .site-header__inner { grid-template-columns: minmax(0, 1fr) auto; }
  .js .site-nav {
    display: none;
    position: absolute;
    left: 0; right: 0;
    top: var(--header-h);
    background: var(--bg);
    border-bottom: var(--border-w) solid var(--border);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
  }
  .js .site-nav[data-open="true"] { display: block; }
  .site-nav ul { flex-direction: column; padding: var(--sp-2) var(--gutter) var(--sp-4); gap: 0; }
  .site-nav a { display: flex; height: auto; min-height: var(--tap-min); font-size: var(--text-base); }
  html:not(.js) .site-header { position: static; }
  html:not(.js) .site-header__inner { height: auto; grid-template-columns: 1fr; padding-block: var(--sp-2); }
  html:not(.js) .site-nav ul { flex-direction: row; padding: 0; }
  html:not(.js) .menu-toggle { display: none; }

  .hero { padding: var(--sp-10) 0 var(--sp-8); }
  .hero__grid { grid-template-columns: 1fr; gap: var(--sp-4); }
  .hero__leaf { width: 72px; height: 72px; }
  .hero__pitch { font-size: var(--text-md); }
  .page-head { padding: var(--sp-8) 0 var(--sp-6); }
  .page-head p.lead { font-size: var(--text-md); }
  .section { padding: var(--sp-8) 0; }
  .card, .product, .release { padding: var(--sp-4); }
  .grid, .products, .doc-cards { gap: var(--sp-4); }
  .btn { min-height: var(--tap-min); }
  .copy-btn { min-height: var(--tap-min); }
  .code pre { font-size: 0.8125rem; padding: var(--sp-3); }
  th, td { padding: var(--sp-2) var(--sp-3); }
  h2 { margin-top: var(--sp-10); }

  .with-toc { grid-template-columns: minmax(0, 1fr); gap: var(--sp-6); padding-top: var(--sp-6); }
  .side-nav { position: static; max-height: none; overflow: visible; }
  .side-nav summary { display: flex; }
  .side-nav nav { padding-top: var(--sp-3); }
  .side-nav a { min-height: var(--tap-min); }
  .status-list li { grid-template-columns: 1fr; gap: var(--sp-2); }
  .site-footer li a { min-height: var(--tap-min); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media print {
  .site-header, .site-footer, .side-nav, .copy-btn, .skip-link { display: none !important; }
  .with-toc { display: block; }
}
.doc-lead { font-size: var(--text-lg); color: var(--ink-muted); }
@media (max-width: 48rem) { .doc-lead { font-size: var(--text-md); } }
@media (max-width: 48rem) {
  td code { white-space: normal; overflow-wrap: anywhere; }
  td:first-child code { white-space: nowrap; overflow-wrap: normal; }
  table { font-size: 0.875rem; }
}
