/* ============================================================
   PROMPTRY — Redesign
   Editorial + terminal hybrid. Dark-first, light theme parity.
   Typeface: Bricolage Grotesque (display, opsz) · Fraunces (italic accent) · JetBrains Mono (code)
   ============================================================ */

:root {
  /* type */
  --f-sans: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --f-serif: "Fraunces", "Iowan Old Style", Georgia, serif;

  /* dark (default) */
  --bg:        #0b0c0e;
  --bg-1:      #101215;
  --bg-2:      #16181c;
  --bg-3:      #1c1f24;
  --line:      #23262c;
  --line-2:    #2d3139;
  --ink:       #ecedef;
  --ink-2:     #b6b8bd;
  --ink-3:     #7c7f86;
  --ink-4:     #53565c;
  --accent:    oklch(0.78 0.14 82);     /* amber */
  --accent-2:  oklch(0.78 0.14 152);    /* mint */
  --accent-3:  oklch(0.78 0.14 262);    /* periwinkle */
  --danger:    oklch(0.72 0.16 28);
  --ok:        oklch(0.78 0.14 152);

  /* rhythm */
  --r-xs: 2px;
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;
  --maxw: 1200px;
}

[data-theme="light"] {
  --bg:        #f8f7f4;
  --bg-1:      #ffffff;
  --bg-2:      #f2f1ed;
  --bg-3:      #e9e8e2;
  --line:      #e2e0d8;
  --line-2:    #d0cdc2;
  --ink:       #17181a;
  --ink-2:     #44464b;
  --ink-3:     #73767d;
  --ink-4:     #a3a6ad;
  /* Darker amber for light mode — the bright dark-mode amber washes out
     against cream. Same hue, lower lightness, higher chroma. */
  --accent:    oklch(0.62 0.16 72);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* Keep #hash jumps clear of the 56px sticky nav so section titles aren't
   scrolled underneath it. */
html { scroll-padding-top: 76px; }

/* Thin, theme-matched scrollbars everywhere (Firefox + WebKit). The thumb
   floats inside a transparent border via background-clip, so it reads as a
   slim pill rather than a chunky bar. */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--ink-4);
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* Wait for webfonts before revealing the page — avoids a jarring font-swap
   flash. The inline script in each HTML head flips this within ~100-300ms. */
html:not(.fonts-ready) body { visibility: hidden; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
  font-variation-settings: "opsz" 14;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ----------- shell ----------- */
.shell {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 32px;
}
@media (max-width: 720px) { .shell { padding: 0 16px; } }
@media (max-width: 480px) { .shell { padding: 0 12px; } }

/* ----------- nav ----------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-mono);
  font-size: 14px;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  overflow: hidden;
}
.brand-mark svg { width: 22px; height: 22px; display: block; }
.brand-mark svg text {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-weight: 700;
  font-size: 28px;
}
.brand-mark .logo-p { fill: #e8e8ec; }
/* Logo "r" stays the bright dark-mode amber in both themes — the
   mark sits in a dark pill, so it shouldn't follow the page accent. */
.brand-mark .logo-r { fill: oklch(0.78 0.14 82); }
.brand-name { color: var(--ink); }
.brand-name b {
  /* Match the favicon's font so the logo reads as one piece */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.brand-name b .ry { color: var(--accent); }

/* Inline logo for use in body text (e.g. the comparison table) —
   matches the nav wordmark: lowercase, system-sans, tight tracking. */
.brand-logo {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-transform: none;
}
.brand-logo .ry { color: var(--accent); }
.brand .ver { font-size: 11px; margin-left: 4px; color: var(--ink-3); }
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--ink-2);
}
.nav-links a {
  padding: 6px 10px;
  border-radius: var(--r-sm);
  transition: color .15s, background .15s;
}
.nav-links a:hover,
.nav-links a.active { color: var(--ink); background: var(--bg-2); }
/* Live-demo nav link: a bordered button at the end of the bar (next to GitHub)
   that pops via motion, not colour — a small pulsing accent dot plus a slow,
   monochrome sheen sweep. Sits beside .nav-cta and matches its weight. Motion
   is dropped for users who prefer reduced motion. */
.nav-demo {
  position: relative;
  overflow: hidden;
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  color: var(--ink);
  border: 1px solid color-mix(in oklab, var(--accent) 34%, var(--line-2));
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, border-color .15s;
}
.nav-demo:hover {
  color: var(--ink);
  background: var(--bg-2);
  border-color: color-mix(in oklab, var(--accent) 60%, var(--line-2));
}
.nav-demo .live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
  animation: navDemoPulse 1.8s ease-in-out infinite;
}
.nav-demo::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-130%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.10), transparent);
  animation: navDemoSheen 4s ease-in-out infinite;
}
@keyframes navDemoPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .35; transform: scale(.66); }
}
@keyframes navDemoSheen {
  0%, 60% { transform: translateX(-130%); }
  100%    { transform: translateX(130%); }
}
@media (prefers-reduced-motion: reduce) {
  .nav-demo .live-dot, .nav-demo::after { animation: none; }
}
.nav-cta {
  margin-left: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  color: var(--ink);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.nav-cta:hover { background: var(--bg-2); }
.nav-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}
.theme-toggle {
  position: relative;
  width: 28px; height: 28px;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  display: grid;
  place-items: center;
  overflow: hidden;
  transition: color .15s, background .15s, border-color .15s;
}
.theme-toggle:hover {
  color: var(--accent);
  background: color-mix(in oklab, var(--accent) 8%, transparent);
  border-color: color-mix(in oklab, var(--accent) 35%, var(--line));
}
.theme-toggle .sun,
.theme-toggle .moon {
  grid-area: 1 / 1;       /* stack both icons in the same cell */
  transition: opacity .25s ease-out, transform .3s cubic-bezier(.2,.7,.2,1);
  transform-origin: 50% 50%;
}
.theme-toggle .sun  { opacity: 1; transform: rotate(0deg) scale(1); }
.theme-toggle .moon { opacity: 0; transform: rotate(-90deg) scale(0.7); }
[data-theme="light"] .theme-toggle .sun  { opacity: 0; transform: rotate(90deg) scale(0.7); }
[data-theme="light"] .theme-toggle .moon { opacity: 1; transform: rotate(0deg) scale(1); }

.nav-toggle {
  display: none;
  width: 36px; height: 36px;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  place-items: center;
}
.nav-toggle:hover { color: var(--ink); background: var(--bg-2); }

/* ----------- hero ----------- */
.hero {
  padding: 88px 0 56px;
  border-bottom: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 64px;
  align-items: center;
}
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .hero { padding: 56px 0 40px; }
}

/* Hero dateline — a file-path style editorial opener, not a pill */
.dateline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--ink-3);
}
.dateline::before {
  content: '▸';
  color: var(--accent);
  font-size: 10px;
}
.dateline .sep {
  color: var(--ink-4);
  margin: 0 2px;
}
.dateline a { color: var(--ink-2); border-bottom: 1px dotted var(--line-2); }
.dateline a:hover { color: var(--ink); border-bottom-color: var(--accent); }

.h1 {
  font-family: var(--f-sans);
  font-weight: 500;
  font-size: clamp(36px, 5vw, 68px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  margin: 18px 0 24px;
  color: var(--ink);
  text-wrap: balance;
  font-variation-settings: "opsz" 96;
}

/* ----------- hero entrance choreography ----------- */
@media (prefers-reduced-motion: no-preference) {
  .hero .dateline,
  .hero .h1,
  .hero .hero-sub,
  .hero .install-stack,
  .hero .cta-row,
  .hero .hero-meta,
  .hero .term {
    opacity: 0;
    transform: translateY(12px);
    animation: heroRise .65s cubic-bezier(.2,.7,.2,1) forwards;
  }
  .hero .dateline     { animation-delay:  40ms; }
  .hero .h1           { animation-delay: 110ms; }
  .hero .hero-sub     { animation-delay: 200ms; }
  .hero .install-stack{ animation-delay: 280ms; }
  .hero .cta-row      { animation-delay: 340ms; }
  .hero .hero-meta    { animation-delay: 400ms; }
  .hero .term         { animation-delay: 240ms; transform: translateY(20px); }
}
@keyframes heroRise {
  to { opacity: 1; transform: none; }
}
.h1 em {
  font-family: var(--f-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
  letter-spacing: -0.01em;
  font-size: 1.04em;
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
}
.hero-sub {
  font-size: 18px;
  color: var(--ink-2);
  max-width: 48ch;
  line-height: 1.5;
  margin: 0 0 32px;
  text-wrap: pretty;
}

.install-stack { display: grid; gap: 10px; max-width: 480px; margin-bottom: 28px; }
.install {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 14px 14px 14px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-family: var(--f-mono);
  font-size: 15px;
  color: var(--ink);
  transition: border-color .15s, background .15s, transform .2s cubic-bezier(.2,.7,.2,1);
}
.install:hover {
  border-color: var(--line-2);
}
.install-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  background: color-mix(in oklab, var(--accent) 14%, transparent);
  color: var(--accent);
  border: 1px solid color-mix(in oklab, var(--accent) 30%, transparent);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.install-cmd { flex: 1; color: var(--ink); }
.install-cmd .t-dim { color: var(--ink-3); }
.copy-btn {
  position: relative;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--ink-3);
  padding: 4px 10px;
  min-width: 72px;
  text-align: center;
  border-radius: var(--r-sm);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  transition: color .15s, border-color .15s, transform .18s cubic-bezier(.2,.7,.2,1);
}
.copy-btn:hover { color: var(--ink); border-color: var(--line-2); }
.copy-btn:active { transform: scale(0.94); }
.copy-btn::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  border: 1px solid var(--accent);
  opacity: 0;
  transform: scale(1);
  pointer-events: none;
}
.copy-btn.copied {
  color: var(--ok);
  border-color: color-mix(in oklab, var(--ok) 40%, var(--line));
}
@media (prefers-reduced-motion: no-preference) {
  .copy-btn.copied::before {
    animation: copyRing .55s cubic-bezier(.2,.7,.2,1) forwards;
  }
}
@keyframes copyRing {
  0%   { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.35); }
}

.hero-meta {
  display: flex;
  gap: 20px;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.hero-meta b { color: var(--ink); font-weight: 500; }
.hero-meta .sep { color: var(--ink-4); }

/* ----------- terminal card ----------- */
.term {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  font-family: var(--f-mono);
  font-size: 12.5px;
  box-shadow: 0 1px 0 var(--line), 0 24px 60px -30px rgba(0,0,0,.5);
}
/* Top chrome row: dots + path title */
.term-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}
.term-dots { display: flex; gap: 6px; }
.term-dot {
  width: 11px; height: 11px;
  border-radius: 999px;
  border: none;
}
.term-dot:nth-child(1) { background: #ff5f56; }
.term-dot:nth-child(2) { background: #ffbd2e; }
.term-dot:nth-child(3) { background: #27c93f; }
.term-title { flex: 1; text-align: center; font-family: var(--f-mono); }

/* Tabstrip row — tabs pop up, active merges into body.
   Fixed geometry so clicking never shifts any tab. */
.term-tabstrip {
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 6px 10px 0;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  height: 38px;
  box-sizing: border-box;
}
.term-tab {
  position: relative;
  flex: 0 0 96px;          /* fixed width — no flex growth, no shrink */
  width: 96px;
  height: 32px;            /* fixed height */
  padding: 0;
  line-height: 30px;       /* vertical center in the 32px box minus 1px top/bottom border */
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 5px 5px 0 0;
  text-align: center;
  cursor: pointer;
  align-self: flex-end;
  margin-bottom: -1px;     /* overlap the tabstrip bottom border by 1px */
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  font-variant-numeric: tabular-nums;
  box-sizing: border-box;
}
.term-tab:hover:not(.on) {
  color: var(--ink-2);
  background: color-mix(in oklab, var(--bg-3) 60%, var(--bg-2));
}
.term-tab.on {
  background: var(--bg-1);   /* matches body so the tab appears connected */
  color: var(--ink);
  border-color: var(--line); /* makes the left/top/right border visible */
  z-index: 2;
}
.term-body {
  padding: 18px 20px;
  line-height: 1.75;
  color: var(--ink);
  min-height: 280px;
  /* Stack all panes in the same grid cell so the box always sizes to
     the tallest pane — no height shift when switching tabs. */
  display: grid;
  grid-template-areas: "pane";
}
.term-pane {
  grid-area: pane;
  visibility: hidden;
}
.term-pane.on { visibility: visible; }
.term-body .t-prompt { color: var(--ink-3); user-select: none; }
.term-body .t-dim    { color: var(--ink-3); }
.term-body .t-accent { color: var(--accent); }
.term-body .t-ok     { color: var(--ok); }
.term-body .t-warn   { color: var(--accent); }
.term-body .t-err    { color: var(--danger); }
.term-body .t-kw     { color: var(--accent-3); }
.term-body .t-str    { color: var(--accent-2); }
.term-body .t-fn     { color: var(--accent); }
.term-body .t-cur::after {
  content: "▌";
  color: var(--accent);
  margin-left: 2px;
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ----------- provider line (editorial sentence) ----------- */
.providers {
  border-bottom: 1px solid var(--line);
  padding: 24px 0;
}
.providers p {
  margin: 0;
  color: var(--ink-3);
  font-size: 14.5px;
  text-wrap: balance;
  max-width: 68ch;
}
.providers strong {
  color: var(--ink);
  font-weight: 500;
}

/* ----------- sections ----------- */
.section {
  padding: 96px 0;
  border-bottom: 1px solid var(--line);
}
@media (max-width: 720px) { .section { padding: 64px 0; } }

/* Section head — simple editorial, no leading numbers */
.sec-head {
  margin-bottom: 56px;
  max-width: 780px;
}
/* Kicker — file-path style, matches the hero dateline: mono type with an
   amber ▸ marker. Signals "this is a section name" in the project vocabulary. */
.sec-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-mono);
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
  margin-bottom: 18px;
}
.sec-kicker::before {
  content: '▸';
  color: var(--accent);
  font-size: 10px;
}
.sec-title {
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.02;
  margin: 0;
  color: var(--ink);
  max-width: 22ch;
  text-wrap: balance;
  font-variation-settings: "opsz" 72;
}
.sec-title em {
  font-family: var(--f-serif);
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
  font-variation-settings: "opsz" 144, "SOFT" 50;
}
.sec-lede {
  color: var(--ink-2);
  font-size: 17px;
  max-width: 58ch;
  text-wrap: pretty;
  margin: 16px 0 0;
  line-height: 1.5;
}

/* ----------- capabilities (before/after diff) -----------
   Each capability = a tiny git diff hunk with @@ label @@ header,
   red (-) pain-point line, green (+) what-promptry-does line.
   Two columns of hunks on wide screens. */
.caps-diff {
  --diff-del-bg: color-mix(in oklab, oklch(0.55 0.18 25) 10%, transparent);
  --diff-del-mark: oklch(0.72 0.17 25);
  --diff-del-ink: color-mix(in oklab, var(--ink) 72%, oklch(0.55 0.18 25));
  --diff-add-bg: color-mix(in oklab, oklch(0.62 0.15 148) 10%, transparent);
  --diff-add-mark: oklch(0.75 0.15 148);
  --diff-add-ink: var(--ink);
  --diff-head: color-mix(in oklab, var(--accent) 72%, var(--ink));
  font-family: var(--f-mono);
  font-size: 13px;
  line-height: 1.55;
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 40px;
  row-gap: 28px;
  margin-top: 8px;
}
[data-theme="light"] .caps-diff {
  --diff-del-bg: color-mix(in oklab, oklch(0.55 0.18 25) 7%, transparent);
  --diff-del-mark: oklch(0.5 0.18 25);
  --diff-del-ink: color-mix(in oklab, var(--ink) 70%, oklch(0.48 0.18 25));
  --diff-add-bg: color-mix(in oklab, oklch(0.48 0.15 148) 7%, transparent);
  --diff-add-mark: oklch(0.48 0.15 148);
}

.diff-hunk {
  min-width: 0;
  transition: transform .22s cubic-bezier(.2,.7,.2,1), filter .22s ease-out;
}
@media (prefers-reduced-motion: no-preference) {
  .diff-hunk:hover {
    transform: translateY(-2px);
    filter: drop-shadow(0 6px 12px color-mix(in oklab, var(--ink) 18%, transparent));
  }
}
.diff-head { margin-bottom: 10px; }

.hs-title {
  margin: 0;
  font-family: var(--f-sans);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.15;
}

.hs-hash {
  font-family: var(--f-mono);
  color: var(--accent);
  margin-right: 10px;
  opacity: 1;
  font-weight: 700;
  font-size: 1.08em;
}

.diff-row {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: start;
  padding: 3px 10px 3px 4px;
  border-left: 2px solid transparent;
}
.diff-mark {
  font-weight: 600;
  user-select: none;
  text-align: center;
}
.diff-text {
  color: var(--ink);
  text-wrap: pretty;
}
.diff-text code {
  font-family: var(--f-mono);
  font-size: 12.5px;
  padding: 0 3px;
  background: color-mix(in oklab, var(--ink) 6%, transparent);
  border-radius: 3px;
  color: var(--accent);
}

.diff-del {
  background: var(--diff-del-bg);
  border-left-color: var(--diff-del-mark);
}
.diff-del .diff-mark { color: var(--diff-del-mark); }
.diff-del .diff-text {
  color: var(--diff-del-ink);
  text-decoration: line-through;
  text-decoration-color: color-mix(in oklab, var(--diff-del-mark) 50%, transparent);
  text-decoration-thickness: 1px;
}

.diff-add {
  background: var(--diff-add-bg);
  border-left-color: var(--diff-add-mark);
}
.diff-add .diff-mark { color: var(--diff-add-mark); }
.diff-add .diff-text { color: var(--diff-add-ink); }

@media (max-width: 860px) {
  .caps-diff {
    grid-template-columns: 1fr;
    column-gap: 0;
    row-gap: 22px;
  }
}

/* ----------- walkthrough ----------- */
.walk {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 40px;
  align-items: start;
}
@media (max-width: 960px) { .walk { grid-template-columns: 1fr; } }

.steps {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.step {
  position: relative;
  padding: 22px 0 24px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 68px 1fr auto;
  gap: 22px;
  align-items: baseline;
  cursor: pointer;
  transition: opacity .2s;
  background: none;
  border-left: none;
  border-right: none;
  border-bottom: none;
  text-align: left;
  font: inherit;
  color: inherit;
  width: 100%;
}
.step:last-child { border-bottom: 1px solid var(--line); }

/* Auto-cycle progress bar — fills left-to-right under the active step
   while the walkthrough is still auto-playing. A user click on any step
   removes `.cycling` from all steps and the bar fades out. */
.step-progress {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: 0;
  background: var(--accent);
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease-out;
}
@media (prefers-reduced-motion: no-preference) {
  .step.on.cycling .step-progress {
    opacity: 1;
    animation: stepFill 4s linear forwards;
  }
}
@keyframes stepFill {
  to { width: 100%; }
}
.step-num {
  font-family: var(--f-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(44px, 5.2vw, 64px);
  line-height: 0.88;
  color: color-mix(in oklab, var(--ink) 28%, transparent);
  letter-spacing: -0.04em;
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
  transition: color .25s cubic-bezier(.2,.7,.2,1), transform .25s cubic-bezier(.2,.7,.2,1);
  align-self: start;
  padding-top: 2px;
}
.step:hover .step-num { color: color-mix(in oklab, var(--ink) 55%, transparent); }
.step-title {
  font-size: 19px;
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: -0.012em;
  transition: color .2s;
  align-self: start;
  padding-top: 8px;
}
.step-meta {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ink-4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.step.on .step-title { color: var(--ink); }
.step.on .step-num {
  color: var(--accent);
  transform: translateX(2px);
}
.step-body {
  grid-column: 2 / -1;
  font-size: 14px;
  color: var(--ink-2);
  margin-top: 6px;
  max-width: 52ch;
  display: none;
}
.step.on .step-body { display: block; }

/* ----------- dashboard mock ----------- */
.mock {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  font-family: var(--f-mono);
  font-size: 12px;
  box-shadow: 0 24px 60px -30px rgba(0,0,0,.5);
}
.mock-chrome {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--ink-3);
  font-size: 11px;
}
.mock-chrome .dots { display: flex; gap: 6px; }
.mock-chrome .dot {
  width: 9px; height: 9px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 999px;
  background: var(--bg-3);
}
.mock-chrome .dot:nth-child(1) { background: #ff5f56; border-color: #e0443e; }
.mock-chrome .dot:nth-child(2) { background: #ffbd2e; border-color: #dea123; }
.mock-chrome .dot:nth-child(3) { background: #27c93f; border-color: #1aab29; }
.mock-url {
  flex: 1;
  text-align: center;
  color: var(--ink-3);
  font-size: 11px;
}
.mock-body {
  display: grid;
  grid-template-columns: 160px 1fr;
  /* No min-height — each mock-view sizes to its content. Views have roughly
     equivalent heights, so swap doesn't jitter the layout noticeably. */
}
.mock-side {
  border-right: 1px solid var(--line);
  padding: 14px 10px;
  background: color-mix(in oklab, var(--bg-1) 50%, var(--bg-2));
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--ink-3);
}
.mock-side-h {
  padding: 6px 10px;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink-4);
  text-transform: uppercase;
}
.mock-side-item {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  gap: 8px;
}
.mock-side-item.on { background: var(--bg-3); color: var(--ink); }
.mock-side-item::before {
  content: "";
  width: 5px; height: 5px; border-radius: 999px;
  background: var(--ink-4);
}
.mock-side-item.on::before { background: var(--accent); }
.mock-side-item.recent { font-size: 11px; color: var(--ink-3); }
.mock-main { padding: 16px 18px; }
.mock-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  color: var(--ink-2);
}
.mock-title { font-size: 13px; color: var(--ink); }
.mock-title .dim { color: var(--ink-3); }
.mock-toolbar .base { font-size: 11px; color: var(--ink-3); }
.mock-kpis {
  display: grid;
  grid-template-columns: 1.7fr 1fr 1fr 1fr;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: 14px;
}
.kpi { padding: 12px 14px; border-right: 1px solid var(--line); }
.kpi:first-child {
  padding: 14px 16px;
  background: color-mix(in oklab, var(--accent) 5%, transparent);
}
.kpi:last-child { border-right: none; }
.kpi-label { color: var(--ink-3); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; }
.kpi-val { color: var(--ink); font-size: 18px; margin-top: 4px; font-family: var(--f-sans); letter-spacing: -0.02em; }
.kpi:first-child .kpi-val {
  font-size: 26px;
  letter-spacing: -0.03em;
  font-weight: 500;
}
.kpi:first-child .kpi-delta { font-size: 11px; }
.kpi-delta { color: var(--ok); font-size: 10px; margin-left: 6px; }
.kpi-delta.down { color: var(--danger); }
.mock-chart {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px;
  height: 160px;
  position: relative;
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 32px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 10% 100%;
  opacity: 0.95;
}
.mock-chart svg { width: 100%; height: 100%; overflow: visible; }

/* Chart lines: strokes draw in when the chart scrolls into view. */
.mock-chart .chart-line,
.mock-chart .chart-baseline {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}
.mock-chart .chart-fill,
.mock-chart .chart-dot,
.mock-chart .chart-pulse { opacity: 0; }

@media (prefers-reduced-motion: no-preference) {
  .mock-chart.in-view .chart-line {
    animation: chartDraw 1.1s cubic-bezier(.4,.05,.2,1) .05s forwards;
  }
  .mock-chart.in-view .chart-baseline {
    animation: chartDraw 1.1s cubic-bezier(.4,.05,.2,1) .25s forwards;
  }
  .mock-chart.in-view .chart-fill {
    animation: chartFade .7s ease-out .55s forwards;
  }
  .mock-chart.in-view .chart-dot,
  .mock-chart.in-view .chart-pulse {
    animation: chartFade .4s ease-out 1.05s forwards;
  }
  .mock-chart.in-view .chart-pulse {
    animation: chartPulse 2.4s ease-out 1.1s infinite;
  }
}
/* Reduced-motion: skip the draw-in, just show. */
@media (prefers-reduced-motion: reduce) {
  .mock-chart .chart-line,
  .mock-chart .chart-baseline { stroke-dasharray: none; stroke-dashoffset: 0; }
  .mock-chart .chart-fill,
  .mock-chart .chart-dot,
  .mock-chart .chart-pulse { opacity: 1; }
}

@keyframes chartDraw {
  to { stroke-dashoffset: 0; }
}
@keyframes chartFade {
  to { opacity: 1; }
}
@keyframes chartPulse {
  0%   { opacity: 0.5; transform: scale(1); transform-origin: 330px 36px; }
  60%  { opacity: 0; transform: scale(2.4); transform-origin: 330px 36px; }
  100% { opacity: 0; transform: scale(2.4); transform-origin: 330px 36px; }
}
.mock-insights {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-3);
}
.mock-insight {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.mock-insight .label {
  color: var(--ink-4);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.mock-insight .val {
  color: var(--ink-2);
  margin-top: 4px;
}
.mock-insight .val .neg { color: var(--danger); }

/* ---------- keyboard focus (a11y) ---------- */
.btn:focus-visible,
.copy-btn:focus-visible,
.theme-toggle:focus-visible,
.nav-toggle:focus-visible,
.term-tab:focus-visible,
.step:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
.term-tab:focus-visible { outline-offset: -2px; border-radius: 0; }
.step:focus-visible {
  outline-offset: 0;
  border-radius: var(--r-sm);
  background: color-mix(in oklab, var(--accent) 4%, transparent);
}

/* ---------- mock-view swapping (walkthrough) ---------- */
.mock-view {
  display: none;
  animation: mvIn .32s cubic-bezier(.2,.7,.2,1);
}
.mock-view.on { display: block; }
@media (prefers-reduced-motion: reduce) {
  .mock-view { animation: none; }
}
@keyframes mvIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Prompts view ---------- */
.mv-table {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  font-family: var(--f-mono);
  font-size: 11.5px;
}
.mv-row {
  display: grid;
  grid-template-columns: 1.4fr 0.4fr 0.8fr 0.7fr 0.5fr;
  gap: 10px;
  padding: 8px 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.mv-row:last-child { border-bottom: none; }
.mv-head {
  background: var(--bg-2);
  color: var(--ink-3);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 12px;
}
.mv-right { text-align: right; color: var(--ink-3); }
.mv-tag {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.mv-tag-prod {
  background: color-mix(in oklab, var(--accent) 14%, transparent);
  color: var(--accent);
  border: 1px solid color-mix(in oklab, var(--accent) 30%, transparent);
}
.mv-tag-stage {
  background: color-mix(in oklab, var(--ink-3) 14%, transparent);
  color: var(--ink-2);
  border: 1px solid var(--line-2);
}

/* ---------- Suites view ---------- */
.mv-suites {
  display: grid;
  gap: 8px;
}
.mv-suite {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 14px;
  background: var(--bg-2);
}
.mv-suite-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.mv-suite-name {
  font-family: var(--f-mono);
  font-size: 13px;
  color: var(--ink);
}
.mv-suite-meta {
  margin-top: 6px;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ink-3);
}
.mv-suite-meta b { color: var(--ink); font-weight: 500; }
.mv-status {
  font-family: var(--f-mono);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
}
.mv-status.ok {
  color: var(--ok);
  background: color-mix(in oklab, var(--ok) 12%, transparent);
}
.mv-status.warn {
  color: var(--accent);
  background: color-mix(in oklab, var(--accent) 14%, transparent);
}
.mv-delta.down { color: var(--danger); margin-left: 6px; }

/* ---------- Runs view ---------- */
.mv-runs {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  font-family: var(--f-mono);
  font-size: 11.5px;
}
.mv-run {
  display: grid;
  grid-template-columns: 80px 1.6fr 0.5fr 0.7fr;
  gap: 12px;
  padding: 7px 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.mv-run:last-child { border-bottom: none; }
.mv-run-head {
  background: var(--bg-2);
  color: var(--ink-3);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 12px;
}
.mv-run-fail {
  background: color-mix(in oklab, var(--danger) 7%, transparent);
}
.mv-t { color: var(--ink-3); }
.mv-run .ok { color: var(--ok); }
.mv-run .warn { color: var(--accent); }
.mv-run .err { color: var(--danger); }

@media (max-width: 560px) {
  .mv-row { grid-template-columns: 1.2fr 0.4fr 0.5fr 0.5fr; font-size: 10.5px; }
  .mv-row span:nth-child(3) { display: none; }  /* drop hash column */
  .mv-run { grid-template-columns: 60px 1.6fr 0.5fr 0.6fr; font-size: 10.5px; }
}

/* ----------- comparison table ----------- */
.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-1);
}
.cmp {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.cmp th, .cmp td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.cmp thead th {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 400;
  background: var(--bg-2);
}
.cmp tbody tr:last-child td { border-bottom: none; }
.cmp .col-feat { color: var(--ink); width: 24%; }
.cmp th.us, .cmp td.us {
  background: color-mix(in oklab, var(--accent) 8%, var(--bg-1));
  color: var(--ink);
}
.cmp th.us { color: var(--accent); font-weight: 500; }
.cmp .yes { color: var(--ok); }
.cmp .no  { color: var(--ink-4); }
.cmp .mid { color: var(--ink-3); }
.cmp tbody td { color: var(--ink-2); }

.cmp-caveat {
  margin-top: 24px;
  color: var(--ink-3);
  font-size: 13px;
  max-width: 76ch;
  line-height: 1.6;
}

/* ----------- CTA ----------- */
.cta-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-family: var(--f-mono);
  border: 1px solid var(--line-2);
  background: var(--bg-1);
  color: var(--ink);
  transition: border-color .15s, background .15s, color .15s;
}
.btn:hover { border-color: var(--accent); }
/* Icon-only registry links (PyPI / npm). Square, logo keeps its brand colour. */
.btn-icon { padding: 9px; gap: 0; }
.btn-icon svg { display: block; }
.btn.primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
  padding: 12px 18px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow:
    0 1px 0 color-mix(in oklab, var(--accent) 0%, transparent),
    0 12px 24px -14px color-mix(in oklab, var(--ink) 70%, transparent);
  transform: translateZ(0);
  transition: transform .2s cubic-bezier(.2,.7,.2,1), box-shadow .2s, background .15s, color .15s, border-color .15s;
}
[data-theme="light"] .btn.primary { background: var(--ink); color: var(--bg); }
.btn.primary:hover {
  background: var(--accent);
  color: #171410;
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 16px 28px -14px color-mix(in oklab, var(--accent) 65%, transparent);
}

.cta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: center;
}
@media (max-width: 860px) { .cta-grid { grid-template-columns: 1fr; } }

/* ----------- footer ----------- */
.foot { padding: 56px 0 40px; }
.foot-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 48px;
}
@media (max-width: 720px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
.foot h5 {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--ink-4);
  text-transform: uppercase;
  margin: 0 0 14px;
  font-weight: 400;
}
.foot ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.foot a { color: var(--ink-2); font-size: 13px; }
.foot a:hover { color: var(--ink); }
.foot-tag { color: var(--ink-2); font-size: 14px; max-width: 32ch; margin: 10px 0 0; }
.foot-bottom {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--ink-3);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
}

/* ----------- utility ----------- */
.mono { font-family: var(--f-mono); }
.dim  { color: var(--ink-3); }
.mute { color: var(--ink-4); }
hr.rule { border: 0; border-top: 1px solid var(--line); margin: 0; }

/* ============================================================
   Architecture + Docs pages (shared extras)
   ============================================================ */

.page-head { padding: 72px 0 48px; border-bottom: 1px solid var(--line); }
.page-head .sec-title { max-width: 28ch; }

.diagram-wrap {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background:
    radial-gradient(circle at 50% 50%, color-mix(in oklab, var(--accent) 6%, transparent) 0%, transparent 60%),
    var(--bg-1);
  padding: 32px 24px;
  overflow-x: auto;
}
.diagram { width: 100%; height: auto; display: block; min-width: 880px; }

/* D2-rendered architecture diagram (static SVG) */
.arch-diagram {
  display: block;
  width: 100%;
  height: auto;
  max-width: 1100px;
  margin: 0 auto;
  min-width: 720px;
}
.d-zone { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.14em; fill: var(--ink-4); text-transform: uppercase; }
.d-label { font-family: var(--f-sans); font-size: 14px; font-weight: 600; fill: var(--ink); letter-spacing: -0.01em; }
.d-sub   { font-family: var(--f-mono); font-size: 11px; fill: var(--ink-3); letter-spacing: 0.01em; }
.d-arrow        { stroke: var(--ink-3); stroke-width: 1.25; fill: none; stroke-linecap: round; }
.d-arrow-accent { stroke: var(--accent); stroke-width: 1.5; fill: none; stroke-linecap: round; filter: drop-shadow(0 0 4px color-mix(in oklab, var(--accent) 40%, transparent)); }

.schema-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-1);
}
@media (max-width: 900px) { .schema-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .schema-grid { grid-template-columns: 1fr; } }

.schema-card {
  padding: 20px 22px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  min-height: 200px;
}
.schema-grid .schema-card:nth-child(3n) { border-right: none; }
.schema-grid .schema-card:nth-last-child(-n+3) { border-bottom: none; }
@media (max-width: 900px) {
  .schema-grid .schema-card { border-right: 1px solid var(--line) !important; border-bottom: 1px solid var(--line) !important; }
  .schema-grid .schema-card:nth-child(2n) { border-right: none !important; }
}
.schema-card h4 {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 12px;
}
.schema-card ul { list-style: none; padding: 0; margin: 0; font-family: var(--f-mono); font-size: 12px; color: var(--ink-2); line-height: 1.9; }
.schema-card li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--line); padding: 2px 0; }
.schema-card li:last-child { border-bottom: none; }
.schema-card li .k { color: var(--ink); }
.schema-card li .t { color: var(--ink-4); font-size: 11px; }

/* Docs page layout
   No top padding on the grid so the sidebars are flush under the nav
   and stick immediately — no travel distance on the first scroll. */
.docs-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 200px;
  gap: 48px;
  padding: 0 0 96px;
  align-items: start;
}
@media (max-width: 1100px) { .docs-layout { grid-template-columns: 220px minmax(0, 1fr); } .docs-toc { display: none; } }
@media (max-width: 860px) {
  .docs-layout {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0 16px 64px; /* docs-layout overrides .shell padding, so re-apply here */
  }
  .docs-side, .docs-toc { position: static; }
}
@media (max-width: 480px) {
  .docs-layout { padding: 0 12px 64px; }
}
.docs-side {
  position: sticky;
  top: 56px;           /* flush with sticky nav so scroll sticks immediately */
  font-size: 13px;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  padding: 40px 8px 40px 0;
  /* thin, self-scrolling, hide on idle */
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}

/* Mobile-only "Browse sections" button — hidden on desktop */
.docs-nav-toggle {
  display: none;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
}
.docs-nav-toggle span { flex: 1; }
.docs-nav-toggle svg { color: var(--accent); flex-shrink: 0; }
.docs-nav-toggle-caret {
  transition: transform .2s ease;
}
.docs-nav-toggle.open .docs-nav-toggle-caret {
  transform: rotate(180deg);
}
.docs-side::-webkit-scrollbar { width: 6px; }
.docs-side::-webkit-scrollbar-track { background: transparent; }
.docs-side::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.docs-side::-webkit-scrollbar-thumb:hover { background: var(--line-2); }
/* Search input at the top of the docs sidebar */
.docs-search {
  position: relative;
  margin: 0 0 18px;
}
.docs-search-ico {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}
.docs-search input {
  width: 100%;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 8px 46px 8px 32px;
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.docs-search input:focus {
  border-color: var(--accent);
}
.docs-search input::placeholder { color: var(--ink-4); }

/* Hide the browser's native clear X on type=search — replaced with
   our own plain button for visual consistency across browsers. */
.docs-search input::-webkit-search-cancel-button,
.docs-search input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }

.docs-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border: none;
  background: transparent;
  color: var(--ink-3);
  font-size: 16px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  border-radius: var(--r-xs);
}
.docs-search-clear[hidden] { display: none; }
.docs-search-clear:hover { color: var(--ink); background: var(--bg-2); }

.docs-search-kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--ink-4);
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: var(--r-xs);
  pointer-events: none;
  letter-spacing: 0.04em;
}
/* When the input has text, swap kbd hint for the clear button. */
.docs-search:has(input:not(:placeholder-shown)) .docs-search-kbd,
.docs-search input:focus + .docs-search-clear + .docs-search-kbd {
  display: none;
}

.docs-search-results {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 18px;
}
/* `display: flex` above overrides the UA [hidden] rule — add back explicitly. */
.docs-search-results[hidden] { display: none !important; }
.docs-search-empty {
  font-size: 12px;
  color: var(--ink-3);
  padding: 8px;
}
.docs-search-hit {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--ink-2);
  text-decoration: none;
  cursor: pointer;
}
.docs-search-hit:hover,
.docs-search-hit.on {
  background: var(--bg-2);
  color: var(--ink);
}
.docs-search-hit-tag {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
  width: 18px;
  flex-shrink: 0;
}
.docs-search-hit-title mark {
  background: color-mix(in oklab, var(--accent) 30%, transparent);
  color: var(--ink);
  padding: 0 1px;
  border-radius: 2px;
}

.docs-side h5 { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.1em; color: var(--ink-4); text-transform: uppercase; margin: 18px 0 8px; font-weight: 400; }
.docs-side ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.docs-side a { display: block; padding: 5px 8px; border-radius: var(--r-sm); color: var(--ink-3); }
.docs-side a:hover { color: var(--ink); background: var(--bg-2); }
.docs-side a.active { color: var(--ink); background: var(--bg-2); }

.docs-toc {
  position: sticky;
  top: 56px;
  padding-top: 40px;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}
.docs-toc h5 { font-size: 10px; letter-spacing: 0.1em; color: var(--ink-4); text-transform: uppercase; margin: 0 0 10px; font-weight: 400; }
.docs-toc ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; border-left: 1px solid var(--line); }
.docs-toc a { padding: 2px 12px; display: block; color: var(--ink-3); border-left: 2px solid transparent; margin-left: -1px; }
.docs-toc a:hover { color: var(--ink); }

.docs-body {
  font-size: 15.5px;
  color: var(--ink-2);
  line-height: 1.65;
  max-width: 68ch;
  padding-top: 40px;
}
.docs-body h1 { font-family: var(--f-sans); font-weight: 500; font-size: clamp(28px, 3vw, 36px); letter-spacing: -0.03em; color: var(--ink); margin: 0 0 16px; }
/* scroll-margin so a heading targeted by a sidebar #hash (or the JS search
   jump) lands below the sticky nav rather than under it. */
.docs-body h1, .docs-body h2, .docs-body h3 { scroll-margin-top: 76px; }
.docs-body h2 { font-family: var(--f-sans); font-weight: 500; font-size: 22px; letter-spacing: -0.02em; color: var(--ink); margin: 48px 0 12px; padding-top: 32px; border-top: 1px solid var(--line); }
.docs-body h2:first-of-type { border-top: none; padding-top: 0; margin-top: 24px; }
.docs-body h3 { font-family: var(--f-sans); font-weight: 500; font-size: 17px; letter-spacing: -0.01em; color: var(--ink); margin: 28px 0 10px; }
.docs-body p { margin: 0 0 14px; text-wrap: pretty; }
.docs-body strong { color: var(--ink); font-weight: 500; }
.docs-body a { color: var(--accent); border-bottom: 1px dashed color-mix(in oklab, var(--accent) 35%, transparent); }
.docs-body a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.docs-body code { font-family: var(--f-mono); font-size: 13px; background: var(--bg-2); border: 1px solid var(--line); color: var(--ink); padding: 1px 6px; border-radius: var(--r-xs); }
.docs-body pre {
  background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 16px 18px; margin: 14px 0 20px;
  font-family: var(--f-mono); font-size: 12.5px; line-height: 1.7;
  /* soft-wrap long lines instead of horizontal scrolling, which looks bad */
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  overflow-x: hidden;
}
.docs-body pre code { background: none; border: none; padding: 0; font-size: inherit; }
.docs-body ul, .docs-body ol { padding-left: 22px; margin: 0 0 14px; }
.docs-body li { margin-bottom: 6px; }

/* Q&A cards (architecture) */
.qa {
  display: grid; gap: 0;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; background: var(--bg-1);
}
.qa-item { padding: 20px 22px; border-bottom: 1px solid var(--line); }
.qa-item:last-child { border-bottom: none; }
.qa-q { font-size: 15px; color: var(--ink); font-weight: 500; letter-spacing: -0.01em; }
.qa-a { color: var(--ink-2); font-size: 14px; margin-top: 8px; max-width: 76ch; }

/* Lifecycle timeline */
.timeline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-1);
}
@media (max-width: 860px) { .timeline { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .timeline { grid-template-columns: 1fr; } }
.tl-step { padding: 22px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.timeline .tl-step:nth-child(4n) { border-right: none; }
.timeline .tl-step:nth-last-child(-n+4) { border-bottom: none; }
@media (max-width: 860px) {
  .timeline .tl-step { border-right: 1px solid var(--line) !important; }
  .timeline .tl-step:nth-child(2n) { border-right: none !important; }
}
.tl-num { font-family: var(--f-mono); font-size: 11px; color: var(--accent); letter-spacing: 0.08em; }
.tl-title { font-size: 15px; font-weight: 500; color: var(--ink); margin: 8px 0 6px; }
.tl-body { color: var(--ink-2); font-size: 13px; line-height: 1.5; }

/* Floating back-to-top button for docs (mobile only). Shown after the
   reader scrolls past the fold; tapping returns to the top and focuses
   the search input, so search is always one tap away without us making
   it sticky. */
.docs-top-btn {
  position: fixed;
  right: 16px;
  bottom: 20px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--bg-1);
  color: var(--ink);
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px color-mix(in oklab, #000 25%, transparent);
  z-index: 50;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}
.docs-top-btn[hidden] { display: none; }
.docs-top-btn svg { color: var(--accent); }
.docs-top-btn:hover { background: var(--bg-2); transform: translateY(-1px); }
.docs-top-btn:active { transform: translateY(0); }
@media (max-width: 860px) {
  .docs-top-btn:not([hidden]) { display: flex; }
}

/* ==================== MOBILE ==================== */
@media (max-width: 720px) {
  /* --- Nav: hamburger dropdown --- */
  .nav-toggle { display: grid; }
  .nav-cta { display: none; }
  .nav-links {
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 24px color-mix(in oklab, #000 18%, transparent);
    transform: translateY(-6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease, transform .15s ease;
  }
  .nav-links.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
  .nav-links a {
    padding: 14px 16px;
    font-size: 15px;
    border-radius: var(--r-sm);
  }

  /* --- Hero --- */
  .hero { padding: 48px 0 32px; }
  .hero-sub { font-size: 15.5px; }
  .install-stack { max-width: 100%; }
  .install-cmd { overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
  .install-cmd::-webkit-scrollbar { display: none; }
  .copy-btn { padding: 8px 10px; font-size: 11px; }

  /* --- Terminal card --- */
  .term-tabstrip { overflow-x: auto; scrollbar-width: none; }
  .term-tabstrip::-webkit-scrollbar { display: none; }
  .term-tab { flex: 0 0 auto; width: auto; min-width: 72px; padding: 0 14px; }
  .term-title { display: none; }
  .term-body {
    padding: 14px 14px;
    min-height: 0;
    font-size: 12px;
    overflow-x: auto;
  }

  /* --- Touch targets --- */
  .theme-toggle { width: 36px; height: 36px; }

  /* --- Caps diff: allow long inline code to wrap --- */
  .diff-text { overflow-wrap: anywhere; }

  /* --- Walkthrough step meta wraps below --- */
  .step-meta { display: none; }

  /* --- Compare table: horizontal scroll --- */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .cmp { min-width: 640px; }

  /* --- Footer --- */
  .foot-grid { grid-template-columns: 1fr; }
  .foot-bottom { flex-wrap: wrap; gap: 8px; }

  /* --- Docs sidebar: on mobile, drop Browse Sections entirely — the
     back-to-top button + search is enough. Sidebar is static (not
     sticky). --- */
  .docs-side {
    position: static !important;
    max-height: none;
    overflow: visible;
    padding: 16px 0 0;
  }
  .docs-search { margin-bottom: 0; }
  .docs-search input { padding: 12px 46px 12px 32px; font-size: 15px; }
  .docs-nav-toggle,
  .docs-nav-groups { display: none !important; }
  .docs-body { padding-top: 20px; }
  .docs-body h1 { font-size: 32px; margin-top: 0; }
  .docs-body h2 { font-size: 22px; }
  .docs-body pre { padding: 12px 14px; margin: 12px 0 18px; font-size: 12px; }
  .docs-body code { font-size: 12.5px; padding: 1px 4px; }
}

@media (max-width: 560px) {
  /* Dashboard mock: hide sidebar, stack KPIs */
  .mock-side { display: none; }
  .mock-body { grid-template-columns: 1fr; min-height: 0; }
  .mock-kpis { grid-template-columns: repeat(2, 1fr) !important; }
  .mock-insights { grid-template-columns: 1fr !important; }

  /* Hero h1 a touch smaller on very narrow */
  .h1 { font-size: clamp(34px, 9vw, 44px); }
  .sec-title { font-size: clamp(28px, 8vw, 36px); }
}
