/* ────────────────────────────────────────────────────────────────
   cogniplane · midnight-electric · shared system
   tokens · primitives · nav · footer · buttons · faq · cta · kicker
   Loaded by every page. Page-specific styles stay inline.
   ──────────────────────────────────────────────────────────────── */
:root {
  --bg:        oklch(15% 0.018 260);
  --bg-deep:   oklch(11% 0.014 260);
  --surface:   oklch(20% 0.022 260);
  --surface-2: oklch(24% 0.024 260);
  --border:    oklch(28% 0.025 260);
  --border-strong: oklch(36% 0.028 260);
  --muted:     oklch(68% 0.018 260);
  --muted-2:   oklch(78% 0.012 260);
  --fg:        oklch(96% 0.008 260);
  --accent:    oklch(78% 0.16 200);
  --accent-deep: oklch(62% 0.18 215);
  --accent-glow: oklch(78% 0.16 200 / 0.18);
  --success:   oklch(72% 0.16 145);
  --warn:      oklch(78% 0.16 75);
  --danger:    oklch(70% 0.18 25);

  --font-display: -apple-system, BlinkMacSystemFont, 'Inter Display', 'Inter', 'SF Pro Display', system-ui, sans-serif;
  --font-body:    -apple-system, BlinkMacSystemFont, 'Inter', 'SF Pro Text', system-ui, sans-serif;
  --font-mono:    ui-monospace, 'JetBrains Mono', 'IBM Plex Mono', 'SF Mono', Menlo, monospace;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;

  --max:       1200px;
  --gutter:    clamp(20px, 4vw, 48px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection { background: var(--accent-glow); color: var(--fg); }
a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; display: block; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: var(--bg-deep);
  padding: 10px 14px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}
.skip-link:focus { left: 12px; top: 12px; }

/* ── primitives ────────────────────────────────────────────────── */
.wrap { max-width: var(--max); margin: 0 auto; padding-inline: var(--gutter); }
.row  { display: flex; align-items: center; }

/* ── mobile nav toggle ──────────────────────────────────────────────
   <details class="nav-toggle"> sits next to <ul class="nav-links">
   inside the top nav. Its <summary> is the hamburger. On desktop the
   details is hidden entirely and the <ul> renders as a normal nav row.
   Below the breakpoint, the details becomes visible, the <ul> collapses
   into a panel, and .nav-toggle[open] reveals it via a sibling combinator.
   ───────────────────────────────────────────────────────────────── */
.nav-toggle { display: none; }
.nav-toggle > summary { list-style: none; }
.nav-toggle > summary::-webkit-details-marker { display: none; }
.nav-toggle > summary::marker { content: ""; }

.kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.kicker .dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
  margin-right: 8px;
  vertical-align: 1px;
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--accent-glow); }
  50%       { box-shadow: 0 0 0 6px transparent; }
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--fg);
  margin: 0;
}
h1 { font-size: clamp(44px, 6.4vw, 84px); letter-spacing: -0.035em; font-weight: 500; }
h2 { font-size: clamp(32px, 3.4vw, 48px); letter-spacing: -0.025em; }
h3 { font-size: clamp(20px, 1.7vw, 24px); letter-spacing: -0.015em; }
h4 { font-size: 16px; letter-spacing: -0.01em; }
p  { color: var(--muted-2); margin: 0; }

.accent { color: var(--accent); }
.num    { font-variant-numeric: tabular-nums; }
.mono   { font-family: var(--font-mono); }

/* ── buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 11px 18px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 120ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease;
  white-space: nowrap;
  letter-spacing: -0.005em;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: var(--bg-deep);
  border-color: var(--accent);
}
.btn-primary:hover { background: oklch(82% 0.16 200); }
.btn-primary:disabled { opacity: 0.7; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--border-strong);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn .arrow { transition: transform 160ms ease; }
.btn:hover .arrow { transform: translateX(3px); }

/* ── nav ───────────────────────────────────────────────────────── */
nav.top {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid color-mix(in oklab, var(--border) 60%, transparent);
}
nav.top .wrap {
  display: flex;
  align-items: center;
  height: 60px;
  gap: 32px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  font-size: 17px;
  color: var(--fg);
  flex-shrink: 0;
}
.logo { width: 22px; height: 22px; flex-shrink: 0; }
.nav-links {
  display: flex; gap: 26px;
  margin-inline: auto;
  font-size: 13.5px;
  color: var(--muted-2);
  list-style: none;
  padding: 0;
  margin-block: 0;
}
.nav-links a {
  transition: color 140ms ease;
  position: relative;
  padding: 4px 0;
}
.nav-links a:hover { color: var(--fg); }
.nav-links a.active { color: var(--fg); }
.nav-links a.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.nav-actions { display: flex; gap: 10px; align-items: center; }
.nav-actions .btn { padding: 8px 14px; font-size: 13px; }
@media (max-width: 820px) { .nav-links { display: none; } }

/* ── section base ──────────────────────────────────────────────── */
section { padding: clamp(72px, 9vw, 128px) 0; position: relative; }
section + section { border-top: 1px solid var(--border); }

.section-head {
  max-width: 760px;
  margin-bottom: clamp(40px, 5vw, 64px);
}
.section-head h2 { margin-top: 14px; }
.section-head h1 { margin-top: 14px; }
.section-head p {
  margin-top: 18px;
  font-size: clamp(15px, 1.1vw, 17px);
  color: var(--muted-2);
  max-width: 620px;
}

/* ── short page hero (subpages) ────────────────────────────────── */
.page-hero {
  position: relative;
  padding: clamp(80px, 10vw, 132px) 0 clamp(56px, 7vw, 84px);
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.page-hero-aura {
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 50% 40% at 80% 0%, oklch(78% 0.16 200 / 0.12), transparent 60%),
    radial-gradient(ellipse 40% 30% at 10% 30%, oklch(62% 0.18 250 / 0.08), transparent 65%);
}
.page-hero-grid {
  position: absolute; inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, oklch(28% 0.025 260 / 0.3) 1px, transparent 1px),
    linear-gradient(to bottom, oklch(28% 0.025 260 / 0.3) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 0%, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 0%, black 30%, transparent 80%);
  opacity: 0.4;
}
.page-hero .wrap { position: relative; }
.page-hero h1 {
  font-size: clamp(40px, 5.6vw, 72px);
  margin-top: 18px;
  max-width: 880px;
}
.page-hero h1 em {
  font-style: normal;
  color: var(--accent);
}
.page-hero .lede {
  margin-top: 24px;
  font-size: clamp(16px, 1.25vw, 18px);
  color: var(--muted-2);
  max-width: 620px;
  line-height: 1.55;
}
.page-hero .hero-cta {
  margin-top: 32px;
  display: flex; gap: 12px; flex-wrap: wrap;
}

/* ── faq ───────────────────────────────────────────────────────── */
.faq .list {
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.faq details {
  border-bottom: 1px solid var(--border);
  padding: 22px 0;
}
.faq summary {
  list-style: none;
  cursor: pointer;
  display: flex; align-items: center; gap: 24px;
  font-family: var(--font-display);
  font-size: clamp(18px, 1.5vw, 22px);
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--fg);
  transition: color 160ms ease;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '+';
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 22px;
  color: var(--muted);
  font-weight: 400;
  transition: transform 200ms ease, color 160ms ease;
  line-height: 1;
}
.faq details[open] summary::after { content: '–'; color: var(--accent); }
.faq summary:hover { color: var(--accent); }
.faq details p {
  margin-top: 14px;
  font-size: 15px;
  color: var(--muted-2);
  max-width: 760px;
  line-height: 1.55;
}

/* ── final cta ─────────────────────────────────────────────────── */
.cta-final {
  position: relative;
  overflow: hidden;
  background: var(--bg-deep);
}
.cta-final::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 100%, oklch(78% 0.16 200 / 0.18), transparent 60%);
  pointer-events: none;
}
.cta-final .wrap { position: relative; text-align: center; }
.cta-final h2 {
  max-width: 760px;
  margin-inline: auto;
  font-size: clamp(36px, 4.5vw, 64px);
}
.cta-final p {
  max-width: 560px;
  margin: 22px auto 0;
  font-size: 16px;
}
.cta-form {
  margin-top: 36px;
  display: flex;
  gap: 8px;
  max-width: 460px;
  margin-inline: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 6px 6px 6px 18px;
  transition: border-color 160ms ease;
}
.cta-form:focus-within { border-color: var(--accent); }
.cta-form input {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14.5px;
  outline: none;
  min-width: 0;
}
.cta-form input::placeholder { color: var(--muted); }
.cta-form button:disabled { opacity: 0.7; cursor: not-allowed; }
.cta-final .form-success {
  margin-top: 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--success);
  letter-spacing: 0.04em;
  display: none;
}
.cta-final .form-success.visible { display: block; }
.cta-final .alt {
  margin-top: 24px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.cta-final .alt a { color: var(--accent); border-bottom: 1px dotted var(--accent); }

/* ── footer ────────────────────────────────────────────────────── */
footer.bottom {
  border-top: 1px solid var(--border);
  background: var(--bg-deep);
  padding: 56px 0 40px;
}
footer.bottom .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr));
  gap: 32px;
}
@media (max-width: 760px) { footer.bottom .wrap { grid-template-columns: 1fr 1fr; } }
footer.bottom h5 {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin: 0 0 16px 0;
  font-weight: 400;
}
footer.bottom ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
footer.bottom ul li a {
  font-size: 13.5px;
  color: var(--muted-2);
  transition: color 140ms ease;
}
footer.bottom ul li a:hover { color: var(--accent); }
.foot-brand { max-width: 320px; }
.foot-brand .desc {
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}
.foot-bar {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.foot-bar .status { display: flex; align-items: center; gap: 8px; }
.foot-bar .status .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px oklch(72% 0.16 145 / 0.18);
}
@media (max-width: 760px) {
  .foot-bar { flex-direction: column; gap: 12px; align-items: flex-start; }
}

/* ── pill / tag ────────────────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: oklch(20% 0.022 260 / 0.6);
}
.tag.accent { color: var(--accent); border-color: oklch(60% 0.18 215 / 0.4); background: oklch(78% 0.16 200 / 0.08); }
.tag.warn   { color: var(--warn);   border-color: oklch(50% 0.10 75 / 0.4);  background: oklch(78% 0.16 75 / 0.06); }
.tag.ok     { color: var(--success); border-color: oklch(50% 0.12 145 / 0.4); background: oklch(72% 0.16 145 / 0.06); }

/* ── mobile nav toggle styles ───────────────────────────────────
   Below 820px the .nav-toggle hamburger replaces the inline link row.
   Re-skinned for the dark-theme tokens introduced in the redesign.
   ─────────────────────────────────────────────────────────────── */
@media (max-width: 820px) {
  .nav-toggle { display: block; position: relative; z-index: 21; }
  .nav-toggle > summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    color: var(--fg);
    -webkit-tap-highlight-color: transparent;
  }
  .nav-toggle > summary:hover { border-color: var(--border-strong); }
  .nav-toggle > summary svg { display: block; width: 20px; height: 20px; }
  .nav-toggle > summary .nav-toggle-close { display: none; }
  .nav-toggle[open] > summary .nav-toggle-open { display: none; }
  .nav-toggle[open] > summary .nav-toggle-close { display: block; }

  /* override beta2's blanket `.nav-links { display: none }` so the
     panel stays hidden by default but reveals when [open] is set */
  .nav-toggle[open] ~ .nav-links {
    display: flex;
    position: absolute;
    top: calc(100% + 8px);
    right: 24px;
    left: 24px;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 12px;
    border-radius: var(--radius-lg);
    background: var(--bg-deep);
    border: 1px solid var(--border);
    box-shadow: 0 16px 36px oklch(0% 0 0 / 0.5);
    z-index: 20;
  }
  .nav-toggle[open] ~ .nav-links li { width: 100%; }
  .nav-toggle[open] ~ .nav-links a {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
  }
  .nav-toggle[open] ~ .nav-links a:hover { background: var(--surface); }
}

/* ── reduced motion ────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
