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

/* ===== DARK-FIRST DESIGN SYSTEM (matches homepage) ===== */
:root {
  --bg: #09090b;
  --bg-surface: #131316;
  --bg-elevated: #1c1c20;
  --bg-hover: #222228;
  --bg-glass: rgba(9,9,11,0.82);
  --text: #f4f4f5;
  --text-secondary: #8a8f98;
  --text-muted: #71717a;
  --border: rgba(255,255,255,0.06);
  --border-hover: rgba(255,255,255,0.1);
  --border-strong: rgba(255,255,255,0.14);
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-subtle: color-mix(in srgb, var(--accent) 10%, transparent);
  --accent-text: color-mix(in srgb, var(--accent) 60%, #fff);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 2px 4px rgba(0,0,0,0.2), 0 8px 24px -4px rgba(0,0,0,0.4);
  --code-bg: #131316;
  --code-border: rgba(255,255,255,0.08);
}

[data-theme="light"] {
  --bg: #fafafa;
  --bg-surface: #f4f4f5;
  --bg-elevated: #ffffff;
  --bg-hover: #e4e4e7;
  --bg-glass: rgba(250,250,250,0.82);
  --text: #18181b;
  --text-secondary: #52525b;
  --text-muted: #a1a1aa;
  --border: rgba(0,0,0,0.06);
  --border-hover: rgba(0,0,0,0.1);
  --border-strong: rgba(0,0,0,0.14);
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-subtle: rgba(99,102,241,0.06);
  --accent-text: #4338ca;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 4px rgba(0,0,0,0.03), 0 8px 24px -4px rgba(0,0,0,0.06);
  --code-bg: #f4f4f5;
  --code-border: rgba(0,0,0,0.06);
}

html { scroll-behavior: smooth; }

body {
  font-family: "Geist Sans", "Geist", ui-sans-serif, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.4s ease, color 0.4s ease;
}

/* Noise texture overlay (matches homepage) */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 9999;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px;
  opacity: 0.025;
}
[data-theme="light"] body::before { opacity: 0.018; }

/* ===== NAV (matches homepage) ===== */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; height: 72px;
}
.nav-logo {
  font-size: 17px; font-weight: 600; color: var(--text);
  text-decoration: none; display: flex; align-items: center; gap: 10px;
  letter-spacing: -0.01em;
}
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a {
  font-size: 14px; font-weight: 450; color: var(--text-secondary);
  text-decoration: none; transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); }
.nav-cta {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 18px; border-radius: 8px; font-size: 13px; font-weight: 500;
  background: var(--bg-elevated); color: var(--text); text-decoration: none;
  border: 1px solid var(--border-hover);
  transition: all 0.2s;
}
.nav-cta:hover { border-color: var(--border-strong); background: var(--bg-hover); }
.theme-toggle {
  background: none; border: none; border-radius: 8px;
  width: 36px; height: 36px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: all 0.2s;
}
.theme-toggle:hover { color: var(--text-secondary); }

/* ===== HERO (matches homepage) ===== */
.hero {
  position: relative;
  padding: 164px 32px 64px;
  max-width: 760px; margin: 0 auto;
}
.hero::before {
  content: '';
  position: absolute; top: 40px; left: -10%; width: 800px; height: 500px;
  background: radial-gradient(ellipse at center, var(--accent) 0%, transparent 70%);
  opacity: 0.06; filter: blur(80px);
  pointer-events: none; z-index: -1;
}
.hero-label {
  font-size: 11px; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--accent-text);
  margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(40px, 5vw, 56px); font-weight: 600;
  line-height: 1.08; letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 20px;
}
.hero h1 em {
  font-style: italic; font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 400; color: var(--accent-text);
  letter-spacing: -0.01em;
}
.hero p {
  font-size: 17px; color: var(--text-secondary);
  max-width: 640px; line-height: 1.65; margin-bottom: 32px;
}
.hero-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px; border-radius: 8px; font-size: 14px; font-weight: 500;
  background: var(--text); color: var(--bg); text-decoration: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: none; cursor: pointer;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,0,0,0.3); }
.btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px; border-radius: 8px; font-size: 14px; font-weight: 500;
  background: transparent; color: var(--text-secondary); text-decoration: none;
  border: 1px solid var(--border-hover); cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-secondary:hover { border-color: var(--border-strong); color: var(--text); transform: translateY(-1px); }

/* ===== SECTION (matches homepage pattern, constrained to reading width) ===== */
.section {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 32px 32px;
  color: var(--text);
}

/* ===== DOC TYPOGRAPHY ===== */
.doc h2 {
  font-size: 24px; font-weight: 600; letter-spacing: -0.015em;
  margin: 40px 0 16px; color: var(--text);
}
.doc h2:first-child { margin-top: 0; }
.doc h3 {
  font-size: 18px; font-weight: 600; letter-spacing: -0.01em;
  margin: 32px 0 12px; color: var(--text);
}
.doc p {
  font-size: 16px; color: var(--text-secondary);
  line-height: 1.7; margin: 0 0 16px;
}
.doc a {
  color: var(--accent-text);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent-text) 30%, transparent);
  transition: border-color 0.15s;
}
.doc a:hover { border-bottom-color: var(--accent-text); }
.doc strong { color: var(--text); font-weight: 600; }
.doc ul, .doc ol {
  margin: 0 0 20px; padding-left: 24px;
  color: var(--text-secondary);
}
.doc li { margin: 6px 0; line-height: 1.65; }
.doc li::marker { color: var(--text-muted); }
.doc blockquote {
  border-left: 2px solid var(--accent);
  padding: 4px 0 4px 20px;
  margin: 24px 0;
  color: var(--text-secondary);
  font-style: italic;
}
.doc code {
  font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  color: var(--text);
}
.doc pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 10px;
  padding: 16px 18px;
  margin: 20px 0;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.55;
}
.doc pre code {
  padding: 0; border: none; background: none;
  font-size: inherit;
  color: var(--text);
}

/* ===== FOOTER (matches homepage) ===== */
.footer {
  border-top: 1px solid var(--border);
  padding: 48px 32px;
  margin-top: 40px;
}
.footer-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
}
.footer-left .footer-brand { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; letter-spacing: -0.01em; }
.footer-left p { font-size: 13px; color: var(--text-muted); }
.footer-links { display: flex; gap: 24px; align-items: center; }
.footer-links a { font-size: 13px; color: var(--text-muted); text-decoration: none; transition: color 0.2s; }
.footer-links a:hover { color: var(--text); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .nav-inner { padding: 0 20px; }
  .nav-links a.hide-mobile { display: none; }
  .hero { padding: 128px 20px 48px; }
  .section { padding: 24px 20px 32px; }
  .footer { padding: 40px 20px; }
}
@media (max-width: 480px) {
  .hero h1 { font-size: 36px; }
}
