/**
 * Agentic AI Blueprint — Shared Styles
 * Used by the index page and all chapter pages.
 * Dark theme, editorial feel, optimized for long-form reading + print.
 */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&family=JetBrains+Mono:wght@400;500&family=Instrument+Serif:ital@0;1&display=swap');

/* ── Reset + Tokens ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0a0f;
  --bg-alt: #0d0d14;
  --bg-card: rgba(255,255,255,0.025);
  --bg-elevated: rgba(255,255,255,0.04);
  --text: #f0f0f5;
  --text-secondary: rgba(255,255,255,0.7);
  --text-dim: rgba(255,255,255,0.5);
  --text-muted: rgba(255,255,255,0.35);
  --border: rgba(255,255,255,0.07);
  --border-med: rgba(255,255,255,0.12);
  --cyan: #06b6d4;
  --cyan-dim: rgba(6,182,212,0.08);
  --purple: #8b5cf6;
  --purple-dim: rgba(139,92,246,0.08);
  --green: #22c55e;
  --gold: #d4a706;
  --red: #ef4444;
  --sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --serif: 'Instrument Serif', Georgia, serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── Container ── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 780px; margin: 0 auto; }

/* ── Background ── */
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 60px 60px;
}
.bg-glow {
  position: fixed; top: -30%; left: 50%; transform: translateX(-50%); z-index: 0; pointer-events: none;
  width: 120%; height: 80%;
  background: radial-gradient(ellipse 50% 50%, rgba(139,92,246,0.08) 0%, transparent 70%);
}

/* ── Typography (chapter prose) ── */
.prose { position: relative; z-index: 1; }
.prose h1 { font-size: 2.5rem; font-weight: 700; line-height: 1.15; margin-bottom: 16px; letter-spacing: -0.02em; }
.prose h2 { font-size: 1.75rem; font-weight: 700; line-height: 1.2; margin: 48px 0 16px; letter-spacing: -0.01em; }
.prose h3 { font-size: 1.25rem; font-weight: 600; margin: 32px 0 12px; }
.prose h4 { font-size: 1rem; font-weight: 600; margin: 24px 0 8px; }
.prose p { font-size: 1.05rem; color: var(--text-secondary); margin-bottom: 20px; line-height: 1.8; }
.prose strong { color: var(--text); font-weight: 600; }
.prose em { font-family: var(--serif); font-style: italic; color: var(--cyan); }
.prose a { color: var(--cyan); text-decoration: none; border-bottom: 1px solid rgba(6,182,212,0.3); }
.prose a:hover { border-bottom-color: var(--cyan); }
.prose blockquote {
  margin: 28px 0; padding: 20px 24px; border-left: 3px solid var(--cyan);
  background: var(--bg-card); border-radius: 0 8px 8px 0;
  font-size: 1.1rem; color: var(--text-secondary); font-style: italic;
}
.prose blockquote p { margin-bottom: 0; }
.prose ul, .prose ol { margin: 0 0 20px 20px; color: var(--text-secondary); }
.prose li { margin-bottom: 8px; font-size: 1.05rem; line-height: 1.7; }
.prose code {
  font-family: var(--mono); font-size: 0.88em;
  background: var(--bg-elevated); padding: 2px 6px; border-radius: 4px;
}
.prose hr { border: none; border-top: 1px solid var(--border); margin: 40px 0; }

/* ── Cards & Callouts ── */
.card {
  padding: 24px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-card); margin-bottom: 16px;
}
.card h4 { margin-top: 0; margin-bottom: 8px; font-size: 1rem; }
.card p { font-size: 0.95rem; margin-bottom: 0; }

.callout {
  padding: 20px 24px; border-radius: 10px; margin: 28px 0;
  border: 1px solid var(--border);
}
.callout-cyan { background: var(--cyan-dim); border-color: rgba(6,182,212,0.15); }
.callout-purple { background: var(--purple-dim); border-color: rgba(139,92,246,0.15); }
.callout-gold { background: rgba(212,167,6,0.06); border-color: rgba(212,167,6,0.15); }
.callout h4 { margin-top: 0; margin-bottom: 6px; }
.callout p { margin-bottom: 0; font-size: 0.95rem; }

/* ── Tables ── */
.prose table {
  width: 100%; border-collapse: collapse; margin: 24px 0; font-size: 0.95rem;
}
.prose th {
  text-align: left; padding: 12px 16px; border-bottom: 2px solid var(--border-med);
  color: var(--text-dim); font-weight: 600; font-size: 0.85rem;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.prose td {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
.prose tr:hover td { background: var(--bg-card); }

/* ── Stat Grid ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin: 28px 0; }
.stat-box {
  padding: 20px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-card); text-align: center;
}
.stat-box .val { font-size: 2rem; font-weight: 700; color: var(--cyan); font-family: var(--mono); }
.stat-box .lbl { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* ── Chapter Header ── */
.chapter-header {
  padding: 140px 0 60px; position: relative; z-index: 1;
}
.chapter-num {
  font-family: var(--mono); font-size: 0.8rem; color: var(--cyan);
  text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 16px;
}
.chapter-title {
  font-size: clamp(2rem, 5vw, 3rem); font-weight: 700; line-height: 1.1;
  margin-bottom: 16px; letter-spacing: -0.02em;
}
.chapter-lead {
  font-size: 1.2rem; color: var(--text-dim); max-width: 600px; line-height: 1.6;
}

/* ── Chapter Navigation ── */
.chapter-nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 24px 0; margin-top: 60px; border-top: 1px solid var(--border);
}
.chapter-nav a {
  color: var(--text-dim); text-decoration: none; font-size: 0.9rem;
  transition: color 0.15s;
}
.chapter-nav a:hover { color: var(--cyan); }
.chapter-nav .next { text-align: right; }
.chapter-nav .label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); display: block; margin-bottom: 4px; }

/* ── Email Gate ── */
.email-gate {
  padding: 40px; border: 1px solid rgba(6,182,212,0.15); border-radius: 12px;
  background: linear-gradient(135deg, rgba(6,182,212,0.04), rgba(139,92,246,0.04));
  text-align: center; margin: 40px 0;
}
.email-gate h3 { margin-bottom: 8px; }
.email-gate p { color: var(--text-dim); margin-bottom: 20px; font-size: 0.95rem; }
.email-gate form { display: flex; gap: 12px; max-width: 480px; margin: 0 auto; }
.email-gate input[type="email"] {
  flex: 1; padding: 12px 16px; background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-med); border-radius: 8px;
  color: var(--text); font-size: 0.95rem; font-family: var(--sans);
}
.email-gate input[type="email"]::placeholder { color: var(--text-muted); }
.email-gate input[type="email"]:focus { outline: none; border-color: var(--cyan); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-radius: 8px; font-size: 0.95rem;
  font-weight: 600; text-decoration: none; transition: all 0.15s;
  cursor: pointer; border: none; font-family: var(--sans);
}
.btn-primary { background: var(--cyan); color: #0a0a0f; }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border-med); }
.btn-ghost:hover { border-color: var(--text-dim); color: var(--text); }
.btn-lg { padding: 14px 28px; font-size: 1rem; }

/* ── Sections ── */
.section { padding: 80px 0; position: relative; z-index: 1; }
.section-alt { background: var(--bg-alt); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .chapter-header { padding: 120px 0 40px; }
  .prose h1 { font-size: 2rem; }
  .prose h2 { font-size: 1.4rem; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .email-gate form { flex-direction: column; }
}

/* ── Print ── */
@media print {
  body { background: white; color: #111; }
  .bg-grid, .bg-glow, .nav, footer, .email-gate, .chapter-nav { display: none !important; }
  .prose p, .prose li, .prose td { color: #333; }
  .prose blockquote { border-left-color: #06b6d4; background: #f0fafb; }
  .card, .callout { background: #f8f8f8; border-color: #ddd; }
  .chapter-header { padding: 40px 0 20px; }
  @page { margin: 2cm; }
}
