/* Shared across every page on the site — design tokens, reset, and the
   header/nav (including the mobile burger menu). Keep this in sync by
   editing here once, not per page; page-specific components (hero, buttons,
   code blocks, wiki tables, ...) stay inline in each page's own <style>. */

/* ============ Tokens ============ */
:root {
  --ground: #f6f7f5;
  --surface: #ffffff;
  --surface-strong: #edf1ea;
  --border: #dde2d8;
  --border-strong: #c7cec0;
  --text-primary: #16201a;
  --text-secondary: #4c5347;
  --text-tertiary: #5c6355;
  --accent: #226e46;
  --accent-strong: #185536;
  --accent-bright: #2f8f5b;
  --accent-soft: #e3f1e8;
  --accent-contrast: #ffffff;
  --danger: #a94a3b;
  --danger-strong: #833a2d;
  --danger-bright: #c85c4a;
  --danger-soft: #fbe9e5;
  --danger-contrast: #ffffff;
  --focus-ring: #226e46;

  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'Manrope', 'Manrope Fallback', system-ui, sans-serif;
  --font-mono: 'Geist Mono', 'Geist Mono Fallback', ui-monospace, monospace;

  --s-1: 4px; --s-2: 6px; --s-3: 8px; --s-4: 10px; --s-5: 12px;
  --s-6: 14px; --s-7: 16px; --s-8: 20px; --s-9: 40px; --s-10: 56px; --s-11: 88px;

  --text-2xs: 10.5px; --text-xs: 12px; --text-sm: 14px; --text-md: 15px; --text-lg: 16px;
  --text-xl: 18px; --text-2xl: 20px; --text-3xl: 26px; --text-4xl: 44px; --text-5xl: 64px;

  --radius-xs: 10px; --radius-sm: 16px; --radius-md: 20px; --radius-lg: 28px; --radius-pill: 999px;
  --duration: 150ms;
  --duration-fast: 180ms;
  --duration-normal: 200ms;
  --duration-slow: 350ms;

  --shadow-inset-1: inset 0 1px 0 0 rgba(255,255,255,0.06);
  --shadow-inset-2:
    inset 0 1px 0 0 rgba(255,255,255,0.22),
    inset 0 -1px 0 0 rgba(0,0,0,0.18),
    0 1px 2px 0 rgba(0,0,0,0.35);
  --shadow-card:
    inset 0 1px 0 0 rgba(255,255,255,0.5),
    0 12px 32px -20px rgba(22,32,26,0.28);

  /* Liquid-glass-inspired surfaces for floating chrome (sticky nav, hero
     install pill) — paired with ambient blooms behind hero-ish sections so
     the blur actually has color to diffract. */
  --glass-bg: rgba(255,255,255,0.55);
  --glass-bg-strong: rgba(255,255,255,0.72);
  --glass-border: rgba(255,255,255,0.6);
  --glass-blur: 22px;

  /* Terminal chrome is deliberately theme-invariant — a code block should
     always read as a dark terminal window, the same way it does in every
     editor and every docs site, regardless of the page's own theme. */
  --terminal-bg: #10140f;
  --terminal-surface: #171d13;
  --terminal-text: #e7ece3;
  --terminal-muted: #7c8674;
  --terminal-prompt: #6bcf98;
  --terminal-danger: #e0836a;
  --terminal-border: #262d1f;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0a130e;
    --surface: #0f1a14;
    --surface-strong: #16241b;
    --border: #24352a;
    --border-strong: #33472f;
    --text-primary: #edf3ec;
    --text-secondary: #a9b6a1;
    --text-tertiary: #77876f;
    --accent: #4bb37c;
    --accent-strong: #6bcf98;
    --accent-bright: #4bb37c;
    --accent-soft: #16301f;
    --accent-contrast: #06170e;
    --danger: #e0836a;
    --danger-strong: #f0a488;
    --danger-bright: #e0836a;
    --danger-soft: #351b13;
    --danger-contrast: #1a0906;
    --focus-ring: #6bcf98;
    --shadow-card:
      inset 0 1px 0 0 rgba(255,255,255,0.06),
      0 12px 32px -18px rgba(0,0,0,0.6);
    --glass-bg: rgba(15,26,20,0.55);
    --glass-bg-strong: rgba(15,26,20,0.78);
    --glass-border: rgba(255,255,255,0.08);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #0a130e;
  --surface: #0f1a14;
  --surface-strong: #16241b;
  --border: #24352a;
  --border-strong: #33472f;
  --text-primary: #edf3ec;
  --text-secondary: #a9b6a1;
  --text-tertiary: #77876f;
  --accent: #4bb37c;
  --accent-strong: #6bcf98;
  --accent-soft: #16301f;
  --accent-contrast: #06170e;
  --danger: #e0836a;
  --danger-strong: #f0a488;
  --danger-soft: #351b13;
  --danger-contrast: #1a0906;
  --focus-ring: #6bcf98;
  --shadow-card:
    inset 0 1px 0 0 rgba(255,255,255,0.06),
    0 12px 32px -18px rgba(0,0,0,0.6);
  --glass-bg: rgba(15,26,20,0.55);
  --glass-bg-strong: rgba(15,26,20,0.78);
  --glass-border: rgba(255,255,255,0.08);
  color-scheme: dark;
}

/* ============ Reset-ish ============ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: hidden; }
body {
  margin: 0;
  max-width: 100vw;
  overflow-x: hidden;
  background: var(--ground);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
code, .mono { font-family: var(--font-mono); }

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

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 var(--s-7);
}
@media (max-width: 640px) {
  .wrap { padding: 0 var(--s-5); }
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-strong);
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
}
.eyebrow::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ============ Header ============ */
header.site {
  position: sticky; top: 0; z-index: 20;
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border-bottom: 1px solid var(--glass-border);
}
.site-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-5) 0;
}
.wordmark {
  display: flex; align-items: center; gap: var(--s-3);
  font-family: var(--font-body);
  font-weight: 800;
  font-size: var(--text-xl);
  text-decoration: none;
  color: var(--text-primary);
}
.wordmark .mark {
  width: 26px; height: 26px;
  display: block;
}
.site-nav nav { display: flex; align-items: center; }
.nav-inner { display: flex; gap: var(--s-7); align-items: center; }
.site-nav nav a {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
}
.site-nav nav a:hover { color: var(--text-primary); }

.nav-toggle {
  display: none;
  flex: none;
  width: 40px; height: 40px;
  margin: -8px;
  border: none;
  background: none;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.nav-toggle span {
  display: block;
  width: 20px; height: 2px;
  background: var(--text-primary);
  border-radius: var(--radius-pill);
  transition: transform var(--duration-normal) ease, opacity var(--duration-fast) ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 640px) {
  .nav-toggle { display: flex; }
  .site-nav nav {
    position: absolute;
    top: 100%; left: 0; right: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--duration-normal) ease;
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
  }
  .site-nav nav.open { max-height: 400px; border-bottom-width: 1px; }
  .nav-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }
  .site-nav nav a { padding: var(--s-6) var(--s-7); border-top: 1px solid var(--glass-border); }
}
