/* Keyrail site. Dark first, light theme via [data-theme] (set by theme.js) or prefers-color-scheme without JS.
   System fonts only: no web font download, no third-party request. */

:root {
  --bg: #0b0e12;
  --bg-alt: #0f1318;
  --surface: #131820;
  --surface-2: #1a212b;
  --border: #232b36;
  --border-strong: #334050;
  --text: #e8ecf1;
  --muted: #9aa5b4;
  --accent: #7ee2a8;
  --accent-strong: #a6efc4;
  --accent-ink: #07210f;
  --accent-soft: rgba(126, 226, 168, 0.1);
  --signal: #f5c46b;
  --danger: #ff8a80;
  --grid: rgba(255, 255, 255, 0.035);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 20px 40px -24px rgba(0, 0, 0, 0.8);

  --code-bg: #0d1117;
  --code-border: #222a35;
  --code-text: #dfe5ec;
  --code-muted: #8b98a8;

  --font: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', 'SF Mono', 'JetBrains Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  --radius: 10px;
  --radius-lg: 14px;
  --container: 1160px;
  --gutter: 20px;
  --header-h: 64px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --bg: #f7f7f4;
    --bg-alt: #efefe9;
    --surface: #ffffff;
    --surface-2: #f3f3ef;
    --border: #dcdcd4;
    --border-strong: #c4c4ba;
    --text: #12161c;
    --muted: #4a5462;
    --accent: #0b7a47;
    --accent-strong: #08613a;
    --accent-ink: #ffffff;
    --accent-soft: rgba(11, 122, 71, 0.08);
    --signal: #8a5a00;
    --danger: #b3261e;
    --grid: rgba(0, 0, 0, 0.04);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 18px 36px -24px rgba(0, 0, 0, 0.25);
    color-scheme: light;
  }
}

:root[data-theme='light'] {
  --bg: #f7f7f4;
  --bg-alt: #efefe9;
  --surface: #ffffff;
  --surface-2: #f3f3ef;
  --border: #dcdcd4;
  --border-strong: #c4c4ba;
  --text: #12161c;
  --muted: #4a5462;
  --accent: #0b7a47;
  --accent-strong: #08613a;
  --accent-ink: #ffffff;
  --accent-soft: rgba(11, 122, 71, 0.08);
  --signal: #8a5a00;
  --danger: #b3261e;
  --grid: rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 18px 36px -24px rgba(0, 0, 0, 0.25);
  color-scheme: light;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img,
svg {
  max-width: 100%;
}
h1,
h2,
h3,
h4 {
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 0.5em;
  font-weight: 700;
  text-wrap: balance;
}
h1 {
  font-size: clamp(2.1rem, 1.4rem + 3.2vw, 3.6rem);
  letter-spacing: -0.035em;
}
h2 {
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem);
  letter-spacing: -0.028em;
}
h3 {
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}
p {
  margin: 0 0 1em;
}
a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover {
  color: var(--accent-strong);
}
code,
kbd,
pre {
  font-family: var(--mono);
  font-size: 0.9em;
  font-variant-ligatures: none;
}
:not(pre) > code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.08em 0.36em;
  font-size: 0.86em;
  overflow-wrap: anywhere;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
main:focus {
  outline: none;
}
hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}
::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 600;
}
.skip-link:focus {
  top: 12px;
}
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.narrow {
  max-width: 800px;
}
.center {
  text-align: center;
}
.center-row {
  justify-content: center;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.875rem;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-row {
  display: flex;
  align-items: center;
  gap: 24px;
  height: var(--header-h);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}
.brand:hover {
  color: var(--text);
}
.logo-bg {
  fill: var(--accent);
}
.logo-ink {
  stroke: var(--accent-ink);
}
.main-nav ul {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.main-nav a {
  display: block;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}
.main-nav a:hover,
.main-nav a[aria-current='page'] {
  color: var(--text);
  background: var(--surface-2);
}
.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}
.theme-toggle .i-moon {
  display: none;
}
:root[data-theme='light'] .theme-toggle .i-sun {
  display: none;
}
:root[data-theme='light'] .theme-toggle .i-moon {
  display: block;
}

@media (max-width: 760px) {
  .header-row {
    flex-wrap: wrap;
    height: auto;
    padding-top: 10px;
    gap: 6px 12px;
  }
  .main-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    margin: 0 calc(-1 * var(--gutter));
    padding: 0 var(--gutter) 8px;
    width: calc(100% + 2 * var(--gutter));
  }
  .main-nav a {
    padding: 6px 10px;
    white-space: nowrap;
  }
  :root {
    --header-h: 104px;
  }
}

/* ---------- Buttons and inputs ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 0.97rem;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn-sm {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.9rem;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover {
  background: var(--accent-strong);
  color: var(--accent-ink);
}
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  color: var(--text);
  border-color: var(--accent);
}
.btn[disabled] {
  opacity: 0.6;
  cursor: progress;
}
.input {
  min-height: 46px;
  width: 100%;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.input::placeholder {
  color: var(--muted);
  opacity: 0.8;
}
.input[aria-invalid='true'] {
  border-color: var(--danger);
}
.link-arrow {
  font-weight: 600;
  text-decoration: none;
}
.link-arrow::after {
  content: ' →';
}
.link-arrow:hover {
  text-decoration: underline;
}

/* ---------- Sections ---------- */
.section {
  padding: clamp(56px, 8vw, 104px) 0;
}
.section-tight {
  padding-top: 0;
}
.section-alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
}
.eyebrow::before {
  content: '';
  width: 22px;
  height: 7px;
  border-top: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  opacity: 0.8;
}
.center .eyebrow {
  justify-content: center;
}
.lead {
  font-size: clamp(1.05rem, 1rem + 0.35vw, 1.22rem);
  color: var(--muted);
  max-width: 62ch;
}
.section-lead {
  color: var(--muted);
  max-width: 60ch;
  font-size: 1.08rem;
}
.center .section-lead,
.center .lead {
  margin-left: auto;
  margin-right: auto;
}
.page-head {
  padding-bottom: 32px;
}
.split {
  display: grid;
  gap: 48px;
  align-items: center;
}
@media (min-width: 980px) {
  .split {
    grid-template-columns: 1fr 1.1fr;
  }
}

.offline-grid {
  display: grid;
  gap: 40px;
}
@media (min-width: 980px) {
  .offline-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
  .offline-grid .diagram {
    grid-column: 1 / -1;
  }
  .offline-points {
    align-self: end;
  }
}

/* Lists with check marks or crosses. */
.checks,
.crosses {
  list-style: none;
  padding: 0;
  margin: 0 0 1em;
}
.checks li,
.crosses li {
  position: relative;
  padding-left: 28px;
  margin-bottom: 10px;
}
.checks li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 0.5em;
  width: 12px;
  height: 7px;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}
.crosses li::before,
.crosses li::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 0.75em;
  width: 13px;
  height: 2px;
  background: var(--danger);
  transform: rotate(45deg);
}
.crosses li::after {
  transform: rotate(-45deg);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: clamp(48px, 7vw, 96px) 0 clamp(56px, 7vw, 96px);
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 40px 40px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 70% 30%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 80% 70% at 70% 30%, #000 30%, transparent 75%);
  pointer-events: none;
}
/* The rail: two thin lines with sleepers along the bottom edge of the hero. */
.hero::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  height: 12px;
  border-top: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
  background: repeating-linear-gradient(90deg, var(--border) 0 2px, transparent 2px 22px);
  opacity: 0.7;
  pointer-events: none;
}
.hero-grid {
  position: relative;
  display: grid;
  gap: 48px;
  align-items: center;
}
@media (min-width: 1020px) {
  .hero-grid {
    grid-template-columns: 1fr 1.05fr;
  }
}
.hero h1 {
  max-width: 15ch;
}
.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 28px 0 24px;
}
.hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.hero-facts li {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 4px 10px;
}
.hero-code {
  display: grid;
  gap: 14px;
  min-width: 0;
}
.hero-code .code pre {
  font-size: 0.8rem;
}
.hero-code .code {
  margin: 0;
  box-shadow: var(--shadow);
}

/* ---------- Code blocks (dark in both themes) ---------- */
.code {
  position: relative;
  margin: 1.4em 0;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--code-text);
}
.code figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  padding: 0 8px 0 14px;
  border-bottom: 1px solid var(--code-border);
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--code-muted);
}
.code-file::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 2px;
  background: #7ee2a8;
  vertical-align: 1px;
}
.code pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.65;
  tab-size: 2;
}
.code pre:focus-visible {
  outline-offset: -2px;
}
.copy-btn {
  font: inherit;
  font-size: 0.75rem;
  color: var(--code-muted);
  background: transparent;
  border: 1px solid var(--code-border);
  border-radius: 6px;
  padding: 3px 9px;
  cursor: pointer;
}
.copy-btn:hover,
.copy-btn:focus-visible {
  color: var(--code-text);
  border-color: #3a4656;
}
.t-comment {
  color: var(--code-muted);
  font-style: italic;
}
.t-string {
  color: #a5e3b8;
}
.t-keyword {
  color: #ff9f80;
}
.t-type {
  color: #8cc8ff;
}
.t-function {
  color: #ecd58d;
}
.t-number {
  color: #f2b880;
}
.t-property {
  color: #9cc9f5;
}
.t-macro {
  color: #d6a8ff;
}
.t-variable {
  color: #f5c46b;
}

/* ---------- How it works ---------- */
.steps {
  list-style: none;
  padding: 0;
  margin: 40px 0 0;
  display: grid;
  gap: 20px;
  counter-reset: step;
}
@media (min-width: 900px) {
  .steps {
    grid-template-columns: repeat(3, 1fr);
  }
}
.step {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 24px 22px;
}
.step-num {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 1px 7px;
  margin-bottom: 16px;
}
.step p {
  color: var(--muted);
}
.step-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
}

/* ---------- Diagram ---------- */
.diagram {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 16px 14px;
}
.diagram-svg {
  display: block;
  width: 100%;
  height: auto;
}
.diagram figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}
.dg-box rect {
  fill: var(--surface-2);
  stroke: var(--border-strong);
}
.dg-title {
  fill: var(--text);
  font: 700 15px var(--font);
}
.dg-small {
  fill: var(--muted);
  font: 13px var(--font);
}
.dg-label {
  fill: var(--muted);
  font: 13px var(--mono);
}
.dg-accent {
  fill: var(--accent);
}
.dg-arrow path {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dg-arrow-thin {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 1.4;
  stroke-dasharray: 3 4;
}
.dg-rail path {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 2;
}
.dg-rail .dg-ties {
  stroke: var(--border);
  stroke-width: 3;
}
.dg-band {
  fill: var(--accent-soft);
  stroke: var(--accent);
  stroke-width: 1;
}
.dg-band-text {
  fill: var(--text);
  font: 600 13px var(--font);
}
.dg-stop circle {
  fill: var(--bg);
  stroke: var(--accent);
  stroke-width: 3;
}

/* ---------- Features, stacks, facts ---------- */
.features {
  display: grid;
  gap: 1px;
  margin-top: 40px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
@media (min-width: 700px) {
  .features {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1000px) {
  .features {
    grid-template-columns: repeat(3, 1fr);
  }
}
.feature {
  background: var(--bg);
  padding: 26px 24px;
}
.feature p {
  color: var(--muted);
  margin: 0;
}
.stacks {
  display: grid;
  gap: 14px;
  margin-top: 36px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}
a.stack:hover {
  color: var(--text);
  border-color: var(--accent);
  transform: translateY(-2px);
}
.stack-name {
  font-weight: 700;
  font-size: 1.15rem;
}
.stack-pkg {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--accent);
}
.stack-desc {
  color: var(--muted);
  font-size: 0.92rem;
}
.stack-soon {
  border-style: dashed;
}
.stack-soon .stack-pkg {
  color: var(--signal);
}
.facts-grid {
  display: grid;
  gap: 14px;
}
@media (min-width: 600px) {
  .facts-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.fact {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
}
.fact p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.fact .fact-title {
  font-family: var(--mono);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
  margin-bottom: 8px;
}

/* ---------- Pricing ---------- */
.billing-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin: 28px 0 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.billing-toggle[hidden] {
  display: none;
}
.seg {
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 9px;
  padding: 8px 14px;
  min-height: 40px;
  cursor: pointer;
}
.seg[aria-pressed='true'] {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--border-strong) inset;
}
.seg-note {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  margin-left: 4px;
}
.plans {
  display: grid;
  gap: 16px;
  margin: 24px 0 32px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.plan {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 22px;
}
.plan header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.plan h3 {
  margin: 0;
}
.plan-highlight {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset, var(--shadow);
}
.badge {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 999px;
  padding: 3px 9px;
}
.price {
  margin: 18px 0 4px;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
}
.amount {
  font-size: 2.3rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.per {
  color: var(--muted);
}
.from {
  flex-basis: 100%;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: -4px;
}
.price-note {
  color: var(--muted);
  font-size: 0.86rem;
  min-height: 2.6em;
}
.plans[data-billing='monthly'] .when-annual,
.plans[data-billing='annual'] .when-monthly {
  display: none;
}
.plan .checks {
  flex: 1;
  font-size: 0.93rem;
  margin: 8px 0 20px;
}
.plan .btn {
  width: 100%;
}
.compare {
  min-width: 640px;
}
.compare td,
.compare th[scope='col'] {
  text-align: center;
}
.compare th[scope='row'] {
  font-weight: 500;
  text-align: left;
  color: var(--muted);
}
.yes {
  color: var(--accent);
  font-weight: 600;
}
.compare-cols {
  display: grid;
  gap: 20px;
}
@media (min-width: 900px) {
  .compare-cols {
    grid-template-columns: 1fr 1fr;
  }
}
.col-card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px 26px 12px;
}
.col-card h2 {
  font-size: 1.5rem;
}
.col-card-no {
  background: var(--bg-alt);
}

/* ---------- FAQ ---------- */
.faq {
  margin-top: 28px;
  border-top: 1px solid var(--border);
}
.faq details {
  border-bottom: 1px solid var(--border);
}
.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 18px 36px 18px 0;
  font-weight: 600;
  font-size: 1.05rem;
  position: relative;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary::after {
  content: '+';
  position: absolute;
  right: 6px;
  top: 14px;
  font-family: var(--mono);
  font-size: 1.3rem;
  color: var(--accent);
}
.faq details[open] summary::after {
  content: '−';
}
.faq details p {
  color: var(--muted);
  padding-right: 24px;
}

/* ---------- Waitlist ---------- */
.section-cta {
  background: radial-gradient(ellipse 60% 80% at 50% 0%, var(--accent-soft), transparent 70%), var(--bg-alt);
  border-top: 1px solid var(--border);
}
.waitlist {
  max-width: 560px;
  margin: 28px auto 0;
  text-align: left;
}
.waitlist-row {
  display: flex;
  gap: 10px;
}
@media (max-width: 520px) {
  .waitlist-row {
    flex-direction: column;
  }
  .waitlist-row .btn {
    width: 100%;
  }
}
.consent {
  margin: 12px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.form-status {
  margin: 10px 0 0;
  min-height: 1.5em;
  font-weight: 600;
}
.form-status.is-ok {
  color: var(--accent);
}
.form-status.is-error {
  color: var(--danger);
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  margin: 1.4em 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.93rem;
}
th,
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
thead th {
  background: var(--surface-2);
  font-weight: 600;
  white-space: nowrap;
}
tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
}

/* ---------- Prose (docs, legal, changelog) ---------- */
.prose {
  min-width: 0;
}
.prose h2 {
  font-size: 1.6rem;
  margin-top: 2.2em;
  padding-top: 0.2em;
}
.prose h3 {
  font-size: 1.2rem;
  margin-top: 1.8em;
}
.prose h4 {
  font-size: 1rem;
  margin-top: 1.5em;
}
.prose ul,
.prose ol {
  padding-left: 1.4em;
  margin: 0 0 1.1em;
}
.prose li {
  margin-bottom: 0.35em;
}
.prose li > ul,
.prose li > ol {
  margin: 0.4em 0 0.4em;
}
.prose blockquote {
  margin: 1.4em 0;
  padding: 2px 18px;
  border-left: 3px solid var(--border-strong);
  color: var(--muted);
}
.anchor {
  margin-left: 0.35em;
  color: var(--muted);
  text-decoration: none;
  opacity: 0;
  font-weight: 400;
}
h2:hover .anchor,
h3:hover .anchor,
.anchor:focus {
  opacity: 1;
}
.callout {
  margin: 1.5em 0;
  padding: 14px 18px 4px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--accent-soft);
}
.callout-warning,
.callout-caution,
.callout-important {
  border-left-color: var(--signal);
  background: color-mix(in srgb, var(--signal) 8%, transparent);
}
.callout-title {
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.link-list {
  list-style: none;
  padding: 0 !important;
}
.link-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.link-list a {
  font-weight: 600;
  margin-right: 8px;
}
.legal h2 {
  font-size: 1.35rem;
}

/* ---------- Docs layout ---------- */
.docs-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: grid;
  gap: 40px;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 900px) {
  .docs-shell {
    grid-template-columns: 230px minmax(0, 1fr);
  }
}
@media (min-width: 1240px) {
  .docs-shell {
    grid-template-columns: 230px minmax(0, 1fr) 200px;
  }
}
.docs-sidebar,
.doc-toc {
  display: none;
}
@media (min-width: 900px) {
  .docs-sidebar {
    display: block;
    position: sticky;
    top: var(--header-h);
    align-self: start;
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
    padding: 32px 0 40px;
    border-right: 1px solid var(--border);
  }
  .docs-mobile {
    display: none;
  }
}
@media (min-width: 1240px) {
  .doc-toc {
    display: block;
    position: sticky;
    top: var(--header-h);
    align-self: start;
    padding: 40px 0;
    font-size: 0.86rem;
  }
}
.docs-sidebar ul,
.doc-toc ul,
.docs-nav-mobile ul {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
}
.side-group {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 6px;
}
.docs-sidebar a,
.docs-nav-mobile a,
.doc-toc a {
  display: block;
  padding: 5px 12px 5px 10px;
  margin-right: 16px;
  border-radius: 7px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.93rem;
  line-height: 1.4;
}
.doc-toc a {
  padding: 4px 0;
  margin: 0;
  font-size: 0.86rem;
}
.docs-sidebar a:hover,
.docs-nav-mobile a:hover,
.doc-toc a:hover {
  color: var(--text);
}
.docs-sidebar a[aria-current='page'],
.docs-nav-mobile a[aria-current='page'] {
  color: var(--text);
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}
@media (max-width: 899px) {
  .docs-mobile {
    display: grid;
    gap: 10px;
    margin-top: 20px;
  }
}
.docs-nav-mobile {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.docs-nav-mobile summary {
  cursor: pointer;
  padding: 12px 16px;
  font-weight: 600;
}
.docs-nav-mobile nav {
  padding: 4px 8px 8px 16px;
}
.docs-content {
  padding: 36px 0 72px;
  max-width: 780px;
}
.docs-content h1 {
  font-size: clamp(1.9rem, 1.5rem + 1.6vw, 2.6rem);
}
.docs-content .lead {
  margin-bottom: 1.6em;
}
.doc-meta {
  margin-top: 3em;
  font-size: 0.88rem;
}
.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 16px;
}
.pager a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
}
.pager a:hover {
  border-color: var(--accent);
  color: var(--text);
}
.pager span {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
}
.pager-next {
  text-align: right;
  grid-column: 2;
}
.doc-cards {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  margin: 1.4em 0;
}
.doc-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
}
.doc-card:hover {
  border-color: var(--accent);
  color: var(--text);
}
.doc-card-group {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.doc-card-title {
  font-weight: 650;
}
.doc-card-desc {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}
.doc-help {
  margin-top: 20px;
  font-size: 0.88rem;
  color: var(--muted);
}

/* ---------- Docs checklists (GFM task lists) ---------- */
.prose ul.task-list {
  list-style: none;
  padding-left: 0;
}
.task-list .task {
  margin-bottom: 0.5em;
}
.task-list .task > label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
}
.task-list .task-check {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0.2em 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.task-list .task-check:checked + span {
  color: var(--muted);
}
.task-list .task > ul,
.task-list .task > ol {
  margin-left: 28px;
}
.task-reset {
  margin: 0 0 1.4em;
}

/* ---------- Docs search ---------- */
.search-btn[hidden] {
  display: none;
}
.search-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 16px);
  min-height: 38px;
  margin: 0 16px 20px 0;
  padding: 0 8px 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}
.search-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}
.search-btn-block {
  width: 100%;
  min-height: 44px;
  margin: 0;
}
.search-btn-label {
  flex: 1;
  min-width: 0;
}
.search-kbd,
.search-dialog kbd {
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.5;
  white-space: nowrap;
}
.search-dialog {
  width: calc(100% - 32px);
  max-width: 640px;
  max-height: calc(100vh - 32px);
  margin: 10vh auto auto;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.search-dialog::backdrop {
  background: rgba(5, 8, 12, 0.6);
}
@media (max-width: 600px) {
  .search-dialog {
    margin-top: 16px;
  }
}
.search-box {
  display: flex;
  flex-direction: column;
  max-height: calc(80vh - 32px);
}
.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}
.search-input {
  flex: 1;
  min-width: 0;
  min-height: 54px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
}
.search-input:focus {
  outline: none;
}
.search-input::-webkit-search-cancel-button {
  display: none;
}
.search-close {
  padding: 4px;
  border: 0;
  background: none;
  cursor: pointer;
}
.search-status {
  margin: 0;
  padding: 10px 16px 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.search-status:empty {
  display: none;
}
.search-results {
  list-style: none;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
}
.search-results:empty {
  display: none;
}
.search-results a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}
.search-results [aria-selected='true'] a {
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}
.search-result-path {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.search-result-title {
  font-weight: 650;
  overflow-wrap: anywhere;
}
.search-result-text {
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.search-results mark {
  background: none;
  color: var(--accent);
  font-weight: 700;
}
.search-empty {
  padding: 4px 16px 8px;
  font-size: 0.9rem;
}
.search-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 0;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted);
}
@media (hover: none) {
  .search-foot,
  .search-kbd {
    display: none;
  }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 56px 0 24px;
  background: var(--bg);
}
.footer-grid {
  display: grid;
  gap: 32px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.footer-brand {
  grid-column: 1 / -1;
  max-width: 380px;
}
@media (min-width: 900px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr 1fr;
  }
  .footer-brand {
    grid-column: auto;
  }
}
.footer-brand .brand {
  margin-bottom: 12px;
}
.footer-title {
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}
.site-footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.site-footer li {
  margin-bottom: 6px;
}
.site-footer nav a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.94rem;
}
.site-footer nav a:hover {
  color: var(--accent);
}
.footer-bottom {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
@media print {
  .site-header,
  .site-footer,
  .docs-sidebar,
  .doc-toc,
  .docs-nav-mobile,
  .copy-btn {
    display: none !important;
  }
}
