/* frappex-client documentation site. No external fonts or resources: everything is
   served from this origin so a strict Content Security Policy can apply. */

:root {
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --topbar: 64px;
  --sidebar: 264px;
  --toc: 220px;
  --content: 780px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0c13;
  --bg-soft: #0f121b;
  --surface: #131724;
  --surface-2: #181d2d;
  --border: #232a3d;
  --border-strong: #313a52;
  --text: #e8eaf2;
  --text-strong: #ffffff;
  --muted: #9aa2b8;
  --faint: #6b7390;
  --accent: #9d86ff;
  --accent-strong: #b6a6ff;
  --accent-ink: #0a0c13;
  --accent-soft: rgba(157, 134, 255, .13);
  --mint: #34d8c3;
  --code-bg: #0d1019;
  --code-border: #1f2638;
  --inline-code-bg: rgba(157, 134, 255, .12);
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, .7);
  --glow-1: rgba(124, 92, 255, .35);
  --glow-2: rgba(45, 212, 191, .22);
  --note: #5aa8ff;
  --tip: #34d8c3;
  --warn: #f5b443;
  --danger: #ff6b81;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-soft: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f3f4f9;
  --border: #e3e6ef;
  --border-strong: #cfd4e2;
  --text: #1c1f2e;
  --text-strong: #0b0d18;
  --muted: #565d75;
  --faint: #8189a3;
  --accent: #6440f2;
  --accent-strong: #5130d8;
  --accent-ink: #ffffff;
  --accent-soft: #f0ecff;
  --mint: #0f9c8c;
  --code-bg: #f7f8fc;
  --code-border: #e4e7f0;
  --inline-code-bg: #f0ecff;
  --shadow: 0 20px 50px -24px rgba(30, 20, 80, .25);
  --glow-1: rgba(100, 64, 242, .18);
  --glow-2: rgba(15, 156, 140, .14);
  --note: #1f6feb;
  --tip: #0f9c8c;
  --warn: #b7791f;
  --danger: #d6334d;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
code, kbd, pre { font-family: var(--font-mono); }
kbd {
  font-size: .75em; padding: .1em .45em; border: 1px solid var(--border-strong);
  border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); color: var(--muted);
}
::selection { background: var(--accent-soft); }

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 100; padding: 8px 14px;
  background: var(--accent); color: var(--accent-ink); border-radius: var(--radius-sm);
}
.skip-link:focus { left: 8px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--topbar);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  height: 100%; max-width: 1440px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 22px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text-strong); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-name { font-size: 1.12rem; letter-spacing: -.01em; }
.brand-version {
  font: 600 .7rem/1 var(--font-mono); color: var(--accent); background: var(--accent-soft);
  padding: 4px 7px; border-radius: 999px;
}
.topnav { display: flex; gap: 4px; }
.topnav a { color: var(--muted); font-weight: 500; font-size: .93rem; padding: 6px 12px; border-radius: 8px; }
.topnav a:hover { color: var(--text-strong); background: var(--surface-2); text-decoration: none; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { color: var(--text-strong); background: var(--surface-2); border-color: var(--border); text-decoration: none; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn svg.filled { fill: currentColor; stroke: none; }
[data-theme="dark"] .icon-sun, [data-theme="light"] .icon-moon { display: none; }
.nav-open { display: none; }
.search-trigger {
  display: flex; align-items: center; gap: 8px; height: 38px; min-width: 210px; padding: 0 10px 0 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--faint);
  font: inherit; font-size: .9rem; cursor: pointer; transition: border-color .2s var(--ease);
}
.search-trigger:hover { border-color: var(--border-strong); color: var(--muted); }
.search-trigger svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; }
.search-trigger kbd { margin-left: auto; }

/* ---------- docs layout ---------- */
.docs-layout {
  display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr) var(--toc);
  max-width: 1440px; margin: 0 auto; gap: 40px; padding: 0 20px;
}
.sidebar { position: sticky; top: var(--topbar); height: calc(100vh - var(--topbar)); }
.sidebar-scroll { height: 100%; overflow-y: auto; padding: 28px 8px 40px 0; scrollbar-width: thin; }
.nav-group { margin-bottom: 22px; }
.nav-group-title {
  margin: 0 0 6px; padding: 0 12px; font-size: .72rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--faint);
}
.nav-group ul { list-style: none; margin: 0; padding: 0; }
.nav-group a {
  display: block; padding: 6px 12px; border-radius: 8px; color: var(--muted); font-size: .92rem;
  border-left: 2px solid transparent;
}
.nav-group a:hover { color: var(--text-strong); background: var(--surface-2); text-decoration: none; }
.nav-group a[aria-current="page"] {
  color: var(--accent-strong); background: var(--accent-soft); font-weight: 600; border-left-color: var(--accent);
  border-radius: 0 8px 8px 0;
}
.sidebar-scrim { display: none; }

.content { min-width: 0; max-width: var(--content); padding: 40px 0 64px; }
.eyebrow {
  margin: 0 0 6px; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent);
}
.eyebrow.center { text-align: center; }

.toc { position: sticky; top: var(--topbar); height: calc(100vh - var(--topbar)); overflow-y: auto; padding: 44px 0 40px; }
.toc-title { margin: 0 0 10px; font-size: .78rem; font-weight: 700; color: var(--text-strong); letter-spacing: .02em; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc a { display: block; padding: 4px 0 4px 14px; margin-left: -1px; font-size: .85rem; color: var(--faint); border-left: 1px solid transparent; }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc .toc-l3 a { padding-left: 26px; font-size: .82rem; }
.toc a.active { color: var(--accent-strong); border-left-color: var(--accent); }

/* ---------- prose ---------- */
.prose { color: var(--text); }
.prose h1 { font-size: clamp(2rem, 1.5rem + 1.6vw, 2.6rem); line-height: 1.15; letter-spacing: -.025em; margin: 0 0 16px; color: var(--text-strong); }
.prose h2 { font-size: 1.55rem; letter-spacing: -.015em; margin: 52px 0 14px; padding-top: 6px; color: var(--text-strong); line-height: 1.25; }
.prose h3 { font-size: 1.18rem; margin: 34px 0 10px; color: var(--text-strong); line-height: 1.3; }
.prose h4 { font-size: 1rem; margin: 26px 0 8px; color: var(--text-strong); }
.prose h1 + p { font-size: 1.12rem; color: var(--muted); }
.prose p, .prose ul, .prose ol, .prose dl { margin: 0 0 16px; }
.prose li { margin: 4px 0; }
.prose li > p { margin: 0 0 6px; }
.prose strong { color: var(--text-strong); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 40px 0; }
.prose .headerlink {
  margin-left: 8px; color: var(--faint); opacity: 0; font-weight: 400; transition: opacity .15s;
}
.prose h2:hover .headerlink, .prose h3:hover .headerlink, .prose .headerlink:focus { opacity: 1; text-decoration: none; }
.prose :not(pre) > code {
  font-size: .86em; padding: .14em .4em; border-radius: 6px; background: var(--inline-code-bg);
  color: var(--accent-strong); word-break: break-word;
}
.prose a code { color: inherit; }
.prose blockquote {
  margin: 0 0 16px; padding: 4px 18px; border-left: 3px solid var(--border-strong); color: var(--muted);
}
.prose dt { font-weight: 700; color: var(--text-strong); }
.prose dd { margin: 0 0 12px 18px; }

/* tables */
.prose table {
  display: table; width: 100%; border-collapse: separate; border-spacing: 0;
  margin: 0 0 22px; font-size: .92rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.prose thead th {
  background: var(--surface-2); color: var(--text-strong); font-weight: 600; text-align: left;
}
.prose th, .prose td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; text-align: left; }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose tbody tr:hover td { background: var(--bg-soft); }

/* code blocks */
.highlight { position: relative; margin: 0 0 20px; max-width: 100%; min-width: 0; }
.highlight pre {
  margin: 0; padding: 18px 20px; overflow-x: auto; background: var(--code-bg);
  border: 1px solid var(--code-border); border-radius: var(--radius); font-size: .86rem; line-height: 1.65;
  tab-size: 4; scrollbar-width: thin;
}
.highlight pre code { background: none; padding: 0; color: var(--text); }
.copy-btn {
  position: absolute; top: 10px; right: 10px; padding: 4px 10px; font: 600 .72rem/1.4 var(--font-sans);
  color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px;
  cursor: pointer; opacity: 0; transition: opacity .15s var(--ease);
}
.highlight:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.copy-btn.done { color: var(--mint); border-color: var(--mint); opacity: 1; }

/* tabs (pymdownx.tabbed, alternate style; works without JavaScript) */
.tabbed-set { position: relative; display: flex; flex-wrap: wrap; margin: 0 0 20px; }
.tabbed-set > input { position: absolute; opacity: 0; pointer-events: none; }
.tabbed-labels {
  display: flex; gap: 2px; width: 100%; overflow-x: auto; border-bottom: 1px solid var(--border);
  margin-bottom: 12px; scrollbar-width: none;
}
.tabbed-labels > label {
  padding: 8px 14px; font-size: .86rem; font-weight: 600; color: var(--faint); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; user-select: none;
}
.tabbed-labels > label:hover { color: var(--text); }
.tabbed-content { width: 100%; }
.tabbed-block { display: none; }
.tabbed-block > :last-child { margin-bottom: 0; }
.tabbed-set > input:nth-child(1):checked ~ .tabbed-content > :nth-child(1),
.tabbed-set > input:nth-child(2):checked ~ .tabbed-content > :nth-child(2),
.tabbed-set > input:nth-child(3):checked ~ .tabbed-content > :nth-child(3),
.tabbed-set > input:nth-child(4):checked ~ .tabbed-content > :nth-child(4) { display: block; }
.tabbed-set > input:nth-child(1):checked ~ .tabbed-labels > :nth-child(1),
.tabbed-set > input:nth-child(2):checked ~ .tabbed-labels > :nth-child(2),
.tabbed-set > input:nth-child(3):checked ~ .tabbed-labels > :nth-child(3),
.tabbed-set > input:nth-child(4):checked ~ .tabbed-labels > :nth-child(4) {
  color: var(--accent-strong); border-bottom-color: var(--accent);
}
.tabbed-set > input:focus-visible ~ .tabbed-labels { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* admonitions */
.admonition {
  margin: 0 0 20px; padding: 14px 18px; border: 1px solid var(--border); border-left: 4px solid var(--note);
  border-radius: var(--radius-sm); background: color-mix(in srgb, var(--note) 7%, var(--bg));
}
.admonition > :last-child { margin-bottom: 0; }
.admonition-title { margin: 0 0 6px !important; font-weight: 700; color: var(--note); font-size: .92rem; }
.admonition.tip { border-left-color: var(--tip); background: color-mix(in srgb, var(--tip) 7%, var(--bg)); }
.admonition.tip .admonition-title { color: var(--tip); }
.admonition.warning { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn) 8%, var(--bg)); }
.admonition.warning .admonition-title { color: var(--warn); }
.admonition.danger { border-left-color: var(--danger); background: color-mix(in srgb, var(--danger) 7%, var(--bg)); }
.admonition.danger .admonition-title { color: var(--danger); }
details { margin: 0 0 18px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 16px; background: var(--bg-soft); }
details summary { cursor: pointer; font-weight: 600; color: var(--text-strong); }
details[open] summary { margin-bottom: 8px; }

/* FAQ: questions as tap-to-open cards. */
.prose details.question { margin: 0 0 10px; padding: 0; background: var(--surface); border-radius: var(--radius); transition: border-color .2s var(--ease); }
.prose details.question:hover, .prose details.question[open] { border-color: var(--border-strong); }
.prose details.question > summary {
  list-style: none; display: block; position: relative;
  min-height: 52px; padding: 14px 48px 14px 18px; margin: 0; font-size: 1rem; line-height: 1.45;
}
.prose details.question > summary::-webkit-details-marker { display: none; }
.prose details.question > summary::after {
  content: ""; position: absolute; right: 22px; top: 50%; width: 9px; height: 9px;
  border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint);
  transform: translateY(-70%) rotate(45deg); transition: transform .2s var(--ease);
}
.prose details.question[open] > summary::after { transform: translateY(-25%) rotate(-135deg); border-color: var(--accent); }
.prose details.question[open] > summary { color: var(--accent-strong); border-bottom: 1px solid var(--border); }
.prose details.question > :not(summary) { margin-left: 18px; margin-right: 18px; }
.prose details.question > summary + * { margin-top: 14px; }
.prose details.question > :last-child { margin-bottom: 16px; }
.prose details.question summary code { font-size: .88em; }

/* diagrams written in HTML (see architecture and errors pages) */
.diagram { margin: 0 0 24px; padding: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-soft); overflow-x: auto; }
.diagram ol, .flow { list-style: none; counter-reset: step; display: grid; gap: 10px; margin: 0; padding: 0; }
.flow { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 28px; }
.diagram li, .flow li {
  counter-increment: step; position: relative; padding: 14px 14px 14px 46px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface);
}
.diagram li::before, .flow li::before {
  content: counter(step); position: absolute; left: 12px; top: 13px; width: 24px; height: 24px;
  display: grid; place-items: center; border-radius: 50%; font: 700 .75rem/1 var(--font-mono);
  background: var(--accent-soft); color: var(--accent-strong);
}
.diagram li strong, .flow li strong { display: block; color: var(--text-strong); margin-bottom: 2px; }
.diagram li span, .flow li span { display: block; font-size: .85rem; color: var(--muted); }
.diagram li span code, .flow li span code { font-size: .8rem; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 60px; }
.pager-link {
  display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-strong); transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.pager-link span { font-size: .78rem; color: var(--faint); }
.pager-link.next { text-align: right; grid-column: 2; }
.pager-link:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.edit-note { margin-top: 28px; font-size: .85rem; color: var(--faint); }

/* ---------- home ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container.narrow { max-width: 820px; }
.center { text-align: center; }
.hero { position: relative; overflow: hidden; padding: 84px 0 72px; border-bottom: 1px solid var(--border); }
.hero-glow {
  position: absolute; inset: -40% -10% auto; height: 680px; pointer-events: none;
  background:
    radial-gradient(520px 320px at 22% 38%, var(--glow-1), transparent 70%),
    radial-gradient(420px 300px at 78% 28%, var(--glow-2), transparent 70%);
  filter: blur(8px);
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px; opacity: .35;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
}
.hero-grid { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr 1.05fr; gap: 48px; align-items: center; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 22px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: color-mix(in srgb, var(--surface) 70%, transparent);
  font-size: .8rem; color: var(--muted);
}
.pill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px color-mix(in srgb, var(--mint) 22%, transparent); }
.hero h1 {
  margin: 0 0 20px; font-size: clamp(2.1rem, 1.3rem + 2.2vw, 3.05rem); line-height: 1.08; letter-spacing: -.035em;
  color: var(--text-strong);
}
.grad {
  background: linear-gradient(100deg, var(--accent) 10%, var(--mint) 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lead { margin: 0 0 28px; font-size: 1.12rem; color: var(--muted); max-width: 36em; }
.lead code { font-size: .9em; color: var(--text); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 26px; }
.hero-actions.center { justify-content: center; margin-top: 34px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 22px; border-radius: 11px;
  font-weight: 600; font-size: .96rem; transition: transform .2s var(--ease), box-shadow .2s var(--ease), background .2s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, var(--mint)));
  color: #fff; box-shadow: 0 10px 30px -12px var(--accent);
}
.btn-primary:hover { box-shadow: 0 14px 34px -10px var(--accent); color: #fff; }
.btn-ghost { border: 1px solid var(--border-strong); color: var(--text-strong); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.btn-ghost:hover { border-color: var(--accent); }
.install {
  display: inline-flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 11px;
  background: var(--code-bg); border: 1px solid var(--code-border); font-family: var(--font-mono); font-size: .92rem;
}
.install-prompt { color: var(--mint); }
.install code { color: var(--text-strong); }
.copy-inline {
  padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--muted); font: 600 .75rem var(--font-sans); cursor: pointer;
}
.copy-inline:hover { color: var(--text-strong); border-color: var(--border-strong); }
.copy-inline.done { color: var(--mint); border-color: var(--mint); }

.window {
  border: 1px solid var(--border-strong); border-radius: 16px; background: var(--code-bg); box-shadow: var(--shadow);
  overflow: hidden; min-width: 0;
}
.window-bar { display: flex; align-items: center; gap: 7px; padding: 12px 16px; border-bottom: 1px solid var(--code-border); background: var(--surface); }
.window-bar span { width: 11px; height: 11px; border-radius: 50%; background: var(--border-strong); }
.window-bar span:nth-child(1) { background: #ff5f57; }
.window-bar span:nth-child(2) { background: #febc2e; }
.window-bar span:nth-child(3) { background: #28c840; }
.window-bar em { margin-left: 10px; font: .8rem var(--font-mono); color: var(--faint); font-style: normal; }
.window .tabbed-set { margin: 0; }
.window .tabbed-labels { padding: 0 12px; margin-bottom: 0; background: var(--surface); }
.window .highlight { margin: 0; }
.window .highlight pre { border: 0; border-radius: 0; font-size: .82rem; padding: 18px 20px 22px; }

.strip { border-bottom: 1px solid var(--border); background: var(--bg-soft); }
.strip-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.strip-grid > div { padding: 26px 20px; display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--border); }
.strip-grid > div:last-child { border-right: 0; }
.strip strong { font-size: 1.8rem; letter-spacing: -.02em; color: var(--text-strong); }
.strip span { font-size: .88rem; color: var(--muted); }

.section { padding: 92px 0; }
.section.alt { background: var(--bg-soft); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-title { margin: 0 auto 14px; max-width: 22em; text-align: center; font-size: clamp(1.7rem, 1.2rem + 1.6vw, 2.4rem); line-height: 1.15; letter-spacing: -.025em; color: var(--text-strong); }
.section-desc { max-width: 44em; margin: 0 auto 44px; text-align: center; color: var(--muted); font-size: 1.05rem; }
.text-link { font-weight: 600; }

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.compare-panel { min-width: 0; padding: 18px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.compare-panel .highlight { margin: 0; }
.compare-panel .highlight pre { font-size: .82rem; }
.compare-label { margin: 0 0 12px; font-size: .78rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.compare-panel.bad .compare-label { color: var(--danger); }
.compare-panel.good { border-color: color-mix(in srgb, var(--mint) 45%, var(--border)); }
.compare-panel.good .compare-label { color: var(--mint); }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 40px; }
.cards.three { grid-template-columns: repeat(3, 1fr); }
.card {
  display: block; padding: 22px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface);
  color: var(--text); transition: border-color .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease);
}
.card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow); }
.card h3 { margin: 0 0 6px; font-size: 1.02rem; color: var(--text-strong); }
.card p { margin: 0; font-size: .9rem; color: var(--muted); }
.card code { font-size: .85em; color: var(--accent-strong); }
.card-icon {
  display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 14px; border-radius: 11px;
  background: var(--accent-soft); color: var(--accent-strong); font: 700 1.05rem/1 var(--font-mono);
}

.steps { list-style: none; counter-reset: s; margin: 40px 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.steps li {
  counter-increment: s; position: relative; padding: 20px 22px 20px 70px; border: 1px solid var(--border);
  border-radius: 16px; background: var(--surface);
}
.steps li::before {
  content: counter(s); position: absolute; left: 22px; top: 20px; width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center; font: 700 .9rem/1 var(--font-mono); color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--mint));
}
.steps h3 { margin: 4px 0 10px; color: var(--text-strong); font-size: 1.05rem; }
.steps p { margin: 0; color: var(--muted); }
.steps .highlight { margin: 0; }

.notfound { max-width: 640px; margin: 0 auto; padding: 120px 24px; text-align: center; }
.notfound-code { margin: 0; font: 800 5rem/1 var(--font-mono); background: linear-gradient(100deg, var(--accent), var(--mint)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.notfound h1 { margin: 10px 0; font-family: var(--font-mono); color: var(--text-strong); }
.notfound p { color: var(--muted); }
.notfound .hero-actions { justify-content: center; margin-top: 28px; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--border); background: var(--bg-soft); }
.footer-inner {
  max-width: 1440px; margin: 0 auto; padding: 28px 24px; display: flex; justify-content: space-between; gap: 24px;
  font-size: .85rem; color: var(--faint);
}
.footer strong { color: var(--text); }
.footer nav { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.footer nav a { color: var(--muted); }

/* ---------- search ---------- */
.search-dialog { position: fixed; inset: 0; z-index: 80; }
.search-dialog[hidden] { display: none; }
body.search-is-open { overflow: hidden; }
.search-backdrop { position: absolute; inset: 0; background: rgba(5, 6, 12, .6); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.search-panel {
  position: relative; max-width: 640px; margin: 10vh auto 0; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 16px; box-shadow: var(--shadow); overflow: hidden;
}
.search-field { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.search-field svg { width: 20px; height: 20px; fill: none; stroke: var(--faint); stroke-width: 2; flex: none; }
.search-field input {
  flex: 1; height: 58px; border: 0; outline: 0; background: none; color: var(--text-strong); font: inherit; font-size: 1.05rem;
}
.search-field input::-webkit-search-cancel-button { display: none; }
.search-results { list-style: none; margin: 0; padding: 8px; max-height: 56vh; overflow-y: auto; }
.search-results:empty { display: none; }
.search-results a { display: block; padding: 10px 12px; border-radius: 10px; color: var(--text); }
.search-results a:hover, .search-results a[aria-selected="true"] { background: var(--accent-soft); text-decoration: none; }
.search-results .r-page { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); }
.search-results .r-head { display: block; font-weight: 600; color: var(--text-strong); }
.search-results .r-text { display: block; font-size: .84rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-results mark { background: none; color: var(--accent-strong); font-weight: 700; }
.search-results .r-empty { padding: 18px 12px; color: var(--muted); text-align: center; }
.search-hint { margin: 0; padding: 10px 16px; border-top: 1px solid var(--border); font-size: .78rem; color: var(--faint); }

/* Grid and flex children default to their content's width; let them shrink so
   long code scrolls inside its own box instead of widening the page. */
.steps > li, .flow > li, .cards > *, .strip-grid > div, .hero-grid > *, .compare > *,
.docs-layout > *, .tabbed-set, .tabbed-content, .tabbed-block, .prose li, .prose td { min-width: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 { overflow-wrap: anywhere; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .docs-layout { grid-template-columns: var(--sidebar) minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .cards.three { grid-template-columns: repeat(2, 1fr); }
  .compare { grid-template-columns: 1fr; }
  .flow { grid-template-columns: 1fr; }
  .strip-grid { grid-template-columns: repeat(2, 1fr); }
  .strip-grid > div:nth-child(2) { border-right: 0; }
  .strip-grid > div:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
}
@media (max-width: 860px) {
  .prose table { display: block; overflow-x: auto; }
  .topnav, .search-trigger span, .search-trigger kbd { display: none; }
  .search-trigger { min-width: 0; width: 38px; padding: 0; justify-content: center; border-color: transparent; background: none; }
  .nav-open { display: inline-grid; }
  .docs-layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0 16px; }
  .sidebar {
    position: fixed; z-index: 60; top: 0; left: 0; bottom: 0; width: min(86vw, 320px); height: auto;
    background: var(--bg); border-right: 1px solid var(--border); transform: translateX(-100%);
    transition: transform .25s var(--ease); visibility: hidden;
  }
  .sidebar-scroll { padding: 22px 16px 40px; }
  body.nav-is-open .sidebar { transform: none; visibility: visible; }
  body.nav-is-open .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(5, 6, 12, .55); }
  .content { padding-top: 28px; }
  .pager { grid-template-columns: 1fr; }
  .pager-link.next { grid-column: 1; }
  .footer-inner { flex-direction: column; }
  .search-panel { margin: 0; border-radius: 0; min-height: 100%; }
}
@media (max-width: 560px) {
  body { font-size: 15.5px; }
  .topbar-inner { padding: 0 10px; gap: 6px; }
  .icon-btn { width: 42px; height: 42px; }
  .brand-name { font-size: 1.02rem; }
  .hero h1 { font-size: clamp(1.8rem, 7.4vw, 2.2rem); }
  .lead { font-size: 1rem; }
  .pill { font-size: .74rem; padding: 5px 11px; }
  .hero-actions .btn { flex: 1 1 auto; justify-content: center; }
  .highlight pre { font-size: .78rem; padding: 14px 14px; border-radius: 10px; }
  .window .highlight pre { font-size: .74rem; padding: 14px; }
  .prose h1 { font-size: 1.85rem; }
  .prose h2 { font-size: 1.32rem; margin-top: 40px; }
  .prose h3 { font-size: 1.1rem; }
  .prose .headerlink { display: none; }
  .prose th, .prose td { padding: 9px 11px; }
  .nav-group a { padding: 10px 12px; }
  .tabbed-labels > label { padding: 11px 16px; }
  .footer nav a { padding: 6px 0; }
  .admonition { padding: 12px 14px; }
  .install { font-size: .82rem; gap: 8px; padding-left: 12px; }
  .install code { white-space: nowrap; overflow-x: auto; scrollbar-width: none; }
  .strip strong { font-size: 1.5rem; }
  .strip-grid > div { padding: 20px 14px; }
  .brand-version { display: none; }
  .hero { padding: 56px 0 48px; }
  .container { padding: 0 16px; }
  .cards, .cards.three { grid-template-columns: 1fr; }
  .section { padding: 64px 0; }
  .install { width: 100%; }
  .install code { flex: 1; }
  .steps li { padding: 18px 16px 18px 60px; }
  .steps li::before { left: 16px; }
}
@media (max-width: 380px) {
  .brand img { width: 26px; height: 26px; }
  .brand-name { font-size: .95rem; }
  .icon-btn { width: 38px; height: 38px; }
  .strip-grid { grid-template-columns: 1fr; }
  .strip-grid > div { border-right: 0; border-bottom: 1px solid var(--border); }
  .steps li { padding: 54px 14px 16px; }
  .steps li::before { top: 14px; left: 14px; }
}
/* Larger touch targets wherever the pointer is a finger. */
@media (pointer: coarse) {
  .toc a { padding-top: 8px; padding-bottom: 8px; }
  .search-results a { padding: 12px; }
  .copy-btn { opacity: 1; padding: 5px 11px; top: 8px; right: 8px; }
  .highlight:has(> .copy-btn) pre { padding-top: 42px; }
  .window .copy-btn { display: none; }
  .window .highlight:has(> .copy-btn) pre { padding-top: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .topbar, .sidebar, .toc, .pager, .footer, .copy-btn, .edit-note { display: none !important; }
  .docs-layout { display: block; }
}
