/* ============================================================
   Agent Pi DSH — Design System
   Dark-first, themeable via [data-theme], bilingual via [lang]
   ============================================================ */

:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;

  --maxw: 1180px;
  --radius: 16px;
  --radius-sm: 10px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Dark (default) ---------- */
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #06090f;
  --bg-elev: #0b101b;
  --surface: #0d1420;
  --surface-2: #111a2a;
  --border: rgba(148, 163, 184, 0.13);
  --border-strong: rgba(148, 163, 184, 0.24);
  --text: #e8edf6;
  --text-dim: #97a5bc;
  --text-faint: #5d6c85;
  --accent: #4f8dff;
  --accent-2: #3ad6e8;
  --accent-ink: #bcd6ff;
  --accent-soft: rgba(79, 141, 255, 0.12);
  --grad: linear-gradient(100deg, #4f8dff 0%, #3ad6e8 100%);
  --glow: rgba(62, 123, 250, 0.35);
  --shadow-lg: 0 24px 64px -16px rgba(2, 6, 16, 0.7);
  --shadow-sm: 0 4px 18px -6px rgba(2, 6, 16, 0.5);
  --code-bg: #0a0f18;
  --nav-bg: rgba(6, 9, 15, 0.72);
  --hero-img: url("../img/hero-dark-v2.jpg");
}

/* ---------- Light ---------- */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f8fc;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f0f4fa;
  --border: rgba(15, 33, 66, 0.09);
  --border-strong: rgba(15, 33, 66, 0.18);
  --text: #0d1830;
  --text-dim: #4d5f7d;
  --text-faint: #8593ab;
  --accent: #2f6df0;
  --accent-2: #0faeC4;
  --accent-ink: #1d4fd0;
  --accent-soft: rgba(47, 109, 240, 0.09);
  --grad: linear-gradient(100deg, #2f6df0 0%, #0fb5c9 100%);
  --glow: rgba(47, 109, 240, 0.18);
  --shadow-lg: 0 24px 60px -20px rgba(15, 33, 66, 0.22);
  --shadow-sm: 0 4px 16px -6px rgba(15, 33, 66, 0.12);
  --code-bg: #0d1830;
  --nav-bg: rgba(246, 248, 252, 0.78);
  --hero-img: url("../img/hero-light-v2.jpg");
}

/* ---------- Language visibility ---------- */
html[data-lang="zh"] [data-lang="en"] { display: none !important; }
html[data-lang="en"] [data-lang="zh"] { display: none !important; }

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.35s var(--ease), color 0.35s var(--ease);
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 0.5em; font-weight: 700; }
h1 { font-size: clamp(2.3rem, 5.2vw, 3.9rem); letter-spacing: -0.035em; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); letter-spacing: -0.03em; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.mono { font-family: var(--font-mono); }
.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: var(--nav-bg);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background 0.35s var(--ease);
}
.nav.scrolled { border-bottom-color: var(--border); }
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 24px;
  height: 68px; display: flex; align-items: center; gap: 28px;
}
.company-logo { height: 24px; width: auto; margin-right: 20px; }
html[data-theme="dark"] .company-logo { filter: brightness(1.4) saturate(0.9); }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 1.06rem; color: var(--text); letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; object-fit: contain; }
.brand small { color: var(--text-faint); font-weight: 500; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }
.nav-links { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav-links a {
  color: var(--text-dim); font-size: 0.92rem; font-weight: 500;
  padding: 8px 13px; border-radius: 9px; transition: color 0.2s, background 0.2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--accent-soft); text-decoration: none; }

.language-picker {
  height: 38px; display: inline-flex; align-items: center; gap: 6px;
  padding: 0 8px; border: 1px solid var(--border); border-radius: 10px;
  color: var(--text-dim); background: var(--surface); cursor: pointer;
  transition: all 0.2s var(--ease);
}
.language-picker:hover { border-color: var(--border-strong); color: var(--text); transform: translateY(-1px); }
.language-picker svg { flex: 0 0 auto; }
.language-picker select {
  max-width: 112px; border: 0; outline: 0; appearance: none;
  color: inherit; background: transparent; font: inherit; font-size: 0.82rem;
  font-weight: 600; cursor: pointer;
}
.language-picker option { color: var(--text); background: var(--surface); }
html[dir="rtl"] body { direction: rtl; }
html[dir="rtl"] .nav-inner,
html[dir="rtl"] .hero-cta,
html[dir="rtl"] .footer-bottom { direction: rtl; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-dim); cursor: pointer; font-size: 0.86rem; font-weight: 600;
  transition: all 0.2s var(--ease); font-family: var(--font-sans);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); }
.lang-btn { width: auto; padding: 0 13px; gap: 6px; }

.hamburger { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 13px 26px; border-radius: 12px;
  font-weight: 600; font-size: 0.98rem; cursor: pointer;
  border: 1px solid transparent; transition: all 0.25s var(--ease);
  font-family: var(--font-sans); white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 10px 30px -8px var(--glow); }
.btn-primary:hover { box-shadow: 0 16px 40px -8px var(--glow); color: #fff; }
.btn-ghost { border-color: var(--border-strong); color: var(--text); background: transparent; }
.btn-ghost:hover { background: var(--accent-soft); border-color: var(--accent); }
.btn svg { width: 17px; height: 17px; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: 190px 0 110px;
  background: var(--bg);
}
.hero-bg {
  position: absolute; inset: 0; z-index: 0;
  background-image: var(--hero-img);
  background-size: cover; background-position: center;
  opacity: 0.55;
  -webkit-mask-image: linear-gradient(to bottom, black 30%, transparent 96%);
  mask-image: linear-gradient(to bottom, black 30%, transparent 96%);
}
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(60% 50% at 50% 0%, var(--glow), transparent 70%);
}
/* decorative grid + glow that works even without generated images */
.hero-grid {
  position: absolute; inset: 0; z-index: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(70% 60% at 50% 20%, black, transparent 75%);
  mask-image: radial-gradient(70% 60% at 50% 20%, black, transparent 75%);
  opacity: 0.5;
}
.hero-inner { position: relative; z-index: 1; text-align: center; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.82rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent-ink);
  border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 7px 16px; margin-bottom: 26px;
  background: var(--accent-soft);
  backdrop-filter: blur(6px);
}
.hero-eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--grad); box-shadow: 0 0 12px var(--accent); }
.hero p.lead {
  max-width: 680px; margin: 0 auto 38px;
  font-size: clamp(1.05rem, 2vw, 1.28rem); color: var(--text-dim);
}
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-meta { margin-top: 30px; font-size: 0.86rem; color: var(--text-faint); }
.hero-logo {
  width: clamp(130px, 15vw, 180px); height: auto; margin: 0 auto 30px;
  filter: drop-shadow(0 14px 34px var(--glow));
}
.studio-logo { height: 34px; width: auto; opacity: 0.92; }
.hero-meta code { font-family: var(--font-mono); font-size: 0.82em; color: var(--text-dim); background: var(--accent-soft); padding: 2px 8px; border-radius: 6px; }

/* ---------- Sections ---------- */
.section { padding: 100px 0; position: relative; }
.section.tight { padding: 70px 0; }
.section-head { max-width: 700px; margin: 0 auto 60px; text-align: center; }
.section-head p { color: var(--text-dim); font-size: 1.06rem; }
.kicker {
  font-size: 1.15rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent-ink); display: block; margin-bottom: 14px;
}

/* ---------- Stats strip ---------- */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--border); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.stat { background: var(--surface); padding: 30px 26px; }
.stat b { display: block; font-size: 1.9rem; letter-spacing: -0.03em; font-weight: 750; }
.stat b em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat span { color: var(--text-dim); font-size: 0.9rem; }

/* ---------- Feature grid ---------- */
.grid { display: grid; gap: 20px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 30px 28px;
  transition: transform 0.3s var(--ease), border-color 0.3s, box-shadow 0.3s;
  position: relative; overflow: hidden;
}
.card:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.card .ico {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; margin-bottom: 18px;
}
.card .ico svg { width: 22px; height: 22px; }
.card h3 { margin-bottom: 8px; }
.card p { color: var(--text-dim); font-size: 0.95rem; margin: 0; }
.card .tag {
  position: absolute; top: 20px; right: 20px;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent-ink); background: var(--accent-soft);
  padding: 4px 10px; border-radius: 999px;
}

/* ---------- Domain cards (tender/delivery/investment) ---------- */
.domain { padding: 36px 32px; }
.domain .num { font-family: var(--font-mono); color: var(--text-faint); font-size: 0.82rem; letter-spacing: 0.1em; }
.domain ul { margin: 14px 0 0; padding: 0; list-style: none; }
.domain li { color: var(--text-dim); font-size: 0.92rem; padding: 6px 0 6px 24px; position: relative; }
.domain li::before {
  content: ""; position: absolute; left: 2px; top: 14px;
  width: 10px; height: 2px; background: var(--grad); border-radius: 2px;
}

/* ---------- Diagram / architecture ---------- */
.diagram-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 40px 32px; box-shadow: var(--shadow-lg);
}
.diagram-wrap svg { width: 100%; height: auto; display: block; }
svg .d-box { fill: var(--surface-2); stroke: var(--border-strong); }
svg .d-box-accent { fill: var(--accent-soft); stroke: var(--accent); }
svg .d-text { fill: var(--text); font-family: var(--font-sans); font-weight: 600; }
svg .d-dim { fill: var(--text-dim); font-family: var(--font-sans); }
svg .d-mono { fill: var(--text-dim); font-family: var(--font-mono); }
svg .d-line { stroke: var(--border-strong); }
svg .d-line-accent { stroke: url(#gradStroke); }
svg .d-accent { fill: var(--accent); }

/* ---------- Split showcase ---------- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: center; }
.split .shot {
  border-radius: 18px; overflow: hidden; border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
}
.checklist { list-style: none; margin: 22px 0 0; padding: 0; }
.checklist li { display: flex; gap: 12px; padding: 9px 0; color: var(--text-dim); font-size: 0.97rem; }
.checklist li svg { flex: 0 0 20px; width: 20px; height: 20px; color: var(--accent-2); margin-top: 3px; }
.checklist li b { color: var(--text); font-weight: 600; }

/* ---------- Steps ---------- */
.steps { counter-reset: step; display: grid; gap: 0; }
.step {
  display: grid; grid-template-columns: 56px 1fr; gap: 20px;
  padding: 22px 0; border-bottom: 1px solid var(--border);
}
.step:last-child { border-bottom: 0; }
.step::before {
  counter-increment: step; content: counter(step, decimal-leading-zero);
  font-family: var(--font-mono); font-size: 0.95rem; color: var(--accent);
  width: 44px; height: 44px; border: 1px solid var(--border-strong); border-radius: 12px;
  display: flex; align-items: center; justify-content: center; background: var(--accent-soft);
}
.step h3 { font-size: 1.06rem; margin-bottom: 4px; }
.step p { color: var(--text-dim); font-size: 0.94rem; margin: 0; }

/* ---------- Code / terminal ---------- */
.code {
  background: var(--code-bg); border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: var(--radius-sm); padding: 18px 20px;
  font-family: var(--font-mono); font-size: 0.86rem; line-height: 1.7;
  color: #c8d6ee; overflow-x: auto; margin: 14px 0;
}
.code .c { color: #61718e; }
.code .g { color: #4ade80; }

/* ---------- Table ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 0.93rem; margin: 18px 0; }
.tbl th, .tbl td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl th { color: var(--text-faint); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; }
.tbl td { color: var(--text-dim); }
.tbl td:first-child { color: var(--text); font-weight: 600; white-space: nowrap; }

/* ---------- CTA banner ---------- */
.cta-banner {
  position: relative; overflow: hidden;
  border-radius: 24px; border: 1px solid var(--border-strong);
  padding: 70px 40px; text-align: center;
  background: var(--surface);
}
.cta-banner::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(70% 120% at 50% -20%, var(--glow), transparent 70%);
}
.cta-banner > * { position: relative; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 56px 0 40px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; }
.footer h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-faint); margin-bottom: 14px; }
.footer a { display: block; color: var(--text-dim); font-size: 0.92rem; padding: 4px 0; }
.footer a:hover { color: var(--text); }
.footer-bottom a, .footer p a { display: inline; padding: 0; }
.footer-bottom {
  margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  color: var(--text-faint); font-size: 0.85rem;
}

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Latest release panel ---------- */
.rl-panel { margin: 8px auto 6px; max-width: 920px; text-align: left; }
.rl-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; margin-bottom: 18px; text-align: center; }
.rl-pill {
  font-family: var(--font-mono); font-weight: 600; font-size: 0.95rem;
  background: var(--grad); color: #fff; padding: 5px 14px; border-radius: 999px;
}
.rl-date { color: var(--text-faint); font-size: 0.86rem; }
.rl-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 13px 16px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg-elev); margin-bottom: 10px;
}
.rl-row .rl-name { font-family: var(--font-mono); font-size: 0.84rem; word-break: break-all; flex: 1 1 260px; color: var(--text); }
.rl-row .rl-size { color: var(--text-faint); font-size: 0.8rem; font-family: var(--font-mono); white-space: nowrap; }
.rl-row .rl-kind { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-ink); background: var(--accent-soft); border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.rl-btns { display: flex; gap: 7px; flex-wrap: wrap; }
.rl-btns a {
  font-size: 0.82rem; font-weight: 600; padding: 7px 13px; border-radius: 9px;
  border: 1px solid var(--border-strong); color: var(--text-dim); white-space: nowrap;
  transition: all 0.2s var(--ease);
}
.rl-btns a:hover { color: var(--text); border-color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.rl-btns a.primary { background: var(--grad); color: #fff; border-color: transparent; }
.rl-btns a.primary:hover { color: #fff; box-shadow: 0 8px 22px -8px var(--glow); }
.rl-note { text-align: center; color: var(--text-faint); font-size: 0.84rem; margin-top: 14px; }
.rl-note code { font-family: var(--font-mono); font-size: 0.82em; background: var(--accent-soft); color: var(--accent-ink); padding: 2px 8px; border-radius: 6px; }
.hero-meta [data-release-sha] { word-break: break-all; user-select: all; }

/* ---------- Comparison table ---------- */
.tbl.vs th:last-child, .tbl.vs td:last-child {
  background: var(--accent-soft); color: var(--text);
}
.tbl.vs th:last-child { color: var(--accent-ink); }

.tbl.cost { table-layout: fixed; }
.tbl.cost th:nth-child(1), .tbl.cost td:nth-child(1) { width: 17%; }
.tbl.cost th:nth-child(2), .tbl.cost td:nth-child(2) { width: 60%; }
.tbl.cost th:nth-child(3), .tbl.cost td:nth-child(3) { width: 23%; }

/* ---------- Showcase ---------- */
.sim-frame {
  border-radius: 18px; overflow: hidden; border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg); background: #0b1220;
}
.sim-frame iframe { width: 100%; height: 560px; border: 0; display: block; }
.sim-cap {
  display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 4px 0; color: var(--text-dim); font-size: 0.92rem;
}
.sc-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-top: 34px; }
.sc-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: transform 0.3s var(--ease), border-color 0.3s;
}
.sc-card:hover { transform: translateY(-4px); border-color: var(--border-strong); }
.sc-card img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; }
.sc-card .sc-cap { padding: 14px 18px; font-size: 0.9rem; color: var(--text-dim); }
.sc-card .sc-cap b { color: var(--text); display: block; font-size: 0.95rem; }
@media (max-width: 600px) { .sc-grid { grid-template-columns: 1fr; } .sim-frame iframe { height: 420px; } }

/* ---------- Flow canvas (hero + bottom band) ---------- */
.hero-canvas { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; pointer-events: none; }
.hero-video {
  position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 22%; opacity: 0.9; pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, black 55%, transparent 98%);
  mask-image: linear-gradient(to bottom, black 55%, transparent 98%);
}
.hero-video--dark { filter: brightness(0.62) saturate(1.05); }
.hero-video--light { visibility: hidden; opacity: 0.85; }
html[data-theme="light"] .hero-video--dark { visibility: hidden; }
html[data-theme="light"] .hero-video--light { visibility: visible; }
.hero-veil {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(to bottom, transparent 42%, rgba(6, 9, 15, 0.38) 74%, rgba(6, 9, 15, 0.72));
}
html[data-theme="light"] .hero-veil {
  background: linear-gradient(to bottom, rgba(246, 248, 252, 0.92) 0%, rgba(246, 248, 252, 0.55) 45%, rgba(246, 248, 252, 0.12) 80%, rgba(246, 248, 252, 0.3));
}
html[data-theme="dark"] .hero-inner h1,
html[data-theme="dark"] .hero-inner .lead,
html[data-theme="dark"] .hero-logo { text-shadow: 0 2px 26px rgba(6, 9, 15, 0.9), 0 0 8px rgba(6, 9, 15, 0.6); }
html[data-theme="dark"] .hero-logo { filter: drop-shadow(0 14px 34px var(--glow)) drop-shadow(0 2px 10px rgba(6, 9, 15, 0.8)); }
/* dark hero: warm engineering-amber headline contrast + brighter lead over the video */
html[data-theme="dark"] .hero h1 .grad-text {
  background: linear-gradient(180deg, #e6ffef 0%, #6ff08d 42%, #23c26a 78%, #149b4e 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow:
    0 1px 0 #0f8a44, 0 2px 0 #0d7d3d, 0 3px 0 #0b6f36, 0 4px 0 #0a6130,
    0 7px 16px rgba(0, 0, 0, 0.65), 0 0 34px rgba(46, 217, 123, 0.35);
}
html[data-theme="dark"] .hero .lead { color: #d9e2f2; }

.flow-band { position: relative; overflow: hidden; background: #06090f; padding: 110px 0; }
.flow-band > .flow-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.flow-band .container { position: relative; z-index: 1; }
.cta-banner.on-flow {
  background: rgba(11, 16, 27, 0.62); border-color: rgba(148, 163, 184, 0.28);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.cta-banner.on-flow::before { background: radial-gradient(70% 120% at 50% -20%, rgba(62, 123, 250, 0.28), transparent 70%); }
.cta-banner.on-flow h2 { color: #e8edf6; }
.cta-banner.on-flow .kicker { color: #bcd6ff; }
.cta-banner.on-flow p { color: #97a5bc !important; }
.cta-banner.on-flow .btn-ghost { border-color: rgba(148, 163, 184, 0.4); color: #e8edf6; }
.cta-banner.on-flow .btn-ghost:hover { background: rgba(79, 141, 255, 0.16); border-color: #4f8dff; }
.cta-banner.on-flow .hero-meta { color: #5d6c85; }
.cta-banner.on-flow .hero-meta a { color: #8fb6ff; }
.cta-banner.on-flow .hero-meta code { background: rgba(79, 141, 255, 0.14); color: #bcd6ff; }
.cta-banner.on-flow .rl-row { background: rgba(17, 26, 42, 0.8); border-color: rgba(148, 163, 184, 0.2); }
.cta-banner.on-flow .rl-row .rl-name { color: #e8edf6; }
.cta-banner.on-flow .rl-btns a { color: #97a5bc; border-color: rgba(148, 163, 184, 0.3); }
.cta-banner.on-flow .rl-btns a:hover { color: #fff; border-color: #4f8dff; background: rgba(79, 141, 255, 0.15); }
.cta-banner.on-flow .rl-note { color: #5d6c85; }

/* light theme: band follows the light palette */
html[data-theme="light"] .flow-band { background: linear-gradient(180deg, #eaf1fa 0%, #dde9f8 100%); }
html[data-theme="light"] .cta-banner.on-flow { background: rgba(255, 255, 255, 0.72); border-color: rgba(15, 33, 66, 0.12); }
html[data-theme="light"] .cta-banner.on-flow::before { background: radial-gradient(70% 120% at 50% -20%, rgba(47, 109, 240, 0.14), transparent 70%); }
html[data-theme="light"] .cta-banner.on-flow h2 { color: #0d1830; }
html[data-theme="light"] .cta-banner.on-flow .kicker { color: #1d4fd0; }
html[data-theme="light"] .cta-banner.on-flow p { color: #4d5f7d !important; }
html[data-theme="light"] .cta-banner.on-flow .btn-ghost { border-color: rgba(15, 33, 66, 0.18); color: #0d1830; }
html[data-theme="light"] .cta-banner.on-flow .btn-ghost:hover { background: rgba(47, 109, 240, 0.09); border-color: #2f6df0; }
html[data-theme="light"] .cta-banner.on-flow .hero-meta { color: #8593ab; }
html[data-theme="light"] .cta-banner.on-flow .hero-meta a { color: #2f6df0; }
html[data-theme="light"] .cta-banner.on-flow .hero-meta code { background: rgba(47, 109, 240, 0.09); color: #1d4fd0; }
html[data-theme="light"] .cta-banner.on-flow .rl-row { background: rgba(255, 255, 255, 0.8); border-color: rgba(15, 33, 66, 0.09); }
html[data-theme="light"] .cta-banner.on-flow .rl-row .rl-name { color: #0d1830; }
html[data-theme="light"] .cta-banner.on-flow .rl-btns a { color: #4d5f7d; border-color: rgba(15, 33, 66, 0.18); }
html[data-theme="light"] .cta-banner.on-flow .rl-btns a:hover { color: #0d1830; border-color: #2f6df0; background: rgba(47, 109, 240, 0.09); }
html[data-theme="light"] .cta-banner.on-flow .rl-note { color: #8593ab; }

/* ============================================================
   Docs layout
   ============================================================ */
.docs-layout {
  display: grid; grid-template-columns: 264px minmax(0, 1fr);
  gap: 56px; padding-top: 68px; min-height: 100vh;
}
.docs-side {
  position: sticky; top: 68px; align-self: start;
  height: calc(100vh - 68px); overflow-y: auto;
  padding: 36px 8px 40px 0;
  border-right: 1px solid var(--border);
  scrollbar-width: thin;
}
.docs-side .side-group { margin-bottom: 26px; }
.docs-side .side-title {
  font-size: 0.74rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--text-faint); margin: 0 0 8px; padding: 0 14px;
}
.docs-side a.side-link {
  display: block; padding: 7px 14px; border-radius: 9px;
  color: var(--text-dim); font-size: 0.92rem; border-left: 2px solid transparent;
}
.docs-side a.side-link:hover { color: var(--text); background: var(--accent-soft); text-decoration: none; }
.docs-side a.side-link.active { color: var(--accent-ink); background: var(--accent-soft); font-weight: 600; }

.docs-main { padding: 44px 24px 100px; max-width: 800px; }
.docs-main section.doc { margin-bottom: 84px; scroll-margin-top: 92px; }
.docs-main h2 { font-size: 1.75rem; padding-bottom: 14px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.docs-main h3 { margin-top: 34px; }
.docs-main p, .docs-main li { color: var(--text-dim); }
.docs-main b, .docs-main strong { color: var(--text); }
.docs-main ul, .docs-main ol { padding-left: 22px; }
.docs-main li { margin-bottom: 7px; }
.docs-main code:not(.code code) {
  font-family: var(--font-mono); font-size: 0.85em;
  background: var(--accent-soft); color: var(--accent-ink);
  padding: 2px 7px; border-radius: 6px;
}
.callout {
  border: 1px solid var(--border-strong); border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 12px 12px 0;
  padding: 16px 20px; margin: 20px 0; font-size: 0.94rem;
}
.callout.warn { border-left-color: #e8a33a; }
.callout p { margin: 0; color: var(--text-dim); }
.callout b { color: var(--text); }

.docs-mobile-toc { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .company-logo { height: 17px; margin-right: 10px; }
  .brand { flex-shrink: 0; white-space: nowrap; }
  .nav-inner { gap: 10px; }
  .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; gap: 36px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }

  .nav-links { display: none; }
  .hamburger { display: inline-flex; }
  .nav.open .nav-links {
    display: flex; flex-direction: column; align-items: stretch;
    position: absolute; top: 68px; left: 0; right: 0;
    background: var(--bg-elev); border-bottom: 1px solid var(--border);
    padding: 14px 20px 20px; gap: 4px;
    box-shadow: var(--shadow-lg);
  }
  .nav.open .nav-links a { padding: 12px 14px; font-size: 1rem; }

  .docs-layout { grid-template-columns: 1fr; gap: 0; }
  .docs-side { display: none; }
  .docs-mobile-toc {
    display: block; position: sticky; top: 68px; z-index: 50;
    background: var(--nav-bg); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border); padding: 10px 24px;
  }
  .docs-mobile-toc select {
    width: 100%; padding: 10px 14px; border-radius: 10px;
    border: 1px solid var(--border-strong); background: var(--surface);
    color: var(--text); font-family: var(--font-sans); font-size: 0.95rem;
  }
  .docs-main { padding: 30px 24px 80px; }
}

@media (max-width: 600px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat b { font-size: 1.5rem; }
  .hero { padding: 150px 0 80px; }
  .section { padding: 70px 0; }
  .cta-banner { padding: 50px 24px; }
  .footer-grid { grid-template-columns: 1fr; gap: 26px; }
  .step { grid-template-columns: 44px 1fr; gap: 14px; }
  .rl-row { align-items: flex-start; }
  .rl-row .rl-name { flex-basis: 100%; }
  .rl-btns { width: 100%; }
  .rl-btns a { flex: 1 1 auto; text-align: center; }
}
