/* ==========================================================================
   Vela website — shared stylesheet for the landing page and documentation.
   Flat Material 3 design: tonal surfaces instead of shadows, rounded shapes,
   state layers on hover. Palette derived from the Vela blue (#3653d3).
   Themes: [data-theme="light"|"dark"] on <html>, set by theme-init.js.
   ========================================================================== */

/* ---------- Tokens ---------- */

:root {
  --font-sans: "Ubuntu Sans", Ubuntu, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --header-h: 64px;
  /* Material shape scale */
  --shape-xs: 4px;
  --shape-sm: 8px;
  --shape-md: 12px;
  --shape-lg: 16px;
  --shape-xl: 28px;
  --shape-full: 999px;
  --maxw: 1240px;

  /* Light scheme */
  --primary: #4054c6;
  --on-primary: #ffffff;
  --primary-container: #dee1ff;
  --on-primary-container: #00115a;
  --secondary-container: #e0e1f9;
  --on-secondary-container: #181a2c;
  --tertiary: #006a63;
  --tertiary-container: #c9efe9;
  --on-tertiary-container: #00201d;
  --warn: #7c5800;
  --warn-container: #ffe3b3;
  --on-warn-container: #271900;
  --error: #ba1a1a;
  --error-container: #ffdad6;
  --on-error-container: #410002;

  --surface: #fbf8ff;
  --surface-lowest: #ffffff;
  --surface-low: #f5f2fb;
  --surface-mid: #efedf6;
  --surface-high: #e9e7f0;
  --surface-highest: #e3e1ea;
  --on-surface: #1b1b21;
  --on-surface-variant: #46464f;
  --outline: #767680;
  --outline-variant: #c6c5d0;
  --scrim: rgba(0, 0, 0, 0.32);
  --star: #b9821c;

  /* State layers */
  --hover: color-mix(in srgb, var(--on-surface) 8%, transparent);
  --pressed: color-mix(in srgb, var(--on-surface) 12%, transparent);
  --grid-line: color-mix(in srgb, var(--primary) 6%, transparent);

  /* Code */
  --code-bg: #f1eff8;
  --code-head: #e9e7f0;
  --code-text: #1b1b21;
  --code-muted: #5d5e6c;
  --tok-comment: #6f7080;
  --tok-string: #1b6b3d;
  --tok-keyword: #4054c6;
  --tok-command: #8a4b00;
  --tok-flag: #00695f;
  --tok-number: #a33f00;
  --tok-key: #4054c6;
  --tok-var: #8b3a97;
  --tok-punct: #5d5e6c;
  --tok-prompt: #9a9aa6;
  --tok-err: #ba1a1a;

  color-scheme: light;
}

[data-theme="dark"] {
  /* Soft dark scheme: no pure black, desaturated accents, off-white text */
  --primary: #b9c3ff;
  --on-primary: #18287a;
  --primary-container: #303f8f;
  --on-primary-container: #dee1ff;
  --secondary-container: #3b3e52;
  --on-secondary-container: #e0e1f9;
  --tertiary: #8fd0c7;
  --tertiary-container: #1f4c47;
  --on-tertiary-container: #c9efe9;
  --warn: #e6c27a;
  --warn-container: #4d3b12;
  --on-warn-container: #ffe3b3;
  --error: #f2b8b5;
  --error-container: #5c2b29;
  --on-error-container: #ffdad6;

  --surface: #16161b;
  --surface-lowest: #111116;
  --surface-low: #1c1c22;
  --surface-mid: #202027;
  --surface-high: #2a2a31;
  --surface-highest: #34343b;
  --on-surface: #e3e1e9;
  --on-surface-variant: #c3c2cd;
  --outline: #8e8e99;
  --outline-variant: #44444d;
  --scrim: rgba(0, 0, 0, 0.5);
  --star: #e2c27f;
  --grid-line: color-mix(in srgb, var(--primary) 4%, transparent);

  --code-bg: #1c1c22;
  --code-head: #24242b;
  --code-text: #dcdae3;
  --code-muted: #9a99a5;
  --tok-comment: #85848f;
  --tok-string: #a8d5ad;
  --tok-keyword: #b3bdf5;
  --tok-command: #e8c48c;
  --tok-flag: #92cdc5;
  --tok-number: #e9b597;
  --tok-key: #b3bdf5;
  --tok-var: #dab6e3;
  --tok-punct: #a09faa;
  --tok-prompt: #6f6e79;
  --tok-err: #f2b8b5;

  color-scheme: dark;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 24px);
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--on-surface);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
::selection { background: color-mix(in srgb, var(--primary) 30%, transparent); }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--shape-xs);
}

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

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

/* Faint drafting grid — a flat nod to the blueprint motif. */
.bp-grid {
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: -1px -1px;
}

.mono-label {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
}

/* ---------- Icons ---------- */

.i { width: 20px; height: 20px; flex: none; }
.i-sm { width: 16px; height: 16px; }
.i-lg { width: 24px; height: 24px; }

/* ---------- Top app bar ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--outline-variant);
}

.site-header .bar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 16px 0 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--on-surface);
  font-weight: 600;
  font-size: 20px;
}
.brand:hover { color: var(--on-surface); text-decoration: none; }
.brand .mark { width: 32px; height: 32px; border-radius: var(--shape-sm); }
.brand .tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--on-secondary-container);
  background: var(--secondary-container);
  padding: 2px 8px;
  border-radius: var(--shape-sm);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 20px;
}
.header-nav a {
  color: var(--on-surface-variant);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 8px 14px;
  border-radius: var(--shape-full);
  transition: background .15s, color .15s;
}
.header-nav a:hover { color: var(--on-surface); background: var(--hover); text-decoration: none; }
.header-nav a[aria-current="page"] { color: var(--on-secondary-container); background: var(--secondary-container); }

.header-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

/* Search bar */
.search-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: 260px;
  height: 44px;
  padding: 0 12px 0 16px;
  color: var(--on-surface-variant);
  background: var(--surface-high);
  border: 0;
  border-radius: var(--shape-full);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  transition: background .15s;
}
.search-btn:hover { background: var(--surface-highest); }
.search-btn .label { white-space: nowrap; }
.search-btn .kbd-hint { margin-left: auto; display: flex; gap: 4px; }

kbd, .kbd {
  display: inline-block;
  min-width: 22px;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 18px;
  text-align: center;
  color: var(--on-surface-variant);
  background: transparent;
  border: 1px solid var(--outline-variant);
  border-radius: var(--shape-xs);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--on-surface-variant);
  background: transparent;
  border: 0;
  border-radius: var(--shape-full);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-btn:hover { color: var(--on-surface); background: var(--hover); text-decoration: none; }
.icon-btn:active { background: var(--pressed); }

.theme-btn { position: relative; }
.theme-btn .theme-label {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  white-space: nowrap;
  font-size: 12px;
  color: var(--surface);
  background: var(--on-surface);
  border-radius: var(--shape-xs);
  padding: 4px 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
}
.theme-btn:hover .theme-label, .theme-btn:focus-visible .theme-label { opacity: 1; }

.menu-btn { display: none; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 24px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.01em;
  border-radius: var(--shape-full);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { color: var(--on-primary); background: var(--primary); }
.btn-primary:hover { color: var(--on-primary); background: color-mix(in srgb, var(--primary) 90%, var(--on-primary)); }
.btn-ghost { color: var(--primary); background: transparent; border-color: var(--outline); }
.btn-ghost:hover { color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, transparent); }
.btn-sm { height: 36px; padding: 0 16px; font-size: 14px; }

/* ---------- Footer ---------- */

.site-footer {
  background: var(--surface-low);
  color: var(--on-surface-variant);
  font-size: 14px;
}
.site-footer .cols {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, minmax(0, 1fr));
  gap: 32px;
  padding: 56px 0 40px;
}
.site-footer h4 {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
}
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.site-footer a { color: var(--on-surface); }
.site-footer a:hover { color: var(--primary); }
.site-footer .about p { max-width: 34ch; margin: 14px 0 0; }
.site-footer .legal {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 20px 0 28px;
  border-top: 1px solid var(--outline-variant);
  font-size: 12px;
  color: var(--on-surface-variant);
}

/* ==========================================================================
   Landing page
   ========================================================================== */

.hero {
  position: relative;
  overflow: hidden;
  background-color: var(--surface);
}
.hero .container {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 56px;
  align-items: center;
  padding-top: 88px;
  padding-bottom: 104px;
}

.constellation {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: var(--primary);
  pointer-events: none;
  z-index: 0;
}
.constellation line { stroke: currentColor; stroke-opacity: .25; stroke-width: 1; stroke-dasharray: 2 6; }
.constellation .star { fill: var(--star); }
.constellation .star-halo { display: none; }
.constellation text {
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: .1em;
  fill: var(--on-surface-variant);
  opacity: .7;
}
@media (prefers-reduced-motion: no-preference) {
  .constellation .twinkle { animation: twinkle 5s ease-in-out infinite; }
  .constellation .twinkle:nth-of-type(2n) { animation-delay: -1.6s; }
  .constellation .twinkle:nth-of-type(3n) { animation-delay: -3.2s; }
}
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 5px 14px 5px 6px;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 500;
  color: var(--on-surface);
  background: var(--surface-low);
  border: 1px solid var(--outline-variant);
  border-radius: var(--shape-sm);
  transition: background .15s;
}
.eyebrow .pill {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--on-primary-container);
  background: var(--primary-container);
  padding: 3px 8px;
  border-radius: var(--shape-xs);
}
.eyebrow:hover { color: var(--on-surface); background: var(--surface-mid); text-decoration: none; }

.hero h1 {
  margin: 24px 0 20px;
  font-size: clamp(40px, 5.4vw, 64px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  font-weight: 500;
}
.hero h1 .accent { color: var(--primary); }
.hero .lead {
  max-width: 54ch;
  margin: 0 0 32px;
  font-size: 19px;
  line-height: 1.6;
  color: var(--on-surface-variant);
}
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 28px; }

.install {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 520px;
  padding: 6px 6px 6px 18px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: var(--on-surface);
  background: var(--surface-mid);
  border-radius: var(--shape-md);
}
.install .prompt { color: var(--primary); user-select: none; }
.install code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.install code::-webkit-scrollbar { display: none; }

.copy-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--on-surface-variant);
  background: transparent;
  border: 0;
  border-radius: var(--shape-full);
  cursor: pointer;
  flex: none;
  transition: color .15s, background .15s;
}
.copy-btn:hover { color: var(--on-surface); background: var(--hover); }
.copy-btn.copied { color: var(--tertiary); }

/* Terminal mock-up: always a dark, low-contrast surface */
.terminal {
  --code-text: #dcdae3;
  --code-muted: #9a99a5;
  --tok-comment: #85848f;
  --tok-string: #a8d5ad;
  --tok-keyword: #b3bdf5;
  --tok-command: #e8c48c;
  --tok-flag: #92cdc5;
  --tok-number: #e9b597;
  --tok-key: #b3bdf5;
  --tok-var: #dab6e3;
  --tok-punct: #a09faa;
  --tok-prompt: #6f6e79;
  position: relative;
  background: #25252c;
  border-radius: var(--shape-lg);
  overflow: hidden;
  color: var(--code-text);
}
[data-theme="dark"] .terminal { background: var(--surface-mid); }
.terminal .titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  background: rgba(255, 255, 255, .04);
}
.terminal .dot { width: 10px; height: 10px; border-radius: 50%; background: #55545e; }
.terminal .titlebar .title {
  margin-left: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--code-muted);
}
.terminal .screen {
  min-height: 360px;
  padding: 18px 20px 22px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.75;
  white-space: pre;
  overflow-x: auto;
}
.terminal .line { display: block; min-height: 1.75em; }
.terminal .ps { color: var(--tok-prompt); user-select: none; }
.terminal .cmd { color: var(--code-text); }
.terminal .out { color: var(--code-muted); }
.terminal .ok { color: var(--tok-string); }
.terminal .url { color: var(--tok-flag); }
.terminal .hl { color: var(--tok-command); }
.terminal .caret {
  display: inline-block;
  width: 8px;
  height: 1.1em;
  vertical-align: -0.15em;
  background: var(--tok-keyword);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-figure { position: relative; }
.hero-figure .annot {
  position: absolute;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
}
.hero-figure .annot.top { top: -26px; left: 4px; }
.hero-figure .annot.side, .hero-figure .dim { display: none; }

/* Sections */
.section { padding: 96px 0; position: relative; }
.section.alt { background-color: var(--surface-low); }
.section-head { max-width: 760px; margin-bottom: 48px; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.section-head .mono-label { color: var(--primary); }
.section-head h2 {
  margin: 12px 0 14px;
  font-size: clamp(30px, 3.4vw, 42px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  font-weight: 500;
}
.section-head p { margin: 0; font-size: 18px; color: var(--on-surface-variant); }

/* Visibility cards */
.vis-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.vis-card {
  position: relative;
  padding: 28px;
  background: var(--surface-low);
  border-radius: var(--shape-lg);
}
.vis-card .badge-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.vis-card h3 { margin: 0 0 8px; font-size: 22px; font-weight: 500; }
.vis-card p { margin: 0 0 20px; color: var(--on-surface-variant); font-size: 15px; }
.vis-card ul { list-style: none; margin: 0; padding: 16px 0 0; border-top: 1px solid var(--outline-variant); display: grid; gap: 10px; font-size: 14px; }
.vis-card li { display: flex; align-items: center; gap: 10px; color: var(--on-surface); }
.vis-card li .yes { color: var(--tertiary); font-weight: 700; }
.vis-card li .no { color: var(--outline); }
.vis-card .fig { font-size: 11px; font-weight: 600; letter-spacing: .08em; color: var(--on-surface-variant); }

/* Chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--shape-sm);
  white-space: nowrap;
  vertical-align: middle;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.public { color: var(--on-tertiary-container); background: var(--tertiary-container); }
.chip.unlisted { color: var(--on-warn-container); background: var(--warn-container); }
.chip.private { color: var(--on-primary-container); background: var(--primary-container); }
.chip.plain::before { display: none; }

/* Feature grid: separate tonal cards */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.feature {
  position: relative;
  padding: 28px 26px 30px;
  background: var(--surface);
  border-radius: var(--shape-lg);
  transition: background .2s;
}
.feature:hover { background: var(--surface-lowest); }
[data-theme="dark"] .feature:hover { background: var(--surface-mid); }
.feature .ic {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 20px;
  color: var(--on-primary-container);
  background: var(--primary-container);
  border-radius: var(--shape-lg);
}
.feature h3 { margin: 0 0 8px; font-size: 18px; font-weight: 500; }
.feature p { margin: 0; color: var(--on-surface-variant); font-size: 15px; line-height: 1.6; }
.feature .no { position: absolute; top: 20px; right: 22px; font-size: 12px; font-weight: 600; color: var(--outline); }
.feature a.more { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; font-size: 14px; font-weight: 500; }

/* Figure frame (flat tonal surface) */
.bp-frame {
  position: relative;
  padding: 32px;
  background-color: var(--surface-low);
  border-radius: var(--shape-lg);
}
.bp-frame > .crop { display: none; }
.bp-frame .fig-caption {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--outline-variant);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
}

.diagram { width: 100%; height: auto; color: var(--on-surface); }
.diagram .box { fill: var(--surface); stroke: var(--outline-variant); stroke-width: 1; }
.diagram .box.brand { fill: var(--primary-container); stroke: none; }
.diagram .box.dashed { stroke-dasharray: 5 4; stroke: var(--outline); fill: transparent; }
.diagram .box.store { fill: var(--surface-high); stroke: none; }
.diagram .t { font-family: var(--font-sans); font-size: 15px; font-weight: 600; fill: var(--on-surface); }
.diagram .s { font-family: var(--font-mono); font-size: 11px; fill: var(--on-surface-variant); }
.diagram .lbl { font-family: var(--font-sans); font-size: 11px; font-weight: 600; letter-spacing: .06em; fill: var(--on-surface-variant); }
.diagram .lbl.brand { fill: var(--primary); }
.diagram .wire { stroke: var(--primary); stroke-width: 1.5; fill: none; }
.diagram .wire.muted { stroke: var(--outline); }
.diagram .wire.dash { stroke-dasharray: 5 5; }
.diagram .arrow { fill: var(--primary); }
.diagram .arrow.muted { fill: var(--outline); }
.diagram .dim { stroke: var(--outline); stroke-width: 1; }
.diagram .gold { fill: var(--star); }
@media (prefers-reduced-motion: no-preference) {
  .diagram .flow { stroke-dasharray: 6 8; animation: flow 1.6s linear infinite; }
}
@keyframes flow { to { stroke-dashoffset: -28; } }

/* Code showcase with tabs (navigation-rail style) */
.showcase {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.showcase-tabs { display: grid; gap: 4px; }
.showcase-tab {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 16px;
  align-items: center;
  width: 100%;
  padding: 14px 20px;
  text-align: left;
  font: inherit;
  color: var(--on-surface-variant);
  background: transparent;
  border: 0;
  border-radius: var(--shape-lg);
  cursor: pointer;
  transition: background .15s;
}
.showcase-tab .n { grid-row: span 2; font-size: 13px; font-weight: 600; color: var(--outline); }
.showcase-tab strong { font-size: 16px; font-weight: 500; color: var(--on-surface); }
.showcase-tab span.d { font-size: 14px; color: var(--on-surface-variant); }
.showcase-tab:hover { background: var(--hover); }
.showcase-tab[aria-selected="true"] { background: var(--secondary-container); }
.showcase-tab[aria-selected="true"] strong, .showcase-tab[aria-selected="true"] .n { color: var(--on-secondary-container); }
.showcase-panel[hidden] { display: none; }
.section.alt .showcase .code-block { background: var(--surface); }
.section.alt .showcase .code-block .code-head { background: var(--surface-mid); }

/* Scenario cards */
.scenarios { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.scenario {
  display: flex;
  flex-direction: column;
  padding: 28px;
  background: var(--surface-low);
  border-radius: var(--shape-lg);
  color: var(--on-surface);
  transition: background .2s;
}
.scenario:hover { color: var(--on-surface); background: var(--surface-mid); text-decoration: none; }
.scenario .top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.scenario h3 { margin: 0 0 8px; font-size: 20px; font-weight: 500; }
.scenario p { margin: 0 0 20px; color: var(--on-surface-variant); font-size: 15px; flex: 1; }
.scenario .path {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--on-surface-variant);
  padding: 12px 14px;
  background: var(--surface-high);
  border-radius: var(--shape-sm);
}
.scenario .path div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scenario .path b { color: var(--primary); font-weight: 500; }
.recommended {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--on-tertiary-container);
  background: var(--tertiary-container);
  padding: 4px 10px;
  border-radius: var(--shape-sm);
}

/* Security principles */
.principles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.principle {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 16px;
  padding: 24px;
  background: var(--surface);
  border-radius: var(--shape-lg);
}
.principle .n {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  font-size: 13px;
  font-weight: 600;
  color: var(--on-secondary-container);
  background: var(--secondary-container);
  border-radius: var(--shape-full);
}
.principle h3 { margin: 0 0 6px; font-size: 17px; font-weight: 500; }
.principle p { margin: 0; font-size: 15px; color: var(--on-surface-variant); }

/* Call to action: flat tonal banner */
.cta {
  position: relative;
  overflow: hidden;
  padding: 56px;
  border-radius: var(--shape-xl);
  color: var(--on-primary-container);
  background: var(--primary-container);
}
.cta .bp-grid-dark { display: none; }
.cta-inner { position: relative; display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: center; }
.cta h2 { margin: 0 0 12px; font-size: clamp(28px, 3.2vw, 38px); line-height: 1.15; font-weight: 500; color: var(--on-primary-container); }
.cta p { margin: 0; color: var(--on-primary-container); opacity: .85; font-size: 17px; }
.cta code { font-size: .92em; padding: 1px 6px; border-radius: var(--shape-xs); background: color-mix(in srgb, var(--on-primary-container) 10%, transparent); }
.cta .actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; }
.cta .btn-ghost { color: var(--on-primary-container); border-color: color-mix(in srgb, var(--on-primary-container) 45%, transparent); }
.cta .btn-ghost:hover { color: var(--on-primary-container); background: color-mix(in srgb, var(--on-primary-container) 8%, transparent); }

/* Facts strip */
.facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.fact { padding: 22px 24px; background: var(--surface-low); border-radius: var(--shape-lg); }
.fact .v { font-size: 28px; font-weight: 500; color: var(--primary); }
.fact .k { font-size: 14px; color: var(--on-surface-variant); }

/* ==========================================================================
   Documentation layout
   ========================================================================== */

.docs-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 240px;
  max-width: 1440px;
  margin: 0 auto;
}

/* Navigation drawer */
.docs-sidebar {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 20px 12px 48px;
  background: var(--surface);
  scrollbar-width: thin;
  scrollbar-color: var(--outline-variant) transparent;
}

.nav-version {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 4px 20px;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--on-surface-variant);
  background: var(--surface-low);
  border-radius: var(--shape-md);
}
.nav-version strong { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--primary); }

.nav-group { margin-bottom: 16px; }
.nav-group h5 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 10px 16px 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--on-surface);
}
.nav-group h5 .ic { display: grid; place-items: center; color: var(--on-surface-variant); }
.nav-group ul { list-style: none; margin: 0; padding: 0; }
.nav-group li a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px 0 42px;
  font-size: 14px;
  font-weight: 500;
  color: var(--on-surface-variant);
  border-radius: var(--shape-full);
  transition: background .12s, color .12s;
}
.nav-group li a:hover { color: var(--on-surface); background: var(--hover); text-decoration: none; }
.nav-group li a[aria-current="page"] {
  color: var(--on-secondary-container);
  background: var(--secondary-container);
  font-weight: 600;
}

.docs-main {
  position: relative;
  min-width: 0;
  padding: 40px 56px 96px;
}
.docs-article { position: relative; max-width: 800px; }

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--on-surface-variant);
}
.breadcrumbs a { color: var(--primary); }
.breadcrumbs .sep { color: var(--outline); }

.docs-toc {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 40px 24px 40px 8px;
  font-size: 14px;
}
.docs-toc h6 {
  margin: 0 0 12px;
  padding-left: 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
}
.docs-toc ul { list-style: none; margin: 0; padding: 0; }
.docs-toc li a {
  display: block;
  padding: 6px 12px 6px 16px;
  color: var(--on-surface-variant);
  border-radius: var(--shape-full);
  line-height: 1.4;
}
.docs-toc li.l3 a { padding-left: 30px; font-size: 13px; }
.docs-toc li a:hover { color: var(--on-surface); background: var(--hover); text-decoration: none; }
.docs-toc li a.active { color: var(--on-secondary-container); background: var(--secondary-container); font-weight: 500; }
.docs-toc .toc-extra {
  margin-top: 20px;
  padding: 16px 0 0 16px;
  border-top: 1px solid var(--outline-variant);
  display: grid;
  gap: 10px;
}
.docs-toc .toc-extra a { display: inline-flex; align-items: center; gap: 8px; color: var(--on-surface-variant); font-size: 13px; }
.docs-toc .toc-extra a:hover { color: var(--primary); }

/* ---------- Article typography ---------- */

.prose { color: var(--on-surface); font-size: 16px; line-height: 1.75; }
.prose > :first-child { margin-top: 0; }

.prose h1 {
  margin: 0 0 12px;
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--on-surface);
  font-weight: 500;
}
.prose .lede { margin: 0 0 36px; font-size: 19px; line-height: 1.6; color: var(--on-surface-variant); }

.prose h2 {
  position: relative;
  margin: 56px 0 16px;
  font-size: 28px;
  line-height: 1.3;
  color: var(--on-surface);
  font-weight: 500;
}
.prose h3 {
  position: relative;
  margin: 36px 0 12px;
  font-size: 21px;
  line-height: 1.35;
  color: var(--on-surface);
  font-weight: 500;
}
.prose h4 { margin: 28px 0 10px; font-size: 16px; color: var(--on-surface); font-weight: 600; }
.prose h2 code, .prose h3 code, .prose h4 code { font-size: .86em; }

.prose .anchor {
  position: absolute;
  left: -1.1em;
  padding-right: .3em;
  color: var(--primary);
  opacity: 0;
  font-weight: 400;
  transition: opacity .12s;
}
.prose h2:hover .anchor, .prose h3:hover .anchor, .prose .anchor:focus { opacity: 1; text-decoration: none; }

.prose p { margin: 0 0 18px; }
.prose strong { font-weight: 600; }
.prose a { color: var(--primary); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--primary) 40%, transparent); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--primary); }
.prose ul, .prose ol { margin: 0 0 20px; padding-left: 1.4em; }
.prose li { margin: 6px 0; padding-left: 4px; }
.prose li::marker { color: var(--on-surface-variant); }
.prose hr { border: 0; border-top: 1px solid var(--outline-variant); margin: 40px 0; }

.prose :not(pre) > code {
  padding: 2px 6px;
  font-size: .86em;
  color: var(--on-surface);
  background: var(--surface-high);
  border-radius: var(--shape-xs);
  overflow-wrap: anywhere;
}
.prose a code { color: inherit; }

/* ---------- Code blocks ---------- */

.code-block {
  position: relative;
  margin: 20px 0 26px;
  background: var(--code-bg);
  border-radius: var(--shape-md);
  overflow: hidden;
}
.code-block .code-head {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 6px 0 16px;
  background: var(--code-head);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--code-muted);
}
.code-block .code-head .file { color: var(--code-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-block .code-head .lang {
  margin-left: auto;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--code-muted);
}
.code-block .copy-btn { color: var(--code-muted); width: 32px; height: 32px; }
.code-block .copy-btn:hover { color: var(--code-text); background: var(--hover); }
.code-block .copy-btn.copied { color: var(--tok-string); }
.code-block pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--code-text);
  tab-size: 4;
  scrollbar-width: thin;
  scrollbar-color: var(--outline-variant) transparent;
}
.code-block pre code { font-family: inherit; }
.code-block.no-head .copy-btn { position: absolute; top: 6px; right: 6px; opacity: 0; transition: opacity .15s; }
.code-block.no-head:hover .copy-btn, .code-block.no-head .copy-btn:focus-visible { opacity: 1; }

.tok-comment { color: var(--tok-comment); font-style: italic; }
.tok-string { color: var(--tok-string); }
.tok-keyword { color: var(--tok-keyword); }
.tok-command { color: var(--tok-command); }
.tok-flag { color: var(--tok-flag); }
.tok-number { color: var(--tok-number); }
.tok-key { color: var(--tok-key); }
.tok-var { color: var(--tok-var); }
.tok-punct { color: var(--tok-punct); }
.tok-prompt { color: var(--tok-prompt); user-select: none; }
.tok-out { color: var(--code-muted); }
.tok-type { color: var(--tok-flag); }
.tok-func { color: var(--tok-command); }
.tok-status { color: var(--tok-string); font-weight: 600; }
.tok-err { color: var(--tok-err); }

/* Tabs (code groups): Material secondary tabs */
.tabs { margin: 20px 0 26px; }
.tabs .tab-bar {
  display: flex;
  overflow-x: auto;
  background: var(--code-head);
  border-radius: var(--shape-md) var(--shape-md) 0 0;
  border-bottom: 1px solid var(--outline-variant);
}
.tabs .tab-bar button {
  position: relative;
  padding: 11px 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--on-surface-variant);
  background: transparent;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
}
.tabs .tab-bar button:hover { color: var(--on-surface); background: var(--hover); }
.tabs .tab-bar button[aria-selected="true"] { color: var(--primary); }
.tabs .tab-bar button[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: -1px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--primary);
}
.tabs .tab-panel[hidden] { display: none; }
.tabs .tab-panel .code-block { margin: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
.tabs .tab-panel > :not(.code-block) { margin-top: 14px; }

/* Callouts: tonal containers */
.callout {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 14px;
  margin: 24px 0;
  padding: 16px 20px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--on-primary-container);
  background: color-mix(in srgb, var(--primary-container) 70%, var(--surface));
  border-radius: var(--shape-md);
}
.callout .ci { display: grid; place-items: start center; padding-top: 1px; color: var(--primary); }
.callout > div > :last-child { margin-bottom: 0; }
.callout p { margin: 0 0 10px; }
.callout .ct { display: block; margin-bottom: 2px; font-weight: 600; }
.callout a { color: inherit; }
.callout :not(pre) > code { background: color-mix(in srgb, currentColor 10%, transparent); color: inherit; }
.callout.tip { color: var(--on-tertiary-container); background: color-mix(in srgb, var(--tertiary-container) 75%, var(--surface)); }
.callout.tip .ci { color: var(--tertiary); }
.callout.warning { color: var(--on-warn-container); background: color-mix(in srgb, var(--warn-container) 75%, var(--surface)); }
.callout.warning .ci { color: var(--warn); }
.callout.danger { color: var(--on-error-container); background: color-mix(in srgb, var(--error-container) 75%, var(--surface)); }
.callout.danger .ci { color: var(--error); }

/* Tables */
.table-wrap {
  margin: 20px 0 28px;
  overflow-x: auto;
  border: 1px solid var(--outline-variant);
  border-radius: var(--shape-md);
}
.prose table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.55; }
.prose th {
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--on-surface-variant);
  background: var(--surface-low);
  border-bottom: 1px solid var(--outline-variant);
  white-space: nowrap;
}
.prose td { padding: 12px 16px; border-bottom: 1px solid var(--outline-variant); vertical-align: top; }
.prose tr:last-child td { border-bottom: 0; }
.prose tbody tr:hover td { background: color-mix(in srgb, var(--on-surface) 3%, transparent); }
.prose td code { white-space: nowrap; }
.prose td.wrap code { white-space: normal; }

/* Steps */
.steps { counter-reset: step; margin: 28px 0; padding: 0; list-style: none; }
.steps > li {
  position: relative;
  margin: 0;
  padding: 0 0 28px 56px;
  counter-increment: step;
}
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  font-size: 14px;
  font-weight: 600;
  color: var(--on-primary-container);
  background: var(--primary-container);
  border-radius: 50%;
  z-index: 1;
}
.steps > li::after {
  content: "";
  position: absolute;
  left: 17.5px;
  top: 44px;
  bottom: 8px;
  width: 1px;
  background: var(--outline-variant);
}
.steps > li:last-child::after { display: none; }
.steps > li > h4, .steps > li > strong:first-child { display: block; margin: 6px 0 8px; font-size: 17px; font-weight: 500; }
.steps > li > :last-child { margin-bottom: 0; }

/* Reference lists (flags, fields, parameters) */
.ref { margin: 20px 0 28px; border-top: 1px solid var(--outline-variant); }
.ref-item { padding: 14px 0; border-bottom: 1px solid var(--outline-variant); }
.ref-item .sig { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-bottom: 4px; }
.ref-item .sig code.name { font-size: 14px; font-weight: 600; color: var(--primary); background: none; padding: 0; }
.ref-item .sig .type { font-family: var(--font-mono); font-size: 12px; color: var(--on-surface-variant); }
.ref-item .sig .default { font-size: 13px; color: var(--on-surface-variant); }
.ref-item .sig .default b { font-family: var(--font-mono); font-size: 12.5px; color: var(--on-surface); font-weight: 500; }
.ref-item .sig .req { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--on-error-container); background: var(--error-container); padding: 1px 8px; border-radius: var(--shape-xs); }
.ref-item p { margin: 0; font-size: 15px; color: var(--on-surface-variant); }
.ref-item p + p { margin-top: 6px; }

/* Badges: HTTP methods and scopes */
.method {
  display: inline-block;
  min-width: 60px;
  padding: 3px 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
  border-radius: var(--shape-sm);
  color: var(--on-tertiary-container);
  background: var(--tertiary-container);
}
.method.post { color: var(--on-primary-container); background: var(--primary-container); }
.method.put { color: var(--on-warn-container); background: var(--warn-container); }
.method.patch { color: var(--on-secondary-container); background: var(--secondary-container); }
.method.delete { color: var(--on-error-container); background: var(--error-container); }

.scope {
  display: inline-block;
  padding: 1px 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--shape-sm);
  border: 1px solid var(--outline-variant);
  color: var(--on-surface-variant);
}
.scope.ro { color: var(--tertiary); border-color: color-mix(in srgb, var(--tertiary) 45%, transparent); }
.scope.rw { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.scope.admin { color: var(--error); border-color: color-mix(in srgb, var(--error) 45%, transparent); }

.endpoint {
  margin: 32px 0 14px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--surface-low);
  border-radius: var(--shape-md);
}
.endpoint code.path { font-size: 14px; color: var(--on-surface); background: none; padding: 0; overflow-wrap: anywhere; }
.endpoint .scope { margin-left: auto; }

/* Cards inside docs */
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 24px 0 32px; }
.card-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.doc-card {
  display: block;
  padding: 18px 20px;
  color: var(--on-surface-variant);
  background: var(--surface-low);
  border-radius: var(--shape-md);
  text-decoration: none !important;
  transition: background .15s;
}
.doc-card:hover { background: var(--surface-mid); color: var(--on-surface-variant); }
.doc-card .t { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font-weight: 500; color: var(--on-surface); font-size: 16px; }
.doc-card p { margin: 0; font-size: 14px; line-height: 1.55; }

/* Figures inside docs */
.prose figure { margin: 28px 0; }
.prose figure.bp-frame { padding: 20px 24px; }
.prose figure.bp-frame .code-block { background: transparent; margin: 0; }
.prose figcaption { font-size: 12px; color: var(--on-surface-variant); }

/* Pager */
.pager {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-top: 64px;
}
.pager a {
  display: block;
  padding: 16px 20px;
  background: transparent;
  border: 1px solid var(--outline-variant);
  border-radius: var(--shape-md);
  color: var(--on-surface);
  font-weight: 500;
  transition: background .15s;
}
.pager a:hover { background: var(--hover); color: var(--on-surface); text-decoration: none; }
.pager a span { display: block; margin-bottom: 2px; font-size: 12px; font-weight: 500; color: var(--on-surface-variant); }
.pager a.next { text-align: right; grid-column: 2; }

.page-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
  font-size: 13px;
  color: var(--on-surface-variant);
}

/* ---------- Search dialog ---------- */

.search-dialog {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 16px;
  background: var(--scrim);
}
.search-dialog.open { display: flex; }
.search-panel {
  width: 100%;
  max-width: 640px;
  max-height: 72vh;
  display: flex;
  flex-direction: column;
  background: var(--surface-high);
  border-radius: var(--shape-xl);
  overflow: hidden;
}
.search-input-row { display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid var(--outline-variant); color: var(--on-surface-variant); }
.search-input-row input {
  flex: 1;
  height: 60px;
  font: inherit;
  font-size: 17px;
  color: var(--on-surface);
  background: transparent;
  border: 0;
  outline: none;
}
.search-results { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.search-results li a {
  display: block;
  padding: 10px 14px;
  border-radius: var(--shape-lg);
  color: var(--on-surface-variant);
}
.search-results li a:hover { text-decoration: none; }
.search-results li a .rt { display: block; font-weight: 500; color: var(--on-surface); font-size: 15px; }
.search-results li a .rp { display: block; font-size: 12px; color: var(--on-surface-variant); margin-bottom: 2px; }
.search-results li a .rs { display: block; font-size: 13px; color: var(--on-surface-variant); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-results li a mark { background: color-mix(in srgb, var(--primary) 25%, transparent); color: inherit; border-radius: 2px; }
.search-results li a.sel, .search-results li a:hover { background: var(--secondary-container); }
.search-empty { padding: 28px 16px; text-align: center; color: var(--on-surface-variant); font-size: 14px; }
.search-foot { display: flex; gap: 16px; padding: 12px 20px; border-top: 1px solid var(--outline-variant); font-size: 12px; color: var(--on-surface-variant); }
.search-foot span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Mobile drawer ---------- */

.drawer-backdrop {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  z-index: 40;
  background: var(--scrim);
  display: none;
}
body.nav-open .drawer-backdrop { display: block; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1240px) {
  .docs-shell { grid-template-columns: 280px minmax(0, 1fr); }
  .docs-toc { display: none; }
  .docs-main { padding: 36px 44px 88px; }
}

@media (max-width: 1080px) {
  .hero .container { grid-template-columns: minmax(0, 1fr); padding-top: 64px; gap: 64px; }
  .constellation { opacity: .45; }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .showcase { grid-template-columns: minmax(0, 1fr); }
  .showcase-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cta-inner { grid-template-columns: minmax(0, 1fr); }
  .cta .actions { justify-content: flex-start; }
  .search-btn { width: 200px; }
}

@media (max-width: 900px) {
  .header-nav { display: none; }
  .menu-btn { display: inline-grid; }
  .docs-shell { grid-template-columns: minmax(0, 1fr); }
  .docs-sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    z-index: 45;
    width: min(320px, 86vw);
    height: auto;
    background: var(--surface-low);
    border-radius: 0 var(--shape-lg) var(--shape-lg) 0;
    transform: translateX(-100%);
    transition: transform .22s ease;
  }
  body.nav-open .docs-sidebar { transform: none; }
  body.nav-open { overflow: hidden; }
  .docs-main { padding: 28px 24px 80px; }
  .vis-grid, .scenarios { grid-template-columns: minmax(0, 1fr); }
  .principles { grid-template-columns: minmax(0, 1fr); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer .cols { grid-template-columns: 1fr 1fr; }
  .card-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .site-header .bar { padding: 0 8px 0 12px; gap: 4px; }
  .search-btn { width: 40px; height: 40px; padding: 0; justify-content: center; background: transparent; }
  .search-btn .label, .search-btn .kbd-hint { display: none; }
  .brand .tag { display: none; }
  .section { padding: 64px 0; }
  .feature-grid { grid-template-columns: minmax(0, 1fr); }
  .showcase-tabs { grid-template-columns: minmax(0, 1fr); }
  .hero .lead { font-size: 17px; }
  .terminal .screen { font-size: 12px; min-height: 300px; padding: 14px; }
  .bp-frame { padding: 16px; }
  .cta { padding: 36px 24px; border-radius: var(--shape-lg); }
  .docs-main { padding: 24px 16px 72px; }
  .prose .anchor { display: none; }
  .card-grid, .card-grid.three { grid-template-columns: minmax(0, 1fr); }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager a.next { grid-column: 1; }
  .site-footer .cols { grid-template-columns: minmax(0, 1fr); }
  .code-block pre { font-size: 12.5px; padding: 14px; }
}

/* Landing page: mobile navigation menu */
.landing-menu {
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  z-index: 45;
  padding: 8px 12px 16px;
  background: var(--surface-low);
  display: none;
}
body.nav-open .landing-menu { display: grid; gap: 2px; }
.landing-menu a { padding: 12px 16px; border-radius: var(--shape-full); color: var(--on-surface); font-weight: 500; }
.landing-menu a:hover { background: var(--hover); text-decoration: none; }

@media print {
  .site-header, .docs-sidebar, .docs-toc, .pager, .site-footer { display: none !important; }
  .docs-shell { display: block; }
  .code-block { break-inside: avoid; }
}
