/* moonregex site — one stylesheet for the homepage, the guide, the showcase
   and the generated API reference. Two themes, one set of tokens. */

:root {
  --nav-h: 64px;
  --wrap: 1140px;
  --radius: 14px;

  --bg: #080a13;
  --bg-2: #0b0e1c;
  --surface: #10132a;
  --surface-2: #151936;
  --line: rgba(255, 255, 255, 0.09);
  --line-soft: rgba(255, 255, 255, 0.05);
  --text: #ecebf7;
  --muted: #a3a1bd;
  --faint: #82809f;
  --accent: #8ea2ff;
  --accent-soft: rgba(142, 162, 255, 0.14);
  --accent-2: #5be0c6;
  --mark: #ffc857;
  --mark-soft: rgba(255, 200, 87, 0.16);

  --code-bg: #0a0c17;
  --code-line: rgba(255, 255, 255, 0.08);
  --code-text: #d9d8f0;
  --c-kw: #8ea2ff;
  --c-str: #5be0c6;
  --c-com: #85839f;
  --c-num: #ffc857;

  /* Scrollbars are painted from `--sb-*`; `--sb-*-base` is what the theme
     actually wants. The split exists so the page's own bar can be emptied at
     scroll 0 without emptying every content scroller with it — see the reveal
     rule further down. */
  --sb-track-base: #05070f;
  --sb-thumb-base: #555fa0;
  --sb-thumb-hover-base: #6a75b9;
  --sb-track: var(--sb-track-base);
  --sb-thumb: var(--sb-thumb-base);
  --sb-thumb-hover: var(--sb-thumb-hover-base);

  /* A card's shadow is a token: on a dark page it has to be a wide, low
     black blur, on a light one a tight, faint blue one — the same rule would
     either vanish or spill over whatever sits under the card. */
  --shadow-card: 0 26px 60px -38px rgba(0, 0, 0, 0.85);
  --shadow-raise: 0 18px 40px -26px rgba(0, 0, 0, 0.75);
  --shadow-nav: 0 10px 30px -22px rgba(0, 0, 0, 0.9);

  --glow-a: rgba(142, 162, 255, 0.18);
  --glow-b: rgba(91, 224, 198, 0.08);
  --grid: rgba(255, 255, 255, 0.035);

  --display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", "Cascadia Code", Consolas, monospace;
}

[data-theme="light"] {
  --bg: #f6f6fb;
  --bg-2: #eceefa;
  --surface: #ffffff;
  --surface-2: #f3f4fc;
  --line: rgba(18, 20, 42, 0.11);
  --line-soft: rgba(18, 20, 42, 0.06);
  --text: #12142a;
  --muted: #545771;
  --faint: #6b6e8a;
  --accent: #3f51cf;
  --accent-soft: rgba(63, 81, 207, 0.1);
  --accent-2: #07725f;
  --mark: #9a5b00;
  --mark-soft: rgba(255, 200, 87, 0.28);

  /* Code panels follow the page in day mode: a black slab inside a white
     card reads as a foreign object, and its palette was never meant to sit
     on paper. */
  --code-bg: #f7f8fd;
  --code-line: rgba(18, 20, 42, 0.1);
  --code-text: #1c1f36;
  --c-kw: #3f45c8;
  --c-str: #0a7d68;
  --c-com: #6b6e8a;
  --c-num: #8f5300;

  --shadow-card: 0 12px 28px -20px rgba(21, 26, 62, 0.22), 0 2px 6px -4px rgba(21, 26, 62, 0.08);
  --shadow-raise: 0 14px 30px -22px rgba(21, 26, 62, 0.28);
  --shadow-nav: 0 8px 22px -18px rgba(21, 26, 62, 0.35);

  --sb-track-base: #e2e5f4;
  --sb-thumb-base: #7881ad;
  --sb-thumb-hover-base: #5f6899;

  --glow-a: rgba(63, 81, 207, 0.12);
  --glow-b: rgba(10, 143, 122, 0.08);
  --grid: rgba(18, 20, 42, 0.045);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* Reserve the strip whether or not the page scrolls, so a page that grows
     (the playground's results, say) never shifts sideways when the bar
     appears. */
  scrollbar-gutter: stable;
}

/* Firefox has no `::-webkit-scrollbar`, so it gets the two standard
   properties. Chrome honours them *as well as* the pseudo-elements and ends up
   painting a second, thinner bar inside the same gutter — two stubs at the top
   and bottom of the page that make the scrollbar look broken. One path or the
   other, never both. `body` is named because the page's `overflow-x` hands the
   viewport scroll to the body box, and the bar is then resolved there. */
@supports not selector(::-webkit-scrollbar) {
  html, body {
    scrollbar-width: thin;
    scrollbar-color: var(--sb-thumb) var(--sb-track);
  }
  pre, .term pre, .sig {
    scrollbar-width: thin;
    scrollbar-color: var(--sb-thumb) transparent;
  }
}

/* Our scrollbar, not the system's. Every scroller in the site gets it. */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--sb-track); }
::-webkit-scrollbar-thumb {
  background: var(--sb-thumb);
  /* The border is the track's colour, so the thumb reads as a rounded bar set
     into the channel. (A transparent border with `background-clip` looks
     tidier in theory but Chrome paints two stubs at the ends of the bar and
     leaves the thumb floating 13px below the top — which is exactly what makes
     a scrollbar look missing at the top of a page.) */
  border: 2px solid var(--sb-track);
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover { background: var(--sb-thumb-hover); }
::-webkit-scrollbar-corner { background: var(--sb-track); }
/* No arrow buttons: Chrome draws them on Windows, and a 3px stub above the
   thumb reads as a second, broken scrollbar. */
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }

/* At the very top of a page the page's own bar empties out, so the opening
   frame is one unbroken surface; it fills back in on the first pixel of scroll
   (`html.is-scrolled`, set by site.js) and empties again at 0. Only paint
   changes — the bar keeps its 12px, so nothing moves.

   The emptying is done through the tokens, not by qualifying the
   `::-webkit-scrollbar-*` selectors with `html:not(.is-scrolled)`: Chrome
   resolves those per scroller and drops the entire bar as soon as a scoped
   rule meets the unscoped width rule, which leaves the page with no visible
   scrollbar at all once you scroll. */
html:not(.is-scrolled) {
  --sb-track: transparent;
  --sb-thumb: transparent;
  --sb-thumb-hover: transparent;
}

/* Content scrollers keep their bar at every scroll position: they are content,
   not the page. Each sheet that owns scrollers opts them back in. */
pre, .sig {
  --sb-track: var(--sb-track-base);
  --sb-thumb: var(--sb-thumb-base);
  --sb-thumb-hover: var(--sb-thumb-hover-base);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 16.5px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  font-variant-ligatures: no-contextual;
  /* `clip` does not make the body a scroll container the way `hidden` does
     (the older value stays as the fallback). */
  overflow-x: hidden;
  overflow-x: clip;
}

a { color: var(--accent); text-decoration: none; }
/* The outline follows the element's own radius; do not override it here. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection {
  background: color-mix(in srgb, var(--accent) 32%, transparent);
  color: var(--text);
}
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 0.88em; }
img, svg { max-width: 100%; }

.wrap { width: min(var(--wrap), calc(100% - 48px)); margin: 0 auto; }

/* ---------- the sky ---------- */
.sky {
  position: fixed; inset: 0; z-index: -3;
  background:
    radial-gradient(1100px 680px at 82% -6%, var(--glow-a), transparent 62%),
    radial-gradient(900px 560px at 4% 12%, var(--glow-b), transparent 58%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}
[data-theme="light"] .sky {
  background:
    radial-gradient(1100px 680px at 82% -6%, var(--glow-a), transparent 62%),
    radial-gradient(900px 560px at 4% 10%, var(--glow-b), transparent 58%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}
.stars {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image:
    radial-gradient(1.4px 1.4px at 12% 22%, rgba(255,255,255,0.85), transparent),
    radial-gradient(1px 1px at 27% 68%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1.2px 1.2px at 44% 14%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 66% 82%, rgba(255,255,255,0.45), transparent),
    radial-gradient(1.6px 1.6px at 74% 34%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 88% 60%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 55% 46%, rgba(255,255,255,0.35), transparent);
  animation: twinkle 9s ease-in-out infinite alternate;
}
[data-theme="light"] .stars { opacity: 0.35; }
@keyframes twinkle { from { opacity: 0.5 } to { opacity: 0.95 } }

.grid-lines {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(900px 600px at 50% 0%, #000 20%, transparent 85%);
}

.moon {
  /* Part of the hero, not of the viewport: it scrolls away with the page. */
  position: absolute;
  top: 11vh; right: max(5vw, 36px);
  width: clamp(140px, 15vw, 230px); aspect-ratio: 1;
  border-radius: 50%;
  z-index: -1;
  background: radial-gradient(circle at 34% 30%, #fffef6 0%, #e7e9ff 34%, #b9c0ef 62%, #7f89c9 100%);
  box-shadow:
    0 0 80px 24px rgba(160, 175, 255, 0.28),
    inset -18px -22px 46px rgba(60, 70, 140, 0.35);
  opacity: 0.9;
}
/* By day the page is paper, and a pale disc on paper reads as a table-tennis
   ball rather than a moon: the sky keeps its moon only at night. */
[data-theme="light"] .moon { display: none; }
@media (width <= 900px) { .moon { display: none; } }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 40;
  /* the mobile panel hangs off this box */
  height: var(--nav-h);
  display: flex; align-items: center;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line-soft);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--display); font-weight: 600; font-size: 19px;
  color: var(--text); letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
.brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 12px var(--accent);
}
.brand .acc { color: var(--accent); }
.nav-tools { display: flex; align-items: center; gap: 2px; }
.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-links a {
  color: var(--muted); font: inherit; font-size: 14.5px;
  padding: 7px 12px; border-radius: 9px; border: 1px solid transparent;
  background: none; cursor: pointer;
}
.nav-links a:hover {
  color: var(--text); background: var(--accent-soft); text-decoration: none;
}
.nav-links .on {
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.nav-tools .cta {
  color: var(--text); font-size: 14.5px; padding: 7px 12px;
  border-radius: 9px; border: 1px solid var(--line);
  display: inline-flex; align-items: center; gap: 7px;
}
.nav-tools .cta:hover { background: var(--surface-2); text-decoration: none; }
.theme-toggle {
  width: 36px; height: 36px; padding: 0 !important;
  display: inline-grid; place-items: center; margin-left: 4px;
  border-radius: 10px; border: 1px solid var(--line) !important;
  background: var(--surface) !important;
  /* A button carries the UA's `buttontext`, not the page's colour, which left
     the moon nearly invisible on the night surface. */
  color: #fff !important;
}
[data-theme="light"] .theme-toggle { color: var(--text) !important; }
.theme-toggle:hover {
  color: var(--accent) !important; border-color: var(--accent) !important;
}
.theme-toggle svg { width: 17px; height: 17px; }
.nav-burger {
  display: none; width: 36px; height: 36px; padding: 0; margin-left: 4px;
  place-items: center; cursor: pointer; color: var(--text);
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
}
.nav-burger svg { width: 19px; height: 19px; }
.nav-burger .bar-close { display: none; }
.nav-burger:hover { color: var(--accent); border-color: var(--accent); }
.nav-burger[aria-expanded="true"] { color: var(--text); border-color: var(--accent); }
.nav-burger[aria-expanded="true"] .bar-open { display: none; }
.nav-burger[aria-expanded="true"] .bar-close { display: block; }
.theme-toggle .sun { display: none; }
[data-theme="light"] .theme-toggle .sun { display: block; }
[data-theme="light"] .theme-toggle .moon-icon { display: none; }

/* ---------- hero ---------- */
.hero {
  min-height: min(calc(100svh - var(--nav-h)), 860px);
  display: grid; align-items: center;
  padding: 40px 0 56px;
  position: relative;
}
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  gap: 56px; align-items: center;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.04em;
  color: var(--muted); text-transform: lowercase;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 13px; background: var(--surface);
}
.eyebrow .pulse {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-2); box-shadow: 0 0 0 0 var(--accent-2);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(91,224,198,0.55) }
  70% { box-shadow: 0 0 0 9px rgba(91,224,198,0) }
  100% { box-shadow: 0 0 0 0 rgba(91,224,198,0) }
}
h1.title {
  font-family: var(--display);
  font-size: clamp(44px, 6.2vw, 82px);
  line-height: 1.02; letter-spacing: -0.035em;
  margin: 20px 0 0;
}
h1.title .reg {
  color: var(--mark);
  position: relative; white-space: nowrap;
}
h1.title .reg::after {
  content: ""; position: absolute; left: 2px; right: 2px; bottom: 0.06em;
  height: 9px; border-radius: 3px; background: var(--mark-soft);
  z-index: -1;
}
.lede {
  margin: 22px 0 0; max-width: 40ch;
  font-size: 18px; color: var(--muted);
}
.demo-side { display: grid; gap: 20px; align-content: start; }
.demo-cap {
  /* Clear of the card's shadow: a caption sitting in the falloff reads as
     dirty text even where the contrast still passes. */
  margin: 2px 0 0; font-size: 13.5px; line-height: 1.6;
  color: var(--muted); max-width: 52ch;
}
.demo-cap a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.hero-actions { display: flex; gap: 12px; margin-top: 30px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 20px; border-radius: 11px;
  font-size: 15px; font-weight: 500;
  border: 1px solid var(--line);
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--accent); color: #0a0c18; border-color: transparent;
  box-shadow: 0 10px 30px -12px var(--accent);
}
.btn-primary:hover { filter: brightness(1.06); }
[data-theme="light"] .btn-primary { color: #fff; }
.btn-ghost { color: var(--text); background: var(--surface); }
.btn-ghost:hover { background: var(--surface-2); }

.hero-meta {
  margin: 18px 0 0; font-family: var(--mono); font-size: 12px;
  color: var(--faint); letter-spacing: 0.02em;
}
.scroll-hint {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: grid; justify-items: center; gap: 6px;
  color: var(--faint); font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.16em; text-transform: uppercase;
}
.scroll-hint i {
  width: 1px; height: 34px;
  background: linear-gradient(var(--faint), transparent);
  animation: drop 2.2s ease-in-out infinite;
}
@keyframes drop { 0%,100% { opacity: .25 } 50% { opacity: .9 } }

/* ---------- the live matcher ---------- */
.demo {
  border: 1px solid var(--line); border-radius: 16px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.demo-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
}
.demo-bar .phase { display: inline-flex; gap: 6px; }
.demo-bar .phase i {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--line); display: block;
}
.demo-bar .phase i.on { background: var(--accent); opacity: .8; }
.demo-bar .lbl {
  margin-left: auto; font-family: var(--mono);
  font-size: 11.5px; color: var(--faint);
}
.demo-body {
  padding: 16px; display: grid; gap: 13px;
  /* A grid track takes its minimum from the content; the pattern row's
     minimum is the input's default size, which is wider than a phone. */
  grid-template-columns: minmax(0, 1fr);
}
.demo-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.demo-row label {
  font-family: var(--mono); font-size: 11.5px; color: var(--faint);
  text-transform: uppercase; letter-spacing: 0.1em; min-width: 58px;
}
.pat {
  flex: 1; min-width: 0;
  font-family: var(--mono); font-size: 14px;
  color: var(--accent-2);
  background: var(--code-bg); border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 12px;
  outline: none;
}
.pat:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.flags { display: inline-flex; gap: 4px; }
.flags button {
  width: 27px; height: 27px; border-radius: 7px; cursor: pointer;
  font-family: var(--mono); font-size: 12.5px;
  color: var(--muted); background: var(--surface); border: 1px solid var(--line);
}
.flags button.active {
  color: #0a0c18; background: var(--accent); border-color: transparent;
}
[data-theme="light"] .flags button.active { color: #fff; }
.demo-text {
  font-family: var(--mono); font-size: 14px; line-height: 1.9;
  color: var(--code-text); min-height: 96px;
  padding: 12px 14px; border-radius: 10px;
  background: var(--code-bg); border: 1px solid var(--line);
  word-break: break-word;
}
.demo-text mark {
  background: var(--mark-soft); color: var(--mark);
  border-radius: 4px; padding: 1px 2px;
  box-shadow: inset 0 -1px 0 var(--mark);
}
.demo-stat {
  font-family: var(--mono); font-size: 12px; color: var(--faint);
  display: flex; gap: 8px; align-items: center;
}
.demo-stat b { color: var(--accent-2); }

/* ---------- sections ---------- */
.section { padding: 84px 0; border-top: 1px solid var(--line-soft); }
.sec-head { max-width: 640px; margin-bottom: 40px; }
.sec-kicker {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--faint);
}
h2.sec-title {
  font-family: var(--display); font-size: clamp(27px, 3.4vw, 38px);
  letter-spacing: -0.02em; margin: 10px 0 0;
}
.sec-sub { color: var(--muted); margin: 12px 0 0; font-size: 16.5px; }

.features {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px; background: var(--line-soft);
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  overflow: hidden;
}
.feat {
  background: var(--bg); padding: 24px 22px;
  display: flex; gap: 14px; align-items: flex-start;
  transition: background 0.2s ease;
}
.feat:hover { background: var(--surface); }
.feat .num {
  font-family: var(--mono); font-size: 12px; color: var(--accent);
  border: 1px solid var(--line); border-radius: 7px;
  padding: 3px 7px; line-height: 1.3;
}
.feat h3 { font-family: var(--display); font-size: 17.5px; margin: 0 0 6px; }
.feat p { margin: 0; color: var(--muted); font-size: 14.8px; }
.feat .tag {
  display: inline-block; margin-top: 10px;
  font-family: var(--mono); font-size: 11.5px; color: var(--faint);
}

/* ---------- cards / showcase ---------- */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 22px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface);
  transition: transform .18s ease, border-color .18s ease;
}
.card:hover {
  transform: translateY(-3px); border-color: var(--accent);
  box-shadow: var(--shadow-raise); text-decoration: none;
}
.card .k {
  font-family: var(--mono); font-size: 11.5px; color: var(--accent);
  letter-spacing: 0.08em; text-transform: uppercase;
}
.card h3 { font-family: var(--display); font-size: 18px; margin: 0; color: var(--text); }
.card p { margin: 0; color: var(--muted); font-size: 14.5px; }
.card .go { margin-top: auto; font-size: 14px; color: var(--accent); }

/* ---------- terminal / code ---------- */
.term {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--code-bg); overflow: hidden;
}
.term-bar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 14px; border-bottom: 1px solid var(--code-line);
  background: color-mix(in srgb, var(--code-text) 4%, transparent);
  flex-wrap: wrap;
}
.term-bar .dots { display: inline-flex; gap: 6px; }
.term-bar .dots i {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--c-com); opacity: 0.45; display: block;
}
.tabs { display: inline-flex; gap: 2px; flex-wrap: wrap; }
.tabs button {
  font-family: var(--mono); font-size: 12.5px;
  color: var(--c-com); background: none; border: 0; cursor: pointer;
  padding: 5px 10px; border-radius: 7px;
}
.tabs button:hover {
  color: var(--code-text);
  background: color-mix(in srgb, var(--code-text) 7%, transparent);
}
.tabs button.active { color: #0a0c18; background: var(--accent); }
[data-theme="light"] .tabs button.active { color: #fff; }
.term pre {
  margin: 0; padding: 20px 22px; overflow-x: auto;
  font-family: var(--mono); font-size: 13.6px; line-height: 1.75;
  color: var(--code-text);
}
.term pre code { background: none; padding: 0; }
.c-kw { color: var(--c-kw); }
.c-str { color: var(--c-str); }
.c-com { color: var(--c-com); }
.c-num { color: var(--c-num); }

pre {
  background: var(--code-bg); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px 18px; overflow-x: auto;
  font-family: var(--mono); font-size: 13.6px; line-height: 1.7;
  color: var(--code-text);
}
pre code { color: inherit; background: none; }

.install {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 18px; padding: 15px 18px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px;
}
.install code { font-family: var(--mono); font-size: 14.5px; color: var(--accent-2); }
.install .hint { color: var(--muted); font-size: 14px; }
button.copy {
  margin-left: auto; font-family: var(--mono); font-size: 11.5px;
  color: var(--muted); background: none; border: 1px solid var(--line);
  border-radius: 8px; padding: 5px 10px; cursor: pointer;
}
button.copy:hover { color: var(--text); border-color: var(--accent); }

/* ---------- docs layout (guide, showcase, api) ---------- */
.layout {
  display: grid; grid-template-columns: minmax(0, 216px) minmax(0, 1fr);
  gap: 56px; padding: 44px 0 88px; align-items: start;
}
.side { position: sticky; top: calc(var(--nav-h) + 22px); font-size: 14.5px; }
.side h4 {
  margin: 0 0 10px; font-family: var(--display); font-size: 11.5px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint);
}
.side ol, .side ul { list-style: none; margin: 0 0 22px; padding: 0; counter-reset: step; }
.side li { counter-increment: step; }
.side li a {
  display: block; color: var(--muted); padding: 5px 10px;
  border-radius: 0 8px 8px 0; border-left: 2px solid transparent;
  position: relative;
}
.side ol li a { padding-left: 30px; }
.side ol li a::before {
  content: counter(step); position: absolute; left: 9px;
  font-family: var(--mono); font-size: 11.5px; color: var(--faint);
}
.side li a:hover { color: var(--text); background: var(--accent-soft); text-decoration: none; }
.side li a.on {
  color: var(--text); background: var(--accent-soft);
  border-left-color: var(--accent);
}
main { min-width: 0; }

.docs-title {
  font-family: var(--display); font-size: clamp(32px, 4vw, 44px);
  line-height: 1.12; letter-spacing: -0.025em; margin: 0 0 12px;
}
.docs-title .reg { color: var(--mark); }
.docs-lede { font-size: 18px; color: var(--muted); margin: 0; max-width: 62ch; }

h2 {
  font-family: var(--display); font-size: 25px; letter-spacing: -0.015em;
  margin: 56px 0 10px; scroll-margin-top: calc(var(--nav-h) + 24px);
}
h2 .num {
  font-family: var(--mono); font-size: 14px; color: var(--faint);
  margin-right: 10px;
}
h3 { font-family: var(--display); font-size: 18px; margin: 28px 0 6px; }
p { margin: 12px 0; color: var(--text); }
ul, ol { color: var(--text); padding-left: 22px; }
li { margin: 6px 0; }

.out {
  border-left: 2px solid var(--accent-2); background: var(--accent-soft);
  padding: 4px 14px; border-radius: 0 8px 8px 0; margin: 12px 0 18px;
  color: var(--muted); font-size: 14.5px;
}
.out code { background: none; color: var(--accent-2); }
.note {
  border-left: 2px solid var(--mark); background: var(--mark-soft);
  padding: 4px 14px; border-radius: 0 8px 8px 0; margin: 16px 0;
  color: var(--text); font-size: 14.8px;
}
.note strong { color: var(--mark); }

table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 14.8px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th {
  color: var(--faint); font-weight: 500; font-size: 12px;
  letter-spacing: 0.08em; text-transform: uppercase;
}
td code { font-size: 0.9em; }

/* ---------- api reference ---------- */
.pkg { padding-top: 8px; }
.pkg h2 { margin-top: 40px; }
.pkg .blurb { color: var(--muted); margin: 4px 0 2px; }
.pkg .slug code { color: var(--faint); font-size: 13px; }
.pkg h3 {
  font-family: var(--display); font-size: 12px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--faint); margin: 30px 0 10px;
}
.type {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin: 12px 0; background: var(--surface);
}
.type h4 { margin: 0 0 4px; font-family: var(--display); font-size: 17px; }
.type h4 code { color: var(--accent-2); font-size: 16px; }
.members { list-style: none; margin: 10px 0 0; padding: 0; }
.members li { padding: 9px 0; border-top: 1px solid var(--line-soft); margin: 0; }
.sig {
  display: block; color: var(--text); font-family: var(--mono);
  font-size: 13.2px; overflow-x: auto; white-space: nowrap;
}
.desc { color: var(--muted); font-size: 14.5px; margin-top: 5px; }
.desc p { margin: 4px 0; color: inherit; }
.desc code { color: var(--accent-2); background: var(--accent-soft); padding: 0 4px; border-radius: 4px; }

/* ---------- footer ---------- */
footer {
  border-top: 1px solid var(--line-soft);
  padding: 34px 0 56px; color: var(--muted); font-size: 14px;
}
.foot-grid { display: flex; justify-content: space-between; gap: 26px; flex-wrap: wrap; align-items: flex-start; }
footer a { color: var(--muted); }
footer a:hover { color: var(--accent); }
footer .foot-note { color: var(--faint); font-size: 13px; margin-top: 8px; }
.foot-links { display: flex; gap: 22px; flex-wrap: wrap; }

/* ---------- motion ---------- */
/* Only hide what will be revealed: without JavaScript, or before the script
   runs, the content is simply there. */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}

/* ---------- responsive ---------- */
@media (width <= 1040px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 34px; }
  .lede { max-width: none; }
  .features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .hero { min-height: 0; padding-top: 24px; }
  .scroll-hint { display: none; }
}
@media (width <= 860px) {
  .wrap { width: calc(100% - 32px); }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 8px; padding-top: 24px; }
  /* The contents list becomes a strip of chips you can swipe, instead of a
     column of numbers floating over the page. */
  .side {
    position: static; margin-bottom: 10px; padding-bottom: 14px;
    border-bottom: 1px solid var(--line-soft);
  }
  .side h4 { display: none; }
  .side ol, .side ul {
    display: flex; gap: 6px; margin: 0; padding: 2px 0;
    overflow-x: auto;
  }

  @supports not selector(::-webkit-scrollbar) {
    .side ol, .side ul {
      scrollbar-width: none;
    }
  }
  .side ol::-webkit-scrollbar, .side ul::-webkit-scrollbar { display: none; }
  .side ul { margin-top: 8px; }
  .side li a {
    white-space: nowrap; padding: 6px 13px 6px 28px;
    border-radius: 999px; border: 1px solid var(--line);
  }
  .side ul li a { padding-left: 13px; }
  .side ol li a::before { left: 11px; }
  .side li a.on { border-color: var(--accent); }
  .features { grid-template-columns: minmax(0, 1fr); }
  section { padding: 60px 0; }
}

/* The links go behind a burger before they have to fight for room: four
   words, a toggle and a GitHub button do not fit beside the brand on a
   tablet or a phone, and squashing them is how a nav loses a button. */
@media (width <= 860px) {
  .nav-burger { display: inline-grid; }
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0;
    display: none; flex-direction: column; align-items: stretch; gap: 3px;
    padding: 10px 16px 16px;
    background: var(--surface);
    border-top: 1px solid var(--line-soft);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-nav);
  }
  .nav-links.open { display: flex; }
  /* the panel holds only the links; the toggle, GitHub and the burger stay
     on the bar, so nothing needs the menu just to be reachable */
  .nav-links a { padding: 11px 13px; font-size: 15px; }
  .nav-tools .cta { padding: 7px 11px; }
}

@media (width <= 430px) {
  /* Below this the label would push the burger off the bar again. */
  .nav-tools .cta .lbl { display: none; }
  .nav-tools .cta { padding: 7px 9px; }
  .nav-tools { gap: 4px; }
}

/* The page scroll bar shows while the page moves or under the pointer and
   hides a moment after; it keeps its place, so nothing shifts. */
@supports selector(::-webkit-scrollbar) {
  html:not(.scrolling)::-webkit-scrollbar-thumb { background: transparent; border-color: transparent; box-shadow: none; }
}
@supports not selector(::-webkit-scrollbar) {
  html:not(.scrolling) { scrollbar-color: transparent transparent; }
}
