/* moonmime docs — sunset origami / paper-cut design system.
   Main colour: #4E56C0 (indigo). Palette: violet / orchid / blush,
   azure / periwinkle / lilac / rose. */

:root {
  /* palette */
  --ink: #4E56C0;
  --violet: #9B5DE0;
  --orchid: #D78FEE;
  --blush: #FDCFFA;
  --azure: #6367FF;
  --periwinkle: #8494FF;
  --lilac: #C9BEFF;
  --rose: #FFDBFD;

  /* surfaces */
  --bg: #FBF7FF;
  --bg-2: #F4ECFB;
  --surface: #FFFFFF;
  --surface-2: #FCF9FF;
  --text: #2A2342;
  --text-soft: #5C547C;
  --text-faint: #8C84A8;
  --border: color-mix(in srgb, var(--ink) 16%, white);
  --border-soft: color-mix(in srgb, var(--ink) 9%, white);
  --accent: var(--ink);
  --accent-2: var(--violet);

  /* code */
  --code-bg: #211B3D;
  --code-text: #ECE6FF;
  --code-border: #34305c;

  /* one gradient carries text: header, footer, facts band, primary button.
     The pastels stay in washes, hairlines and washes only. */
  --grad-ink: linear-gradient(115deg, #383D94 0%, var(--ink) 38%, #6147C0 74%, #7A4FD0 100%);
  --on-ink: #FFFFFF;
  --on-ink-soft: #DCD8FF;

  /* where colour is allowed to carry text */
  --heading-accent: var(--ink);
  --grad-title: var(--grad-ink);
  --fold-flap: color-mix(in srgb, var(--violet) 26%, white);
  --fold-crease: color-mix(in srgb, var(--violet) 52%, white);
  --fold-line: color-mix(in srgb, var(--violet) 14%, white);

  /* shape */
  --radius: 18px;
  --radius-sm: 11px;
  --maxw: 1140px;
  --shadow: 0 18px 44px -22px color-mix(in srgb, var(--ink) 55%, transparent);
  --shadow-sm: 0 8px 22px -16px color-mix(in srgb, var(--ink) 50%, transparent);

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #15112A;
  --bg-2: #1C1738;
  --surface: #211B3D;
  --surface-2: #281F4B;
  --text: #ECE6FF;
  --text-soft: #B7ACDF;
  --text-faint: #8479AC;
  --border: color-mix(in srgb, var(--orchid) 34%, #211B3D);
  --border-soft: color-mix(in srgb, var(--orchid) 20%, #211B3D);
  --code-bg: #1A1437;
  --code-text: #ECE6FF;
  --code-border: #362f5e;
  --grad-ink: linear-gradient(115deg, #241C52 0%, #33276F 42%, #45309C 74%, #5538B2 100%);
  --on-ink: #FFFFFF;
  --on-ink-soft: #CFC7F5;
  --accent: #BBAAFF;
  --accent-2: var(--orchid);
  --heading-accent: #DBD2FF;
  --grad-title: linear-gradient(115deg, #F6F1FF 0%, #DCCCFF 46%, #EFBAF7 100%);
  --fold-flap: color-mix(in srgb, var(--violet) 58%, #241D48);
  --fold-crease: color-mix(in srgb, var(--orchid) 52%, #241D48);
  --fold-line: color-mix(in srgb, var(--violet) 26%, #241D48);
  --shadow: 0 18px 46px -20px rgba(0, 0, 0, 0.7);
  --shadow-sm: 0 8px 24px -16px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-image:
    radial-gradient(90% 60% at 100% -8%, color-mix(in srgb, var(--lilac) 30%, transparent), transparent 62%),
    radial-gradient(70% 50% at -6% 2%, color-mix(in srgb, var(--rose) 34%, transparent), transparent 58%);
  background-attachment: fixed;
}

/* ---- custom scrollbar (Chrome/WebKit via pseudo, Firefox via standard) ---- */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: color-mix(in srgb, var(--bg-2) 80%, transparent); }
::-webkit-scrollbar-thumb {
  background: var(--grad-ink);
  border-radius: 20px;
  border: 3px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(118deg, #2F3480, var(--violet)); }
@supports not selector(::-webkit-scrollbar) {
  html { scrollbar-color: var(--violet) color-mix(in srgb, var(--bg-2) 80%, transparent); scrollbar-width: thin; }
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.12; color: var(--text); letter-spacing: -0.01em; }

code, pre, kbd { font-family: var(--font-mono); }

/* ============================ top nav ============================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px clamp(16px, 4vw, 40px);
  background: var(--grad-ink);
  border-bottom: none;
  box-shadow: 0 14px 34px -22px rgba(38, 30, 92, .85);
}
/* the sunset hairline that closes the band */
.nav::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--orchid), var(--blush) 30%, var(--periwinkle) 64%, var(--orchid) 100%);
}
.nav__brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 21px;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--on-ink);
}
.nav__brand:hover { color: var(--on-ink); }
.nav__brand .dot {
  width: 14px; height: 14px; border-radius: 4px;
  background: linear-gradient(140deg, var(--blush), var(--orchid) 55%, var(--periwinkle));
  transform: rotate(12deg);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .2);
}
.nav__links { display: flex; gap: 4px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.nav__link {
  display: inline-flex; align-items: center;
  block-size: 36px; padding: 0 13px; line-height: 1;
  border-radius: 999px;
  color: var(--on-ink-soft);
  font-weight: 500;
  font-size: 14.5px;
  transition: background .18s, color .18s;
}
.nav__link:hover { background: rgba(255, 255, 255, .16); color: var(--on-ink); }
.nav__link.is-active { background: var(--on-ink); color: var(--ink); box-shadow: none; }
.nav__link.is-active:hover { background: var(--on-ink); color: var(--ink); }
.nav__icon {
  display: inline-grid; place-items: center;
  inline-size: 36px; block-size: 36px; flex: none;
  border-radius: 10px; line-height: 0;
  border: 1px solid rgba(255, 255, 255, .3);
  color: var(--on-ink);
  transition: .18s;
}
.nav__icon:hover { color: var(--on-ink); border-color: var(--on-ink); background: rgba(255, 255, 255, .16); }
.nav__icon svg { display: block; inline-size: 19px; block-size: 19px; }
/* a filled mark reads heavier than a stroked one: trim it a hair so the pair
   looks the same size inside identical 36px squares. */
.nav__icon[href*="github"] svg { inline-size: 17px; block-size: 17px; }
.nav__menu svg { inline-size: 20px; block-size: 20px; }
.nav__toggle {
  margin-left: 4px;
  cursor: pointer;
  background: transparent;
}
.nav__menu {
  display: none;
  margin-left: auto;
  cursor: pointer;
  background: rgba(255, 255, 255, .1);
}

/* ============================ layout ============================ */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }
.section { padding: clamp(44px, 6vw, 72px) 0; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--accent-2);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.eyebrow::before {
  content: "";
  width: 24px; height: 3px; border-radius: 2px;
  background: var(--grad-ink);
  flex: none;
}
.lead { color: var(--text-soft); font-size: clamp(16px, 2vw, 19px); max-width: 62ch; }

/* paper / origami card */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 26px;
  overflow: hidden;
}
/* a corner folded down: that corner is squared so the flap has somewhere to
   lie, and the flap is a triangle with a crease drawn along its fold. */
.card--fold { border-top-right-radius: 0; }
.card--fold::before {
  content: "";
  position: absolute;
  top: -1px; right: -1px;
  width: 34px; height: 34px;
  background:
    linear-gradient(225deg,
      var(--fold-flap) 0 44%,
      var(--fold-crease) 44% 48%,
      var(--fold-line) 48% 49.6%,
      transparent 49.6%);
}

/* ============================ hero ============================ */
.hero { position: relative; padding: clamp(40px, 6vw, 76px) 0 0; }
.hero__grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(24px, 4vw, 56px); align-items: center; }
.hero h1 {
  font-size: clamp(46px, 8.4vw, 88px);
  margin: 6px 0 10px;
  font-weight: 800;
  background: var(--grad-title);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.035em;
}
.hero__tag { font-size: clamp(17px, 2.2vw, 21px); color: var(--text-soft); max-width: 48ch; }
.hero__cta { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 12px 20px; border-radius: 999px;
  font-weight: 600; font-size: 15px;
  border: 1px solid transparent; cursor: pointer;
  transition: transform .15s, box-shadow .2s, background .2s;
}
.btn--primary { background: var(--grad-ink); color: var(--on-ink); box-shadow: 0 14px 28px -18px rgba(58, 52, 140, .9); }
.btn--primary:hover { transform: translateY(-2px); box-shadow: var(--shadow); color: var(--on-ink); }
.btn--ghost { background: var(--surface); color: var(--accent); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--violet); color: var(--accent); transform: translateY(-2px); }

/* torn-paper hero panel holding the live demo */
.hero__panel {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 30px 60px -34px rgba(58, 52, 140, .55);
  padding: 22px 22px 30px;
  /* one corner clipped short, the way a sheet gets trimmed */
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%);
}
.hero__panel .ribbon {
  position: absolute; top: -1px; left: -1px;
  background: var(--grad-ink); color: var(--on-ink);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .16em;
  text-transform: uppercase; padding: 6px 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ============================ facts band ============================ */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  padding: 26px 10px;
  background: linear-gradient(115deg, #3B4097 0%, var(--ink) 46%, #5C46BE 100%);
  border-radius: var(--radius);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0 100%);
  box-shadow: 0 24px 50px -30px rgba(58, 52, 140, .8);
}
.stat { padding: 4px 20px; }
.stat + .stat { border-left: 1px solid rgba(255, 255, 255, .2); }
.stat__n { font-family: var(--font-display); font-size: 32px; font-weight: 700; color: var(--blush); line-height: 1.2; }
.stat__l { font-size: 13px; color: var(--on-ink-soft); line-height: 1.45; }

/* ============================ feature grid ============================ */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 8px; }
.feature { padding: 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.feature__swatch {
  inline-size: 44px; block-size: 44px; border-radius: 13px;
  margin-bottom: 14px; padding: 0;
  background: var(--grad-ink);
  display: grid; place-items: center;
  color: var(--on-ink);
}
/* one grid, one stroke: every badge icon lands on the same optical centre */
.feature__swatch svg {
  inline-size: 22px; block-size: 22px; display: block;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.feature h3 { margin: 0 0 8px; font-size: 19px; color: var(--heading-accent); }
.feature p { margin: 0; color: var(--text-soft); font-size: 14.5px; }

/* ============================ code blocks ============================ */
pre {
  margin: 0;
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 12.8px;
  line-height: 1.6;
  tab-size: 2;
  border: 1px solid var(--code-border);
}
pre code { font-size: 12.8px; white-space: pre; }
:not(pre) > code {
  background: color-mix(in srgb, var(--lilac) 40%, transparent);
  color: color-mix(in srgb, var(--ink) 78%, black);
  padding: .1em .4em;
  border-radius: 6px;
  font-size: .86em;
  white-space: nowrap;
}
:root[data-theme="dark"] :not(pre) > code { color: var(--blush); background: color-mix(in srgb, var(--lilac) 18%, transparent); }

.codeblock { position: relative; }
.codeblock__bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: color-mix(in srgb, var(--code-bg) 88%, #000); border: 1px solid var(--code-border); border-bottom: none; border-radius: var(--radius-sm) var(--radius-sm) 0 0; color: var(--text-faint); font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .08em; }
.codeblock pre { border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
/* a printed result belongs to the slab above it: weld the two together so the
   seam is one hairline, not a rounded corner butting a square one. */
pre:has(+ .out), .codeblock pre:has(+ .out) {
  border-bottom: none;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  padding-bottom: 10px;
}
.copy {
  margin-left: auto; cursor: pointer; border: 1px solid var(--code-border);
  background: transparent; color: var(--text-faint); border-radius: 7px;
  padding: 3px 9px; font-family: var(--font-mono); font-size: 11px;
}
.copy:hover { color: #fff; border-color: var(--violet); }
.out {
  margin: 0;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: color-mix(in srgb, var(--code-bg) 84%, var(--violet));
  border: 1px solid var(--code-border);
  border-top: 1px solid color-mix(in srgb, var(--violet) 45%, var(--code-border));
  padding: 11px 18px 13px;
  color: color-mix(in srgb, var(--code-text) 88%, #000);
  font-family: var(--font-mono); font-size: 12.5px; white-space: pre; overflow-x: auto;
}
.out::before { content: "→ "; color: var(--orchid); }
.out--label::before { content: ""; }

/* ============================ docs layout (guide / api) ============================ */
.docs { display: grid; grid-template-columns: 254px 1fr; gap: clamp(20px, 4vw, 52px); align-items: start; }
.toc { position: sticky; top: 78px; align-self: start; max-height: calc(100vh - 96px); overflow-y: auto; padding-right: 6px; }
.toc__h { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--text-faint); margin: 18px 0 8px; }
.toc__h:first-child { margin-top: 0; }
.toc a { display: block; padding: 5px 10px; border-radius: 8px; color: var(--text-soft); font-size: 14px; border-left: 2px solid transparent; }
.toc a:hover { background: color-mix(in srgb, var(--lilac) 38%, transparent); color: var(--text); }
.toc a.is-active { color: var(--accent); border-left-color: var(--violet); background: color-mix(in srgb, var(--lilac) 30%, transparent); font-weight: 600; }
.toc a.toc-sub { padding-left: 22px; font-size: 13px; color: var(--text-faint); }
.toc a.toc-sub:hover { color: var(--text); }

.content { min-width: 0; }
/* vertical rhythm: prose owns the gap above a slab, the slab owns the gap
   below it. Same numbers everywhere, so no block needs an inline margin. */
.content h2 { font-size: clamp(26px, 4vw, 34px); margin: 8px 0 16px; scroll-margin-top: 84px; }
.content h3 { font-size: 21px; margin: 34px 0 12px; scroll-margin-top: 84px; }
/* :where keeps the prose margin at zero specificity, so a component rule
   (an api desc, a caption) can set its own without an arms race */
.content p { color: var(--text-soft); }
.content :where(p) { margin: 0 0 16px; }
.content > .page-title { margin-top: 4px; }
/* the intro closes the page header, not the first section: give it the same
   breath the section rule gets before the next heading */
.content > .lead { margin-bottom: 32px; }
.content .next-link { margin: 30px 0 0; }
.content ul { color: var(--text-soft); }
.content li { margin: 6px 0; }
.content .codeblock { margin: 0 0 22px; }
/* stacked slabs are one exhibit: tight together, then a full gap to prose */
.content .codeblock:has(+ .codeblock) { margin-bottom: 10px; }
.content > section { padding-bottom: 24px; border-bottom: 1px solid var(--border-soft); margin-bottom: 30px; }
/* the rule sits at a fixed distance from whatever ends the section, so a note
   and a code slab hand over at the same place */
.content > section > :last-child { margin-bottom: 0; }
.content > section:last-child { border-bottom: none; }

/* ============================ api entries ============================ */
.api-group { margin-bottom: 44px; }
/* no rules between entries: the signature box is the divider, and the gap is
   padding. A hairline a few pixels above another border reads as a double line. */
.api-item { padding: 18px 0; scroll-margin-top: 84px; }
/* the entry's own bottom gap is the gap; an example's trailing margin would
   double it and make every boundary a different size. */
.api-item > :last-child { margin-bottom: 0; }
.api-sig { font-family: var(--font-mono); font-size: 13.5px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 11px 14px; color: var(--text); overflow-x: auto; white-space: pre; }
.api-sig--variant { background: transparent; border-style: dashed; border-color: color-mix(in srgb, var(--violet) 34%, transparent); }
/* variants are indented, not railed: the dashed box already says "another shape
   of the same type", and a rail beside it was a second vertical edge. */
.api-var { display: grid; gap: 7px; padding-left: 16px; }
.api-vdoc .api-desc { margin: 0; font-size: 14px; }
.api-sig .kw { color: var(--violet); }
.api-sig .ty { color: var(--azure); }
.api-sig .fn { color: var(--ink); font-weight: 600; }
.api-desc { color: var(--text-soft); margin: 12px 0 16px; font-size: 14.5px; }
.api-desc code { font-size: .85em; }
.api-sub { margin: 14px 0 0; display: grid; gap: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: 11.5px;
  padding: 3px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--lilac) 28%, var(--surface));
  color: color-mix(in srgb, var(--ink) 86%, black);
  border: 1px solid color-mix(in srgb, var(--violet) 22%, transparent);
  margin-right: 6px;
}
.chip--btn { cursor: pointer; background: var(--surface); transition: background .15s, border-color .15s, transform .15s; }
.chip--btn:hover { border-color: var(--violet); background: color-mix(in srgb, var(--lilac) 26%, var(--surface)); transform: translateY(-1px); }
:root[data-theme="dark"] .chip { color: var(--blush); background: color-mix(in srgb, var(--violet) 18%, var(--surface)); border-color: color-mix(in srgb, var(--orchid) 26%, transparent); }
:root[data-theme="dark"] .chip--btn { background: var(--surface-2); }

/* ============================ demo widgets ============================ */
.demo { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.demo__row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 220px; }
.field label { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); }
.input, .textarea {
  font-family: var(--font-mono); font-size: 13.5px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; width: 100%;
}
.input:focus, .textarea:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px color-mix(in srgb, var(--lilac) 45%, transparent); }
.textarea { min-height: 176px; resize: none; white-space: pre; overflow: auto; line-height: 1.55; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-soft); cursor: pointer; }
.demo__out {
  margin-top: 16px; border-radius: 12px;
  background: var(--code-bg); color: var(--code-text);
  border: 1px solid var(--code-border);
  padding: 12px 15px; font-family: var(--font-mono); font-size: 13px;
  white-space: pre-wrap; word-break: break-word; min-height: 44px;
}
.demo__out .k { color: color-mix(in srgb, var(--orchid) 86%, transparent); }
.demo__out .v { color: var(--code-text); }
.demo__out.empty { color: var(--text-faint); }
.part {
  border: 1px solid var(--border-soft); border-radius: 12px;
  padding: 12px 14px; margin-top: 10px; background: var(--surface-2);
}
.part__h { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-faint); }
.part__name { font-weight: 600; color: var(--accent); }
.part__kv { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-soft); margin-top: 4px; }
.part__kv b { color: var(--text); font-weight: 600; }
.part__chunks { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.part__chunk {
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6;
  padding: 1px 6px; border-radius: 6px; white-space: pre; overflow-wrap: anywhere;
  background: color-mix(in srgb, var(--lilac) 30%, var(--surface));
  border: 1px solid var(--border-soft);
}
.part__chunk--empty { color: var(--text-faint); }

/* ============================ footer ============================ */
.footer {
  position: relative;
  background: var(--grad-ink);
  color: var(--on-ink-soft);
  padding: 36px 0 52px;
  font-size: 14px;
}
.footer::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--orchid), var(--blush) 30%, var(--periwinkle) 64%, var(--orchid) 100%);
}
.footer a { color: var(--on-ink); }
.footer a:hover { color: var(--blush); }
.footer__row { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; }

/* ============================ responsive ============================ */
@supports (width: 100cqw) {}

@media (width <= 980px) {
  .hero__grid { grid-template-columns: 1fr; }
  .features { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr; row-gap: 18px; }
  .stat:nth-child(odd) { border-left: none; padding-left: 18px; }
  .docs { grid-template-columns: 1fr; }
  .toc { position: static; max-height: none; display: none; }
}

@media (width <= 860px) {
  .features { grid-template-columns: 1fr; }
  .nav__menu { display: inline-grid; }
  .nav__links {
    position: absolute;
    top: calc(100% + 8px);
    right: 12px;
    left: 12px;
    margin-left: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 22px 40px -20px rgba(38, 30, 92, .55);
    display: none;
  }
  .nav.is-open .nav__links { display: flex; }
  .nav__links .nav__link { display: flex; align-items: center; text-align: left; padding: 0 12px; color: var(--text-soft); }
  .nav__links .nav__link:hover { background: color-mix(in srgb, var(--lilac) 42%, transparent); color: var(--text); }
  .nav__links .nav__link.is-active { background: var(--grad-ink); color: var(--on-ink); }
  .nav__links .nav__icon {
    inline-size: auto; width: 100%;
    margin: 0; border-radius: 9px;
    color: var(--text-soft);
    border-color: var(--border-soft);
    background: transparent;
  }
  .nav__links .nav__icon:hover { color: var(--ink); border-color: var(--violet); background: color-mix(in srgb, var(--lilac) 30%, transparent); }
}

@media (width <= 520px) {
  .stats { grid-template-columns: 1fr; row-gap: 0; }
  .stat { padding: 12px 18px; }
  .stat + .stat { border-left: none; border-top: 1px solid rgba(255, 255, 255, .2); }
  .stat:nth-child(odd) { border-left: none; }
}

/* ============================ slip ============================ */
/* A note is a slip of paper laid on the page: one sharp corner where it was
   torn from the block. One sheet, one outline — the gap around it is margin,
   never a second border drawn behind the first. */
.note {
  position: relative;
  margin: 26px 0 6px;
  padding: 16px 22px 18px;
  border-radius: 3px 16px 16px 16px;
  background: linear-gradient(176deg,
    color-mix(in srgb, var(--lilac) 36%, var(--surface)) 0%,
    var(--surface) 56%);
  border: 1px solid color-mix(in srgb, var(--violet) 26%, transparent);
  box-shadow: 0 16px 28px -24px rgba(58, 52, 140, .55);
  color: var(--text-soft);
  font-size: 14.5px;
  line-height: 1.66;
}
.note > b:first-child {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .19em;
  text-transform: uppercase;
  color: var(--accent-2);
}
.note > b:first-child::before {
  content: "";
  width: 20px; height: 3px; border-radius: 2px;
  background: var(--grad-ink);
  flex: none;
}
.note code { background: color-mix(in srgb, var(--violet) 15%, transparent); }
:root[data-theme="dark"] .note {
  background: linear-gradient(176deg,
    color-mix(in srgb, var(--violet) 30%, var(--surface-2)) 0%,
    var(--surface-2) 62%);
  border-color: color-mix(in srgb, var(--orchid) 34%, transparent);
  box-shadow: 0 18px 30px -26px #000;
}

.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; z-index: 99; background: var(--surface); padding: 8px 12px; border-radius: 8px; }

html, button, input, textarea, select { font-variant-ligatures: no-contextual; }

/* 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; }
}
