/* Tandem docs. Same palette, type and shapes as the app and the landing page
   (site/assets/site.css): light and dark follow the system, and the toggle
   overrides it. Written by hand; scripts/build-docs.mjs writes the pages. */

@font-face {
  font-family: Nunito;
  src: url(../assets/fonts/nunito.woff2) format("woff2");
  font-weight: 400 900;
  font-display: swap;
}

:root {
  --night: #13121c;
  --deep: #0b0a12;
  --card: #1d1b29;
  --card-hi: #2a2740;
  --line: rgb(246 243 255 / 0.08);
  --line-hi: rgb(246 243 255 / 0.15);
  --text: #f6f3ff;
  --body: #dcd8ec;
  --muted: #aaa5c2;
  --mint: #8eecc8;
  --peach: #ffb4a2;
  --lav: #b8a8ff;
  --sky: #8fd3ff;
  --butter: #ffe49a;
  --on-accent: #0b0a12;
  --glow: 0.13;
  --shadow: 0 30px 80px -30px rgb(0 0 0 / 0.75);
  --top: 64px;
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --night: #faf8ff; --deep: #f1eefa; --card: #fff; --card-hi: #f3f0fc;
    --line: rgb(30 24 60 / 0.09); --line-hi: rgb(30 24 60 / 0.16);
    --text: #1c1830; --body: #37324d; --muted: #5d5878;
    --mint: #12865f; --peach: #c2523a; --lav: #6a55d6; --sky: #1c78b0; --butter: #9a6b00;
    --on-accent: #fff; --glow: 0.22; --shadow: 0 30px 70px -34px rgb(40 30 90 / 0.35);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --night: #faf8ff; --deep: #f1eefa; --card: #fff; --card-hi: #f3f0fc;
  --line: rgb(30 24 60 / 0.09); --line-hi: rgb(30 24 60 / 0.16);
  --text: #1c1830; --body: #37324d; --muted: #5d5878;
  --mint: #12865f; --peach: #c2523a; --lav: #6a55d6; --sky: #1c78b0; --butter: #9a6b00;
  --on-accent: #fff; --glow: 0.22; --shadow: 0 30px 70px -34px rgb(40 30 90 / 0.35);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top) + 20px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--body); overflow-x: hidden;
  font: 500 17px/1.7 Nunito, ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 520px at 88% -8%, rgb(184 168 255 / var(--glow)), transparent 70%),
    radial-gradient(760px 460px at -8% 18%, rgb(142 236 200 / calc(var(--glow) * 0.7)), transparent 70%),
    var(--night);
  background-attachment: fixed;
}
a { color: var(--mint); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--lav); outline-offset: 2px; border-radius: 8px; }
img { max-width: 100%; height: auto; }
svg { flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.fill { fill: currentColor; stroke: none; }
button { font: inherit; color: inherit; }
kbd { display: inline-block; font: 700 0.78em/1.5 var(--mono); padding: 0 0.45em; border-radius: 7px; border: 1px solid var(--line-hi); border-bottom-width: 2px; background: var(--card); color: var(--text); vertical-align: 0.08em; white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 60; background: var(--mint); color: var(--on-accent); padding: 10px 16px; border-radius: 12px; font-weight: 800; }
.skip:focus { top: 10px; }

/* Controller buttons, coloured like the button hints in the app. */
.pad {
  display: inline-grid; place-items: center; min-width: 1.75em; height: 1.75em; padding: 0; border: 0; border-radius: 50%;
  font: 900 0.74em/1 Nunito, sans-serif; color: #15131f; background: var(--pc, #c9c3e3); vertical-align: 0.1em;
  box-shadow: inset 0 -2px 0 rgb(0 0 0 / 0.16), 0 0 0 1px rgb(0 0 0 / 0.06);
}
.pad--a { --pc: #8eecc8; }
.pad--b { --pc: #b8a8ff; }
.pad--x { --pc: #ffb4a2; }
.pad--y { --pc: #ffe49a; }
.pad--pill { border-radius: 999px; padding: 0 0.6em; --pc: #dcd8ec; }

/* ── Top bar ── */
.top {
  position: sticky; top: 0; z-index: 30; height: var(--top);
  display: flex; align-items: center; gap: 10px; padding: 0 20px;
  background: color-mix(in srgb, var(--night) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.top__menu, .theme, .nav__close { display: none; place-items: center; width: 44px; height: 44px; flex: none; border: 1px solid var(--line-hi); border-radius: 14px; background: var(--card); color: var(--text); cursor: pointer; }
.top__menu svg, .theme svg, .nav__close svg { width: 20px; height: 20px; }
.top__brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 900; font-size: 21px; letter-spacing: -0.02em; margin-right: 6px; }
.top__brand:hover { text-decoration: none; }
.top__brand img { transition: transform 0.3s cubic-bezier(.34, 1.56, .64, 1); }
.top__brand:hover img { transform: rotate(-8deg) scale(1.06); }
.top__docs { font-size: 12.5px; color: var(--on-accent); background: var(--lav); padding: 2px 9px; border-radius: 999px; letter-spacing: 0; }
.top__search {
  margin-left: auto; display: none; align-items: center; gap: 10px; width: min(340px, 36vw); height: 42px; padding: 0 8px 0 14px;
  border: 1px solid var(--line-hi); border-radius: 999px; background: var(--card); color: var(--muted); cursor: pointer; font-weight: 700; font-size: 14.5px; transition: border-color 0.15s;
}
.js .top__search, .js .theme { display: flex; }
.top__search:hover, .theme:hover { border-color: var(--lav); }
.top__search svg { width: 17px; height: 17px; }
.top__search kbd { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.top__links { display: flex; gap: 2px; margin-left: auto; }
.js .top__links { margin-left: 0; }
.top__links a { display: flex; align-items: center; gap: 7px; color: var(--muted); font-weight: 800; font-size: 15px; padding: 8px 12px; border-radius: 999px; }
.top__links a:hover { color: var(--text); background: var(--card); text-decoration: none; }
.top__links svg { width: 17px; height: 17px; }
.theme .sun { display: none; }
:root[data-theme="light"] .theme .sun { display: block; }
:root[data-theme="light"] .theme .moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme .sun { display: block; }
  :root:not([data-theme="dark"]) .theme .moon { display: none; }
}

/* ── Layout ── */
.layout { display: grid; grid-template-columns: 276px minmax(0, 1fr) 236px; max-width: 1480px; margin: 0 auto; }
.layout--home { grid-template-columns: 276px minmax(0, 1fr); }
.nav { position: sticky; top: var(--top); height: calc(100vh - var(--top)); overflow-y: auto; padding: 18px 14px 40px 18px; border-right: 1px solid var(--line); scrollbar-width: thin; }
.nav__head { display: none; }
.nav:focus, .main:focus { outline: none; }
.nav__section { margin-top: 18px; }
.nav__title { display: flex; align-items: center; gap: 9px; margin: 0; padding: 0 12px 6px; font-size: 12px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.nav__title svg { width: 17px; height: 17px; color: var(--c); }
.nav__link { position: relative; display: flex; align-items: center; min-height: 36px; padding: 6px 12px 6px 38px; border-radius: 12px; color: var(--body); font-weight: 700; font-size: 15px; line-height: 1.35; transition: background 0.15s, color 0.15s; }
.nav__link:hover { background: var(--card); color: var(--text); text-decoration: none; }
.nav__link.is-current { background: color-mix(in srgb, var(--c, var(--mint)) 15%, transparent); color: var(--text); }
.nav__link.is-current::before { content: ""; position: absolute; left: 18px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--c, var(--mint)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c, var(--mint)) 25%, transparent); }
.nav__home { padding-left: 12px; font-weight: 800; }
.nav__home.is-current::before { display: none; }
.scrim { display: none; }

.main { min-width: 0; padding: 28px clamp(20px, 4vw, 60px) 64px; }
.main > * { max-width: 44rem; }

/* Breadcrumbs */
.crumbs ol { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 14px; padding: 0; list-style: none; font-size: 14px; font-weight: 700; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: 4px; opacity: 0.6; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.crumbs [aria-current] { color: var(--text); }

/* The hero band at the top of each page, tinted by its section. */
.band {
  position: relative; overflow: hidden; margin-bottom: 34px; padding: 30px 34px 32px; border-radius: 28px;
  background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--c) 22%, transparent), transparent 60%), linear-gradient(160deg, color-mix(in srgb, var(--c) 9%, var(--card)), var(--card));
  border: 1px solid color-mix(in srgb, var(--c) 28%, var(--line));
  box-shadow: var(--shadow);
}
.band__art { position: absolute; right: -14px; top: -16px; width: 132px; height: 132px; color: var(--c); opacity: 0.14; stroke-width: 1.4; transform: rotate(-10deg); }
.band__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 14px; font-size: 14px; font-weight: 700; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px 3px 8px; border-radius: 999px; color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); font-weight: 900; }
.chip svg { width: 15px; height: 15px; }
.band h1 { position: relative; margin: 0 0 12px; font-size: clamp(32px, 4.2vw, 46px); line-height: 1.08; letter-spacing: -0.03em; color: var(--text); font-weight: 900; }
.band__lede { position: relative; margin: 0; font-size: 18.5px; line-height: 1.6; color: var(--muted); }
.band__lede strong { color: var(--text); }

/* ── Article ── */
.doc h2 { font-size: 27px; letter-spacing: -0.02em; color: var(--text); font-weight: 900; line-height: 1.2; margin: 52px 0 14px; padding-top: 26px; border-top: 1px solid var(--line); position: relative; }
.doc > h2:first-child { margin-top: 0; padding-top: 0; border: 0; }
.doc h3 { font-size: 20px; color: var(--text); font-weight: 800; line-height: 1.3; margin: 34px 0 8px; position: relative; }
.doc h4 { font-size: 17px; color: var(--text); margin: 26px 0 6px; }
.anchor { position: absolute; left: -0.95em; color: var(--lav); opacity: 0; font-weight: 700; transition: opacity 0.15s; }
.doc h2 .anchor { top: 26px; }
.doc > h2:first-child .anchor { top: 0; }
.doc :is(h2, h3):hover .anchor, .anchor:focus { opacity: 0.8; text-decoration: none; }
.doc p, .doc ul, .doc ol { margin: 0 0 18px; }
.doc ul, .doc ol { padding-left: 24px; }
.doc li { margin: 6px 0; }
.doc li::marker { color: var(--lav); }
.doc ol li::marker { font-weight: 900; }
.doc strong { color: var(--text); font-weight: 800; }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }
.doc li.task { list-style: none; margin-left: -22px; }
.doc :not(pre) > code { font: 600 0.84em/1 var(--mono); color: var(--text); background: var(--card-hi); border: 1px solid var(--line); padding: 0.2em 0.42em; border-radius: 7px; overflow-wrap: anywhere; }
.doc a code { color: inherit; }
.doc pre { position: relative; margin: 0 0 22px; padding: 18px 20px; background: #15131f; border: 1px solid var(--line-hi); border-radius: 18px; overflow-x: auto; font: 500 13.8px/1.65 var(--mono); color: #e7e3f7; tab-size: 2; }
.doc pre[data-lang]::before { content: attr(data-lang); position: absolute; top: 12px; right: 84px; font: 800 11px/1 Nunito, sans-serif; text-transform: uppercase; letter-spacing: 0.1em; color: #77718f; }
.copy { position: absolute; top: 8px; right: 8px; padding: 5px 12px; border-radius: 999px; border: 1px solid rgb(246 243 255 / 0.15); background: #2a2740; color: #c9c4e0; font-size: 12.5px; font-weight: 800; cursor: pointer; opacity: 0; transition: opacity 0.15s; }
.doc pre:hover .copy, .copy:focus-visible, .copy.is-done { opacity: 1; }
@media (hover: none) { .copy { opacity: 1; } }
.copy.is-done { color: #8eecc8; border-color: rgb(142 236 200 / 0.5); }
.doc blockquote { margin: 0 0 22px; padding: 12px 20px; border-left: 4px solid var(--lav); background: var(--card); border-radius: 0 16px 16px 0; color: var(--muted); }
.doc blockquote p:last-child { margin: 0; }

/* Tables: zebra rows; a long one scrolls in its own box with the header kept in view. */
.table { overflow: auto; margin: 0 0 24px; border: 1px solid var(--line-hi); border-radius: 18px; background: var(--card); }
.table--tall { max-height: min(72vh, 660px); }
.doc table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 15.5px; line-height: 1.55; }
.doc th, .doc td { text-align: left; padding: 11px 16px; vertical-align: top; }
.doc td { border-top: 1px solid var(--line); }
.doc tbody tr:nth-child(even) { background: color-mix(in srgb, var(--text) 3.5%, transparent); }
.doc tbody tr:hover { background: color-mix(in srgb, var(--lav) 8%, transparent); }
.doc th { position: sticky; top: 0; z-index: 1; font-size: 12px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); font-weight: 900; background: var(--card-hi); white-space: nowrap; }
.doc td:first-child { color: var(--text); font-weight: 700; min-width: 7.5em; }

/* Callouts: > [!NOTE] or > **Tip:** */
.callout { --c: var(--sky); margin: 0 0 24px; padding: 14px 20px 2px; border-radius: 18px; background: color-mix(in srgb, var(--c) 10%, var(--card)); border: 1px solid color-mix(in srgb, var(--c) 32%, transparent); }
.callout__title { display: flex; align-items: center; gap: 8px; margin: 0 0 6px !important; font-weight: 900; color: var(--c); font-size: 14.5px; letter-spacing: 0.03em; }
.callout__title svg { width: 19px; height: 19px; stroke-width: 2.2; }
.callout p { margin-bottom: 12px; }
.callout--tip { --c: var(--mint); }
.callout--important { --c: var(--lav); }
.callout--warning { --c: var(--butter); }
.callout--caution { --c: var(--peach); }

/* Screenshots in a handheld's bezel. A top and a bottom screen side by side come out the same height. */
.shots { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: center; gap: 18px; margin: 6px 0 30px; }
.shot { margin: 0; min-width: 0; }
.shot--top { flex: 1.78 1 0; }
.shot--bottom { flex: 1.15 1 0; }
.shots--1 .shot--bottom { max-width: 420px; }
.shot__bezel { padding: clamp(6px, 1.4%, 11px); border-radius: clamp(14px, 3%, 22px); background: linear-gradient(160deg, #3a3650, #1c1a27 60%); box-shadow: var(--shadow), inset 0 1px 0 rgb(255 255 255 / 0.12); }
.shot__glass { position: relative; overflow: hidden; border-radius: 8px; background: #000; box-shadow: 0 0 0 3px #09080e; }
.shot__glass img { display: block; width: 100%; }
.shot__glass::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(125deg, rgb(255 255 255 / 0.08), transparent 35%); }
.shot figcaption, .figure figcaption { margin-top: 10px; font-size: 14px; color: var(--muted); text-align: center; line-height: 1.45; }
.figure { margin: 0 0 24px; }
.figure img { border-radius: 16px; border: 1px solid var(--line-hi); }

/* After the article */
.meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; margin: 44px 0 0; padding-top: 18px; border-top: 1px solid var(--line); font-size: 14.5px; font-weight: 700; color: var(--muted); }
.meta a { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); }
.meta a:hover { color: var(--text); }
.meta svg { width: 16px; height: 16px; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 22px; }
.pager__link { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 18px 20px; border-radius: 20px; border: 1px solid var(--line-hi); background: var(--card); transition: border-color 0.15s, transform 0.2s cubic-bezier(.34, 1.56, .64, 1), box-shadow 0.2s; }
.pager__link:hover { text-decoration: none; border-color: var(--c); transform: translateY(-3px); box-shadow: 0 18px 40px -24px var(--c); }
.pager__kicker { font-size: 12.5px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.09em; color: var(--c); }
.pager__title { font-size: 17.5px; font-weight: 800; color: var(--text); line-height: 1.35; }
.pager .arrow { position: absolute; top: 50%; width: 20px; height: 20px; margin-top: -10px; color: var(--muted); transition: transform 0.2s; }
.pager__link--prev { padding-left: 52px; }
.pager__link--prev .arrow { left: 18px; transform: scaleX(-1); }
.pager__link--prev:hover .arrow { transform: scaleX(-1) translateX(4px); }
.pager__link--next { grid-column: 2; text-align: right; padding-right: 52px; }
.pager__link--next .arrow { right: 18px; }
.pager__link--next:hover .arrow { transform: translateX(4px); }
.foot { display: flex; gap: 12px; align-items: center; margin-top: 48px; padding-top: 22px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
.foot img { flex: none; }
.foot p { margin: 0; }
.foot a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

/* On this page */
.toc { position: sticky; top: var(--top); align-self: start; max-height: calc(100vh - var(--top)); overflow-y: auto; padding: 32px 18px 30px 4px; scrollbar-width: thin; }
.toc__title { margin: 0 0 10px; padding-left: 14px; font-size: 12px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.toc__link { display: block; padding: 4px 0 4px 14px; border-left: 2px solid var(--line-hi); color: var(--muted); font-size: 14px; font-weight: 700; line-height: 1.4; transition: color 0.15s, border-color 0.15s; }
.toc__link--3 { padding-left: 26px; font-size: 13.5px; font-weight: 600; }
.toc__link:hover { color: var(--text); text-decoration: none; }
.toc__link.is-active { color: var(--mint); border-left-color: var(--mint); }
.toc__top { display: inline-block; margin: 14px 0 0 14px; font-size: 13px; font-weight: 800; color: var(--muted); }
.toc-inline { display: none; margin-bottom: 24px; border: 1px solid var(--line-hi); border-radius: 16px; background: var(--card); padding: 0 16px; }
.toc-inline summary { cursor: pointer; padding: 12px 0; font-weight: 800; color: var(--text); }
.toc-inline .toc__link { border-left: 0; padding: 7px 0; }
.toc-inline .toc__link--3 { padding-left: 14px; }
.toc-inline[open] { padding-bottom: 10px; }

/* ── Search palette ── */
.palette { position: fixed; inset: 0; z-index: 50; background: rgb(11 10 18 / 0.6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.palette[hidden] { display: none; }
.palette__box { width: min(640px, 100%); max-height: 70vh; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line-hi); border-radius: 22px; box-shadow: 0 40px 100px -20px rgb(0 0 0 / 0.6); overflow: hidden; animation: pop 0.22s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes pop { from { transform: scale(0.94); opacity: 0; } }
.palette__field { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.palette__field svg { width: 19px; height: 19px; color: var(--mint); }
.palette__field input { flex: 1; min-width: 0; height: 58px; border: 0; outline: 0; background: transparent; color: var(--text); font: 700 17px Nunito, sans-serif; }
.palette__field input::-webkit-search-cancel-button { display: none; }
.palette__results { overflow-y: auto; padding: 8px; }
.palette__group { padding: 10px 10px 4px; font-size: 12px; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; color: var(--lav); }
.palette__empty { padding: 22px 12px; color: var(--muted); text-align: center; }
.hit { display: block; padding: 10px 12px; border-radius: 14px; color: var(--body); }
.hit:hover { text-decoration: none; }
.hit.is-active { background: var(--card-hi); }
.hit__title { display: block; font-weight: 800; color: var(--text); }
.hit__text { font-size: 13.5px; color: var(--muted); line-height: 1.5; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.hit mark { background: color-mix(in srgb, var(--mint) 22%, transparent); color: var(--mint); border-radius: 4px; padding: 0 2px; }
.palette__foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); font-weight: 700; }
.palette__foot kbd { margin-right: 3px; }

/* ── Overview page ── */
.layout--home .main > * { max-width: 1040px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 40px; align-items: center; padding: 18px 0 30px; }
.hero__kicker { font-size: 13px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; color: var(--mint); margin: 0 0 10px; }
.hero h1 { font-size: clamp(36px, 4.6vw, 56px); line-height: 1.04; letter-spacing: -0.035em; color: var(--text); font-weight: 900; margin: 0 0 16px; }
.grad { background: linear-gradient(90deg, var(--mint), var(--sky) 45%, var(--lav) 75%, var(--peach)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero__lede { font-size: 18.5px; color: var(--muted); margin: 0 0 26px; max-width: 46ch; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-flex; align-items: center; gap: 9px; height: 48px; padding: 0 22px; border-radius: 999px; font-weight: 800; font-size: 16px; color: var(--text); background: var(--card); border: 1px solid var(--line-hi); cursor: pointer; transition: transform 0.2s cubic-bezier(.34, 1.56, .64, 1), border-color 0.15s; }
.btn:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--lav); }
.btn svg { width: 18px; height: 18px; stroke-width: 2.3; }
.btn--primary { background: var(--mint); color: var(--on-accent); border-color: transparent; box-shadow: 0 10px 30px -12px var(--mint); }
:root:not(.js) .hero .btn:not(.btn--primary) { display: none; }
.hero__pip { position: relative; display: grid; gap: 10px; padding: 70px 0 0; }
.hero__mascot { position: absolute; top: 0; left: 6px; width: 74px; animation: bob 1.4s cubic-bezier(.4, 0, .2, 1) infinite alternate; }
@keyframes bob { to { transform: translateY(-6px); } }
.ask { display: block; padding: 12px 16px; border-radius: 20px 20px 20px 6px; background: var(--card); border: 1px solid var(--line-hi); color: var(--body); transition: transform 0.2s cubic-bezier(.34, 1.56, .64, 1), border-color 0.15s; animation: rise 0.5s calc(var(--i) * 90ms) both cubic-bezier(.2, .8, .2, 1); }
.ask:nth-child(odd) { margin-left: 26px; }
.ask:hover { text-decoration: none; transform: translateX(4px); border-color: var(--mint); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.ask__q { display: block; font-weight: 800; color: var(--text); }
.ask__a { display: block; font-size: 14.5px; color: var(--mint); font-weight: 700; }
.home__section { margin-top: 34px; scroll-margin-top: calc(var(--top) + 16px); }
.home__head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.home__head h2 { margin: 0; padding: 0; border: 0; font-size: 22px; color: var(--text); font-weight: 900; letter-spacing: -0.02em; }
.home__icon { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); }
.home__icon svg { width: 20px; height: 20px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); color: var(--body); transition: transform 0.2s cubic-bezier(.34, 1.56, .64, 1), border-color 0.15s; }
.card:hover { text-decoration: none; transform: translateY(-3px); border-color: color-mix(in srgb, var(--c) 60%, transparent); }
.card__title { font-weight: 900; color: var(--text); font-size: 16.5px; }
.card__sub { font-size: 14px; color: var(--muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ── Narrower screens ── */
@media (max-width: 1220px) {
  .layout { grid-template-columns: 256px minmax(0, 1fr); }
  .layout > .toc { display: none; }
  .toc-inline { display: block; }
}
@media (max-width: 900px) {
  .layout, .layout--home { grid-template-columns: minmax(0, 1fr); }
  .top__menu { display: grid; }
  .js .top__search { width: 44px; padding: 0; justify-content: center; margin-left: auto; }
  .top__search span, .top__search kbd, .top__gh span { display: none; }
  /* The sidebar becomes a drawer. */
  .js .nav { position: fixed; z-index: 45; inset: 0 auto 0 0; height: auto; width: min(330px, 86vw); padding: 0 12px 40px; background: var(--night); border-right: 1px solid var(--line-hi); transform: translateX(-104%); visibility: hidden; transition: transform 0.28s cubic-bezier(.2, .8, .2, 1), visibility 0s 0.28s; box-shadow: 30px 0 80px -30px rgb(0 0 0 / 0.6); }
  .js .nav.is-open { transform: none; visibility: visible; transition: transform 0.28s cubic-bezier(.2, .8, .2, 1); }
  .js .nav__head { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 1; height: var(--top); margin: 0 -12px 4px; padding: 0 12px 0 22px; background: var(--night); border-bottom: 1px solid var(--line); font-weight: 900; color: var(--text); }
  .js .nav__close { display: grid; }
  .nav__link { min-height: 46px; font-size: 16px; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgb(11 10 18 / 0.55); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
  .scrim[hidden] { display: none; }
  /* Without scripts, the menu button jumps to the contents, listed after the page. */
  :root:not(.js) .nav { position: static; height: auto; order: 3; border: 0; border-top: 1px solid var(--line); padding: 20px 16px 40px; }
  .main { padding-top: 22px; }
  .hero { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  body { font-size: 16.5px; }
  .top { padding: 0 12px 0 10px; gap: 6px; }
  .top__brand { font-size: 19px; margin-right: 0; }
  .top__links a { padding: 8px; }
  .top__links a:first-child { display: none; }
  .main { padding: 18px 16px 48px; }
  .band { margin: 0 0 26px; padding: 22px 20px 24px; border-radius: 22px; }
  .band__art { width: 96px; height: 96px; }
  .band__lede { font-size: 17px; }
  .doc h2 { font-size: 24px; margin-top: 42px; padding-top: 22px; }
  .doc h2 .anchor { top: 22px; }
  .doc pre { border-radius: 14px; margin-inline: -4px; }
  .table { margin-inline: -4px; }
  .doc th, .doc td { padding: 10px 12px; }
  .pager { grid-template-columns: 1fr; }
  .pager__link--next { grid-column: 1; }
  .ask:nth-child(odd) { margin-left: 0; }
  .shots { gap: 14px; }
  .shot { flex-basis: 100%; }
  .shot--bottom { max-width: 320px; }
  .table--tall { max-height: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── Print: the article alone, dark on white ── */
@media print {
  :root, :root[data-theme] { --text: #000; --body: #111; --muted: #444; --card: #fff; --card-hi: #f2f2f2; --line: #ccc; --line-hi: #bbb; --mint: #0a6b4b; --lav: #4b3aa8; --sky: #145a85; --butter: #6b4b00; --peach: #8f3a27; --shadow: none; color-scheme: light; }
  body { background: #fff; font-size: 11.5pt; }
  .top, .nav, .toc, .toc-inline, .crumbs, .pager, .copy, .scrim, .palette, .skip, .anchor, .band__art, .meta a, .foot img { display: none !important; }
  .layout { display: block; }
  .main { padding: 0; }
  .main > * { max-width: none; }
  .band { box-shadow: none; padding: 0 0 12px; border: 0; border-bottom: 2px solid #000; border-radius: 0; background: none; }
  .doc pre { white-space: pre-wrap; background: #f6f6f6; color: #000; border-color: #ccc; }
  .table, .table--tall { max-height: none; overflow: visible; }
  .doc :is(h2, h3) { break-after: avoid; }
  .doc :is(pre, .table, .callout, .shots, tr) { break-inside: avoid; }
  .doc a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; color: #555; overflow-wrap: anywhere; }
}
