/* ============================================================
   AI Gateway — site styles
   Design system: OpenAI Editorial Minimalism
   Strictly monochrome, generous whitespace, flat surfaces,
   colour reserved for imagery. Quiet confidence.
   ============================================================ */

:root, :root[data-theme="dark"] {
  /* palette — monochrome, near-black steps (dark, default) */
  --bg: #000000;
  --bg-alt: #0d0d0d;
  --surface: #1a1a1a;
  --surface-2: #242424;
  --text: #ffffff;
  --text-muted: #a1a1a1;
  --text-dim: #6e6e6e;
  --border: #2e2e2e;
  --border-strong: #3d3d3d;
  --action: #ffffff;
  --action-text: #000000;
  --focus: #ffffff;
  --nav-bg: rgba(0, 0, 0, 0.72);
  --sel: rgba(255, 255, 255, 0.16);
  --feature-filter: grayscale(1);
  /* colour appears only in imagery/accents */
  --tile-warm: #f5a623;
  --tile-cool: #7c8cff;

}

:root[data-theme="light"] {
  /* palette — monochrome, near-white steps (light) */
  --bg: #ffffff;
  --bg-alt: #f7f7f8;
  --surface: #f2f2f3;
  --surface-2: #e8e8ea;
  --text: #0d0d0d;
  --text-muted: #5d5d5d;
  --text-dim: #8e8e8e;
  --border: #e5e5e7;
  --border-strong: #d0d0d3;
  --action: #0d0d0d;
  --action-text: #ffffff;
  --focus: #0d0d0d;
  --nav-bg: rgba(255, 255, 255, 0.78);
  --sel: rgba(0, 0, 0, 0.12);
  --feature-filter: grayscale(1) contrast(0.9);
}

:root {
  /* imagery gradients — the ONLY place colour lives (theme-independent) */
  --grad-blue:   linear-gradient(135deg, #3d47c9, #7c8cff);
  --grad-green:  linear-gradient(135deg, #1f9d55, #7be07b);
  --grad-orange: linear-gradient(135deg, #ff7a18, #f5c04a);
  --grad-violet: linear-gradient(135deg, #a640d8, #ff6ec7);
  --grad-teal:   linear-gradient(135deg, #0ea5b7, #4fe0c8);
  --grad-coral:  linear-gradient(135deg, #e0245e, #ff8a5c);
  --grad-sky:    linear-gradient(135deg, #2f6fe0, #52d1ff);
  --grad-gold:   linear-gradient(135deg, #d9911f, #f5d76e);
  --grad-accent: linear-gradient(90deg, #7c8cff 0%, #c56be0 45%, #ff9770 100%);

  /* type */
  --font: "OpenAI Sans", "Söhne", "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;

  /* layout — 4px grid, narrow reading column */
  --maxw: 1120px;
  --col: 760px;
  --gutter: 24px;
  --nav-h: 60px;

  /* elevation — flat aesthetic, minimal shadow */
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: var(--nav-h); }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum";
  transition: background-color .3s ease, color .3s ease;
}

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

::selection { background: var(--sel); }

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

code {
  font-family: var(--mono);
  font-size: 0.86em;
  font-variant-numeric: tabular-nums;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

/* ============ GLOBAL NAV ============ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
  height: var(--nav-h);
  display: flex; align-items: center; gap: 28px;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  color: var(--text); font-weight: 600; font-size: 15px;
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--text); }
.brand-mark { display: inline-flex; }

.nav { display: flex; gap: 2px; margin-right: auto; }
.nav a {
  color: var(--text-muted);
  font-size: 14px; font-weight: 400;
  padding: 6px 12px; border-radius: 999px;
  transition: color .2s, background .2s;
}
.nav a:hover, .nav a.active {
  color: var(--text); background: var(--surface);
}
.topbar-actions { display: flex; gap: 10px; align-items: center; }

/* buttons — pill, flat, monochrome */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px;
  padding: 8px 18px; border-radius: 999px;
  border: 1px solid transparent; cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, opacity .2s;
  white-space: nowrap;
}
.btn:hover { color: inherit; }
.btn-primary { background: var(--action); color: var(--action-text); }
.btn-primary:hover { background: var(--action); color: var(--action-text); opacity: .85; }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); }
.btn-lg { padding: 12px 26px; font-size: 15px; }

/* theme toggle */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0;
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 999px;
  cursor: pointer; transition: background .2s, color .2s, border-color .2s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface); }
.theme-toggle svg { width: 18px; height: 18px; display: block; }
/* show sun in dark mode (to switch to light), moon in light mode */
.theme-toggle .icon-sun { display: block; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* language toggle — segmented EN / 中 pill */
.lang-toggle {
  display: inline-flex; align-items: center; padding: 2px;
  background: transparent; border: 1px solid var(--border);
  border-radius: 999px; gap: 1px;
  transition: border-color .2s;
}
.lang-toggle:hover { border-color: var(--border-strong); }
.lang-toggle .lang-opt {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 28px; padding: 0 8px;
  font-size: 13px; font-weight: 600; line-height: 1;
  color: var(--text-muted); border-radius: 999px;
  transition: background .2s, color .2s;
  background: transparent; border: 0; cursor: pointer;
  font-family: inherit;
}
.lang-toggle .lang-opt.active { background: var(--surface); color: var(--text); }
.lang-toggle .lang-opt:focus-visible { border-radius: 999px; }

.nav-toggle {
  display: none; flex-direction: column; gap: 4px;
  background: none; border: 0; cursor: pointer; padding: 8px;
  margin-left: auto;
}
.nav-toggle span { width: 22px; height: 2px; background: var(--text); border-radius: 2px; }

/* ============ HERO ============ */
.hero {
  position: relative; isolation: isolate;
  background: var(--bg);
  color: var(--text);
  padding: 128px var(--gutter) 96px;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
/* colourful gradient blooms — imagery, not chrome */
.hero::before {
  content: ""; position: absolute; inset: -20% -10% auto -10%; height: 120%;
  z-index: -1; pointer-events: none;
  background:
    radial-gradient(42% 55% at 18% 8%, rgba(124, 140, 255, 0.30), transparent 60%),
    radial-gradient(40% 55% at 85% 4%, rgba(255, 122, 24, 0.24), transparent 60%),
    radial-gradient(50% 60% at 60% 95%, rgba(31, 157, 85, 0.18), transparent 62%);
  filter: blur(6px);
}
:root[data-theme="light"] .hero::before {
  background:
    radial-gradient(42% 55% at 18% 8%, rgba(124, 140, 255, 0.28), transparent 60%),
    radial-gradient(40% 55% at 85% 4%, rgba(255, 122, 24, 0.22), transparent 60%),
    radial-gradient(50% 60% at 60% 95%, rgba(31, 157, 85, 0.16), transparent 62%);
}
.hero-grid {
  max-width: var(--col); margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.eyebrow {
  display: inline-block;
  font-size: 13px; font-weight: 500; letter-spacing: .04em;
  color: var(--text-dim); margin-bottom: 28px;
}
.hero h1 {
  font-size: 48px; line-height: 1.08; font-weight: 600;
  letter-spacing: -0.02em; margin-bottom: 28px;
}
.accent-text {
  background: var(--grad-accent);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.lede { font-size: 19px; color: var(--text-muted); max-width: 60ch; line-height: 1.6; }
.lede strong { color: var(--text); font-weight: 500; }
.hero-cta { display: flex; gap: 12px; margin-top: 40px; flex-wrap: wrap; justify-content: center; }
.hero-tags {
  list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 40px; justify-content: center;
}
.hero-tags li {
  font-family: var(--mono); font-size: 12px;
  color: var(--text-muted); background: transparent;
  border: 1px solid var(--border);
  padding: 5px 12px; border-radius: 999px;
}

/* terminal card — centered below the hero copy */
.hero-card { min-width: 0; width: 100%; max-width: 820px; margin: 64px auto 0; }
.term {
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-card);
}
.term-bar {
  display: flex; align-items: center; gap: 7px;
  padding: 12px 16px; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot-r, .dot-y, .dot-g { background: var(--border-strong); }
.term-title {
  margin-left: 8px; font-family: var(--mono); font-size: 12px; color: var(--text-dim);
}
.term-body {
  padding: 20px; overflow-x: auto;
  font-family: var(--mono); font-size: 13px; line-height: 1.75;
  color: var(--text-muted); text-align: left;
}
.c-cmt { color: var(--text-dim); }
.c-str { color: var(--text); }

/* stats */
.stats {
  max-width: var(--maxw); margin: 96px auto 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--border); border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
}
.stat {
  background: var(--bg); padding: 28px 24px;
}
.stat-val {
  display: block; font-size: 36px; font-weight: 600; color: var(--text);
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}
.stat-unit { font-size: 16px; color: var(--text-dim); margin-left: 3px; font-weight: 500; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ============ SECTIONS ============ */
.section { padding: 96px 0; }
.section-light { background: var(--bg); color: var(--text); }
.section-dark { background: var(--bg-alt); color: var(--text); }

.section-head { max-width: var(--col); margin: 0 auto 56px; text-align: center; }
.kicker {
  font-size: 13px; font-weight: 500; letter-spacing: .04em;
  color: var(--text-dim); display: block; margin-bottom: 14px;
}
.section h2 {
  font-size: 32px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15;
  color: var(--text);
}
.section-sub { font-size: 18px; margin-top: 16px; color: var(--text-muted); line-height: 1.6; }
.section-sub strong { font-weight: 500; color: var(--text); }
.section-sub a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-strong); }
.section-sub a:hover { text-decoration-color: var(--text); }

code { color: var(--text); }
.section-light code, .section-dark code, .cmd-table code {
  background: var(--surface); color: var(--text);
  padding: 2px 6px; border-radius: 5px; border: 1px solid var(--border);
}

/* ============ OVERVIEW / PLANES ============ */
.plane-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; max-width: var(--maxw); margin: 0 auto; }
.plane-card {
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: 16px; padding: 32px;
  transition: border-color .2s;
}
.section-dark .plane-card { background: var(--surface); }
.plane-card:hover { border-color: var(--border-strong); }
.plane-tag {
  display: inline-block; font-size: 12px; font-weight: 600;
  letter-spacing: .03em; padding: 5px 13px; border-radius: 999px; margin-bottom: 18px;
  border: 0; color: #fff;
}
.plane-tag-data { background: var(--grad-orange); }
.plane-tag-ctrl { background: var(--grad-blue); }
.plane-card h3 { font-size: 22px; font-weight: 600; margin-bottom: 14px; color: var(--text); }
.plane-card p { color: var(--text-muted); margin-bottom: 12px; }
.plane-note { font-size: 14px; color: var(--text-dim); border-left: 1px solid var(--border-strong); padding-left: 16px; }

.invariant {
  margin: 20px auto 0; max-width: var(--maxw);
  background: var(--surface); color: var(--text);
  border-radius: 16px; padding: 32px; border: 1px solid var(--border);
  display: flex; gap: 24px; align-items: flex-start;
}
.invariant-badge {
  flex: none; font-size: 12px; font-weight: 500;
  letter-spacing: .03em; color: var(--action-text); background: var(--action);
  padding: 6px 12px; border-radius: 999px; margin-top: 2px;
}
.invariant p { color: var(--text-muted); font-size: 16px; }
.invariant strong { color: var(--text); font-weight: 500; }
.invariant code, .invariant em { color: var(--text); font-style: normal; }

/* ============ FEATURES ============ */
.feature-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--border); border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden; max-width: var(--maxw); margin: 0 auto;
}
.feature {
  background: var(--bg-alt); padding: 28px; position: relative;
  transition: background .2s;
}
.section-dark .feature { background: var(--bg-alt); }
.feature:hover { background: var(--surface); }
.feature-ic {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin-bottom: 18px;
  color: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
/* each feature gets its own colourful gradient tile */
.feature:nth-child(8n+1) .feature-ic { background: var(--grad-blue); }
.feature:nth-child(8n+2) .feature-ic { background: var(--grad-orange); }
.feature:nth-child(8n+3) .feature-ic { background: var(--grad-green); }
.feature:nth-child(8n+4) .feature-ic { background: var(--grad-violet); }
.feature:nth-child(8n+5) .feature-ic { background: var(--grad-teal); }
.feature:nth-child(8n+6) .feature-ic { background: var(--grad-coral); }
.feature:nth-child(8n+7) .feature-ic { background: var(--grad-sky); }
.feature:nth-child(8n+8) .feature-ic { background: var(--grad-gold); }
.feature-ic svg { width: 22px; height: 22px; display: block; }
.feature h3 { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.feature p { font-size: 14px; color: var(--text-muted); line-height: 1.55; }
.feature code { font-size: 12px; }

/* ============ ARCHITECTURE DIAGRAM ============ */
.diagram {
  border: 1px solid var(--border); border-radius: 16px;
  background: var(--bg-alt); padding: 32px; max-width: var(--maxw); margin: 0 auto;
}
.diag-row { display: flex; justify-content: center; }
.diag-arrow { text-align: center; color: var(--text-dim); font-size: 18px; padding: 8px 0; }
.diag-box {
  border: 1px solid var(--border); border-radius: 10px; padding: 16px 20px;
  background: var(--surface); text-align: center; min-width: 0;
}
.diag-title { display: block; font-weight: 600; font-size: 14px; color: var(--text); }
.diag-items { display: block; font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.box-client, .box-edge, .box-provider { background: var(--surface); border-color: var(--border); }
.box-store { background: var(--surface-2); border-color: var(--border-strong); }
.box-store .diag-title { color: var(--text); }
.box-store .diag-items { color: var(--text-muted); }

.diag-cols {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 6px 0;
}
.diag-plane { border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.diag-plane-data { background: var(--bg); border: 1px dashed var(--border-strong); }
.diag-plane-ctrl { background: var(--bg); border: 1px dashed var(--border-strong); }
.diag-plane-label {
  font-size: 12px; font-weight: 500; letter-spacing: .03em;
  text-align: center; margin-bottom: 2px; color: var(--text-muted);
}
.box-proxy, .box-hooks, .box-cache, .box-ctrl { border-color: var(--border); }

.diag-caption { font-size: 14px; color: var(--text-dim); margin-top: 20px; text-align: center; }

/* ============ QUICKSTART STEPS ============ */
.steps { display: flex; flex-direction: column; gap: 24px; max-width: var(--maxw); margin: 0 auto; }
.step { display: flex; gap: 22px; align-items: flex-start; }
.step-n {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: transparent; color: var(--text); border: 1px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  font-weight: 500; font-size: 15px; margin-top: 2px;
}
.step-body { flex: 1; min-width: 0; }
.step-body h3 { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.step-note { color: var(--text-muted); font-size: 15px; margin-bottom: 14px; }
.step-note a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

/* code blocks */
.code {
  position: relative;
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden;
}
.section-dark .code { background: var(--bg); }
.code pre { padding: 18px 20px; overflow-x: auto; }
.code code {
  font-family: var(--mono); font-size: 13px; line-height: 1.75; color: var(--text-muted);
  background: none; padding: 0; border: 0;
}
.code-light { background: var(--bg-alt); }
.copy-btn {
  position: absolute; top: 10px; right: 10px;
  background: var(--surface); color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 999px;
  font-size: 11px; font-weight: 500; padding: 4px 12px; cursor: pointer;
  transition: background .2s, color .2s;
}
.copy-btn:hover { background: var(--surface-2); color: var(--text); }
.copy-btn.copied { background: var(--action); color: var(--action-text); border-color: var(--action); }

.callout {
  margin: 40px auto 0; max-width: var(--maxw); background: var(--surface);
  border: 1px solid var(--border); border-left: 2px solid var(--text-muted);
  border-radius: 12px; padding: 18px 22px; font-size: 15px; color: var(--text-muted);
}
.callout strong { color: var(--text); font-weight: 500; }

/* ============ RUN TABLE ============ */
.table-wrap { border: 1px solid var(--border); border-radius: 16px; overflow: hidden; max-width: var(--maxw); margin: 0 auto; }
.cmd-table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--bg-alt); }
.cmd-table thead th {
  background: var(--surface); text-align: left; font-size: 12px;
  letter-spacing: .03em; color: var(--text-muted); padding: 14px 20px; border-bottom: 1px solid var(--border);
  font-weight: 500;
}
.cmd-table td { padding: 13px 20px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--text-muted); }
.cmd-table tbody tr:last-child td { border-bottom: 0; }
.cmd-table td:first-child { white-space: nowrap; width: 190px; }
.cmd-table td:first-child code { font-weight: 500; }

/* ============ DEPLOY ============ */
.deploy-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; max-width: var(--maxw); margin: 0 auto; }
.deploy-card {
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: 16px; padding: 28px;
}
.deploy-card h3 { font-size: 20px; font-weight: 600; color: var(--text); }
.deploy-sub { font-size: 13px; color: var(--text-dim); margin: 4px 0 18px; }

/* ============ STACK ============ */
.stack-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; max-width: var(--maxw); margin: 0 auto; }
.stack-item {
  display: flex; gap: 18px; align-items: baseline;
  border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; background: var(--bg-alt);
}
.stack-k {
  flex: none; width: 96px; font-weight: 500; color: var(--text);
  letter-spacing: .02em; font-size: 12px;
}
.stack-v { font-size: 14px; color: var(--text-muted); }

/* ============ CTA ============ */
.cta {
  position: relative; isolation: isolate; overflow: hidden;
  background: var(--bg-alt);
  color: var(--text); padding: 112px 0; text-align: center;
  border-top: 1px solid var(--border);
}
.cta::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(38% 80% at 12% 50%, rgba(124, 140, 255, 0.22), transparent 60%),
    radial-gradient(40% 90% at 88% 50%, rgba(255, 122, 24, 0.20), transparent 62%),
    radial-gradient(50% 70% at 50% 120%, rgba(31, 157, 85, 0.16), transparent 60%);
}
.cta-inner h2 { font-size: 36px; font-weight: 600; letter-spacing: -0.02em; }
.cta-inner p { color: var(--text-muted); font-size: 18px; max-width: 52ch; margin: 16px auto 0; }
.cta .hero-cta { justify-content: center; margin-top: 36px; }

/* ============ FOOTER ============ */
.footer { background: var(--bg); color: var(--text-muted); padding: 48px 0; border-top: 1px solid var(--border); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 32px; }
.footer-brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 600; }
.footer-links { display: flex; gap: 24px; margin-left: auto; flex-wrap: wrap; }
.footer-links a { color: var(--text-muted); font-size: 14px; }
.footer-links a:hover { color: var(--text); }
.footer-note { flex-basis: 100%; font-size: 13px; color: var(--text-dim); border-top: 1px solid var(--border); padding-top: 18px; }

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .nav, .topbar-actions { display: none; }
  .nav-toggle { display: flex; margin-left: 8px; }
  .theme-toggle { margin-left: auto; }
  .topbar.open .nav {
    display: flex; flex-direction: column; gap: 0;
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--border); padding: 8px;
  }
  .topbar.open .nav a { padding: 12px; border-bottom: 1px solid var(--border); border-radius: 0; }
  .hero { padding: 88px var(--gutter) 64px; }
  .hero h1 { font-size: 38px; }
  .plane-grid, .diag-cols, .deploy-grid, .stack-grid { grid-template-columns: 1fr; }
  .invariant { flex-direction: column; gap: 16px; }
  .section h2, .cta-inner h2 { font-size: 28px; }
}
@media (max-width: 560px) {
  .hero { padding: 64px var(--gutter) 48px; }
  .hero h1 { font-size: 30px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .section { padding: 64px 0; }
  .step { gap: 16px; }
  /* Give diagrams more room on narrow screens so labels don't clip mid-word. */
  .diagram { padding: 18px; }
  .diag-plane { padding: 12px; }
  .diag-box { padding: 12px 14px; }
}

/* ============================================================
   GUIDE PAGE — step-by-step docs (sidebar TOC + content)
   ============================================================ */
.guide-header {
  position: relative; isolation: isolate; overflow: hidden;
  padding: 88px var(--gutter) 40px; text-align: center;
  border-bottom: 1px solid var(--border);
}
.guide-header::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(38% 90% at 15% 0%, rgba(124, 140, 255, 0.20), transparent 60%),
    radial-gradient(38% 90% at 85% 0%, rgba(255, 122, 24, 0.16), transparent 62%);
}
.guide-header .eyebrow { margin-bottom: 18px; }
.guide-header h1 {
  font-size: 40px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1;
}
.guide-header p { color: var(--text-muted); font-size: 18px; max-width: 60ch; margin: 16px auto 0; }

.guide-shell {
  max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: 232px 1fr; gap: 56px;
  padding: 48px var(--gutter) 112px;
}

/* sidebar table of contents */
.guide-toc { position: sticky; top: calc(var(--nav-h) + 24px); align-self: start; }
.guide-toc-title {
  font-size: 12px; font-weight: 500; letter-spacing: .04em; color: var(--text-dim);
  text-transform: uppercase; margin-bottom: 14px;
}
.guide-toc ol { list-style: none; display: flex; flex-direction: column; gap: 2px; counter-reset: toc; }
.guide-toc a {
  display: block; padding: 7px 12px; border-radius: 8px;
  font-size: 14px; color: var(--text-muted); border-left: 2px solid transparent;
  transition: color .2s, background .2s;
}
.guide-toc a:hover { color: var(--text); background: var(--surface); }
.guide-toc a.active {
  color: var(--text); background: var(--surface);
  border-left-color: transparent;
  background-image: linear-gradient(var(--surface), var(--surface)), var(--grad-accent);
  background-origin: border-box; background-clip: padding-box, border-box;
  border-left: 2px solid transparent;
}

/* content column */
.guide-main { min-width: 0; max-width: 760px; }
.guide-intro { color: var(--text-muted); font-size: 17px; margin-bottom: 8px; }
.guide-intro strong { color: var(--text); font-weight: 500; }

.step-block { padding-top: 40px; margin-top: 40px; border-top: 1px solid var(--border); scroll-margin-top: calc(var(--nav-h) + 24px); }
.step-block:first-of-type { border-top: 0; margin-top: 16px; padding-top: 0; }
.step-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.step-num {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; color: #fff; background: var(--grad-accent);
}
.step-icon {
  flex: none; width: 30px; height: 30px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
  background: var(--surface); border: 1px solid var(--border);
}
.step-head h2 { font-size: 24px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; }
.step-block p { color: var(--text-muted); font-size: 16px; margin: 12px 0; }
.step-block p strong { color: var(--text); font-weight: 500; }
.step-block ul { color: var(--text-muted); font-size: 16px; margin: 12px 0 12px 4px; padding-left: 20px; }
.step-block li { margin: 6px 0; }
.step-block li strong { color: var(--text); font-weight: 500; }

/* screenshot figures */
figure.shot { margin: 22px 0; }
figure.shot .frame {
  border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
  background: var(--bg-alt); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}
:root[data-theme="light"] figure.shot .frame { box-shadow: 0 8px 30px rgba(0, 0, 0, 0.10); }
figure.shot img { display: block; width: 100%; height: auto; }
figure.shot figcaption { font-size: 13px; color: var(--text-dim); margin-top: 10px; text-align: center; }

/* inline code + code blocks inside the guide */
.guide-main code { background: var(--surface); border: 1px solid var(--border); color: var(--text); padding: 2px 6px; border-radius: 5px; font-size: 13px; }
.guide-main .code { margin: 18px 0; }
.guide-main .code code { background: none; border: 0; padding: 0; }

/* hint / note callout */
.hint {
  display: flex; gap: 14px; margin: 20px 0;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 2px solid transparent; border-radius: 12px; padding: 16px 18px;
}
.hint .hint-ic { flex: none; font-size: 15px; line-height: 1.5; }
.hint p { margin: 0; font-size: 15px; color: var(--text-muted); }
.hint strong { color: var(--text); font-weight: 500; }
.hint code { font-size: 12.5px; }

/* part divider */
.guide-part { margin: 72px 0 8px; padding-top: 40px; border-top: 1px solid var(--border); }
.guide-part-kicker {
  display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; margin-bottom: 12px;
  background: var(--grad-accent); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.guide-part h2 { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.guide-part p { color: var(--text-muted); font-size: 17px; margin-top: 12px; }
.guide-part + .step-block { border-top: 0; margin-top: 24px; padding-top: 0; }

/* guide footer nav */
.guide-next {
  display: flex; flex-wrap: wrap; gap: 14px; margin-top: 48px; padding-top: 32px;
  border-top: 1px solid var(--border);
}

@media (max-width: 860px) {
  .guide-shell { grid-template-columns: 1fr; gap: 0; padding-top: 32px; }
  .guide-toc { display: none; }
  .guide-header h1 { font-size: 30px; }
}
