/* ============================================================
   GLEAM Docs — Site Stylesheet
   The docs site uses GLEAM to animate itself.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Tokens ─────────────────────────────────────────────────────────────────── */

:root {
  --bg:           #080810;
  --bg-2:         #0d0d1a;
  --bg-3:         #12121f;
  --card-bg:      #0f0f1c;
  --card-hover:   #141428;
  --border:       rgba(255,255,255,0.08);
  --border-glow:  rgba(167,139,250,0.3);
  --text:         #e8e8f0;
  --text-muted:   #6b6b8a;
  --text-dim:     #3a3a55;
  --primary:      #a78bfa;
  --primary-dark: #7c3aed;
  --secondary:    #60a5fa;
  --accent:       #f472b6;
  --green:        #34d399;
  --yellow:       #fbbf24;
  --sidebar-w:    260px;
  --topnav-h:     64px;
  --radius:       12px;
  --radius-lg:    20px;
  --shadow:       0 4px 24px rgba(0,0,0,0.4);
  --shadow-glow:  0 0 40px rgba(167,139,250,0.15);

  /* GLEAM variable overrides for this page */
  --gradient-from:   #a78bfa;
  --gradient-to:     #60a5fa;
  --gradient-mid:    #818cf8;
  --gradient-accent: #f472b6;
}

/* ── Reset ───────────────────────────────────────────────────────────────────── */

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; font: inherit; }

/* ── Scroll progress ─────────────────────────────────────────────────────────── */

.scroll-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent), var(--secondary));
  transform-origin: left;
  transform: scaleX(0);
  z-index: 9999;
  transition: none;
}

/* ── Top navigation ──────────────────────────────────────────────────────────── */

.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topnav-h);
  background: rgba(8,8,16,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  gap: 2rem;
  z-index: 1000;
}

.topnav-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
}

.logo-gem {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; color: #fff; font-weight: 900;
}

.logo-v {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
  background: var(--border);
  padding: 2px 6px;
  border-radius: 4px;
}

.topnav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
}

.topnav-link {
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: color 0.2s, background 0.2s;
}
.topnav-link:hover { color: var(--text); background: var(--border); }
.topnav-link.active { color: var(--primary); }

.topnav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

/* ── Layout ──────────────────────────────────────────────────────────────────── */

.site-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar layout (module pages) */
.sidenav {
  width: var(--sidebar-w);
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  overflow-y: auto;
  z-index: 100;
}

.sidenav-logo {
  display: flex; align-items: center; gap: 0.6rem;
  color: #fff; font-weight: 800; font-size: 1.1rem;
  margin-bottom: 2rem;
}

.logo-mark {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; color: #fff;
}

.logo-version {
  font-size: 0.7rem; color: var(--text-muted); font-weight: 400;
  margin-left: auto;
  background: var(--border); padding: 2px 6px; border-radius: 4px;
}

.nav-section { margin-bottom: 1.75rem; }
.nav-label {
  display: block; font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--text-dim); margin-bottom: 0.5rem;
  font-weight: 700;
}

.nav-link {
  display: flex; align-items: center; justify-content: space-between;
  color: var(--text-muted); padding: 0.4rem 0.6rem;
  border-radius: 6px; font-size: 0.875rem; margin-bottom: 0.15rem;
  transition: color 0.15s, background 0.15s;
}
.nav-link:hover { color: var(--text); background: var(--border); }
.nav-link.active { color: var(--primary); background: rgba(167,139,250,0.08); }

.nav-link-badge {
  font-size: 0.65rem; background: var(--border);
  padding: 1px 5px; border-radius: 3px; color: var(--text-dim);
}

.site-main { margin-left: var(--sidebar-w); flex: 1; }
.page-content { max-width: 1100px; margin: 0 auto; padding: 3rem 3rem 6rem; }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.7rem 1.4rem; border-radius: 8px;
  font-weight: 600; font-size: 0.95rem;
  transition: transform 0.2s cubic-bezier(0.22,1,0.36,1),
              box-shadow 0.2s cubic-bezier(0.22,1,0.36,1);
  border: none; white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }

.btn--primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 16px rgba(124,58,237,0.3);
}
.btn--primary:hover { box-shadow: 0 8px 24px rgba(124,58,237,0.5); }

.btn--glass {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text);
  backdrop-filter: blur(8px);
}
.btn--glass:hover { background: rgba(255,255,255,0.1); border-color: var(--primary); }

.btn--outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn--outline:hover { border-color: var(--primary); color: var(--primary); background: rgba(167,139,250,0.05); }

.btn--sm { padding: 0.4rem 0.9rem; font-size: 0.82rem; border-radius: 6px; }

.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }

/* ── Code blocks ─────────────────────────────────────────────────────────────── */

.code-wrap { position: relative; }

pre.code-block {
  background: #05050e;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.7;
  tab-size: 2;
}

pre.code-block code { font-family: 'JetBrains Mono', monospace; }

.code-copy {
  position: absolute; top: 0.75rem; right: 0.75rem;
  background: var(--border); border: none;
  color: var(--text-muted); font-size: 0.75rem;
  padding: 0.3rem 0.6rem; border-radius: 5px;
  transition: background 0.15s, color 0.15s;
}
.code-copy:hover { background: rgba(167,139,250,0.2); color: var(--primary); }
.code-copy.copied { color: var(--green); background: rgba(52,211,153,0.1); }

.hl-tag   { color: #f472b6; }
.hl-attr  { color: #a78bfa; }
.hl-val   { color: #60a5fa; }
.hl-com   { color: #3a3a55; font-style: italic; }
.hl-prop  { color: #34d399; }
.hl-kw    { color: #fbbf24; }
.hl-fn    { color: #60a5fa; }
.hl-str   { color: #f472b6; }
.hl-num   { color: #fb923c; }

/* ── Pills / tags ────────────────────────────────────────────────────────────── */

.tag {
  display: inline-flex; align-items: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem; padding: 0.2rem 0.6rem;
  border-radius: 4px; white-space: nowrap;
}

.pill {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.75rem; border-radius: 999px;
  font-size: 0.8rem; font-weight: 600;
}
.pill--primary { background: rgba(167,139,250,0.15); color: var(--primary); border: 1px solid rgba(167,139,250,0.3); }
.pill--green   { background: rgba(52,211,153,0.12);  color: var(--green);   border: 1px solid rgba(52,211,153,0.25); }
.pill--blue    { background: rgba(96,165,250,0.12);  color: var(--secondary); border: 1px solid rgba(96,165,250,0.25); }
.pill--pink    { background: rgba(244,114,182,0.12); color: var(--accent);  border: 1px solid rgba(244,114,182,0.25); }

/* ── Section scaffolding ─────────────────────────────────────────────────────── */

.section { padding: 7rem 2rem; position: relative; }
.section--dark { background: var(--bg-2); }
.section--darker { background: var(--bg-3); }

.section-inner { max-width: 1200px; margin: 0 auto; }

.section-eyebrow {
  display: flex; align-items: center; gap: 0.5rem;
  color: var(--primary); font-size: 0.8rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  margin-bottom: 1rem;
}
.section-eyebrow::before {
  content: ''; display: block; width: 20px; height: 2px;
  background: var(--primary); border-radius: 1px;
}

.section-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800; line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.section-sub {
  font-size: 1.1rem; color: var(--text-muted);
  max-width: 580px; line-height: 1.65;
}

.section-header {
  margin-bottom: 3.5rem;
}

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: center; }
.split--left { grid-template-columns: 1.2fr 1fr; }
.split--right { grid-template-columns: 1fr 1.2fr; }

/* ── Hero ────────────────────────────────────────────────────────────────────── */

.hero-section {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 4rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 8rem 2rem 4rem;
  position: relative;
}

.hero-eyebrow {
  display: flex; align-items: center; gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.hero-title {
  font-size: clamp(2.8rem, 5.5vw, 4.5rem);
  font-weight: 900; line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
}

.hero-title .line { display: block; }

.hero-title .gradient-text {
  display: inline-block;
  background: linear-gradient(120deg, var(--primary) 0%, var(--accent) 50%, var(--secondary) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: hero-gradient-shift 6s ease infinite;
  padding-bottom: 0.15em;
}

@keyframes hero-gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50%       { background-position: 100% 50%; }
}

.hero-sub {
  font-size: 1.15rem; color: var(--text-muted);
  max-width: 520px; line-height: 1.65; margin-bottom: 2.5rem;
}

.hero-stats {
  display: flex; gap: 2rem; margin-top: 3rem;
  padding-top: 2rem; border-top: 1px solid var(--border);
}
.hero-stat-num {
  font-size: 1.5rem; font-weight: 800; color: var(--primary);
}
.hero-stat-label { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.15rem; }

/* Hero visual side */
.hero-visual {
  position: relative;
  display: flex; align-items: center; justify-content: center;
}

.hero-demo-orb {
  position: absolute; border-radius: 50%;
  filter: blur(80px); opacity: 0.35; pointer-events: none;
}
.hero-demo-orb--1 { width: 300px; height: 300px; background: var(--primary); top: -50px; right: 0; }
.hero-demo-orb--2 { width: 200px; height: 200px; background: var(--accent); bottom: -20px; left: 20px; }

.hero-demo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  width: 100%; max-width: 420px;
  position: relative; z-index: 1;
}

.hero-demo-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex; flex-direction: column; gap: 0.75rem;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.hero-demo-card:hover {
  border-color: var(--border-glow);
  box-shadow: 0 0 20px rgba(167,139,250,0.1);
}

.hero-demo-card--wide { grid-column: span 2; }

.demo-swatch {
  width: 100%; height: 56px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.demo-swatch--purple { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.demo-swatch--blue   { background: linear-gradient(135deg, var(--secondary), #3b82f6); }
.demo-swatch--pink   { background: linear-gradient(135deg, var(--accent), #e11d48); }
.demo-swatch--mesh   { background: radial-gradient(at 0% 0%, var(--primary) 0, transparent 50%), radial-gradient(at 100% 100%, var(--secondary) 0, transparent 50%), radial-gradient(at 50% 50%, var(--accent) 0, transparent 70%); }
.demo-swatch--wide { height: 48px; }

.demo-swatch-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem; color: var(--text-muted); margin-top: 0.25rem;
}

/* ── Ways section (3 tiers) ──────────────────────────────────────────────────── */

.ways-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.way-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: border-color 0.3s, transform 0.3s cubic-bezier(0.22,1,0.36,1);
  position: relative; overflow: hidden;
}
.way-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.way-card--1::before { background: linear-gradient(90deg, var(--green), #059669); }
.way-card--2::before { background: linear-gradient(90deg, var(--primary), var(--primary-dark)); }
.way-card--3::before { background: linear-gradient(90deg, var(--secondary), #2563eb); }

.way-card:hover { border-color: var(--border-glow); transform: translateY(-4px); }

.way-num {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-dim); margin-bottom: 0.75rem;
}

.way-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.5rem; }
.way-sub { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 1.5rem; line-height: 1.5; }

/* ── Playground (effect browser) ─────────────────────────────────────────────── */

.playground {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 2rem;
  align-items: start;
}

.playground-stage {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 280px; gap: 1.5rem;
  position: relative; overflow: hidden;
}

.playground-stage-bg {
  position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(167,139,250,0.05) 0%, transparent 70%);
  pointer-events: none;
}

.playground-box {
  width: 90px; height: 90px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  box-shadow: 0 8px 32px rgba(124,58,237,0.3);
}

.playground-active-class {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem; color: var(--primary);
  background: rgba(167,139,250,0.1);
  border: 1px solid rgba(167,139,250,0.2);
  padding: 0.3rem 0.75rem; border-radius: 6px;
}

.playground-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-height: 420px;
  display: flex; flex-direction: column;
}

.playground-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
}

.playground-tab {
  padding: 0.6rem 1rem;
  font-size: 0.8rem; font-weight: 600;
  color: var(--text-muted); background: none;
  border: none; border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.playground-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.playground-tab:hover { color: var(--text); }

.playground-effects {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.75rem;
  overflow-y: auto;
  flex: 1;
}

.effect-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0.75rem 1rem;
  min-height: 2.5rem;
  border-radius: 6px;
  text-align: left;
  width: 100%;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.effect-btn:hover { border-color: var(--primary); color: var(--primary); background: rgba(167,139,250,0.05); }
.effect-btn.active { border-color: var(--primary); color: var(--primary); background: rgba(167,139,250,0.1); }

/* ── Real UI demos ───────────────────────────────────────────────────────────── */

.demos-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.demo-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.demo-panel-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}

.demo-panel-title { font-weight: 700; font-size: 0.95rem; }
.demo-panel-tag { font-size: 0.75rem; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }

.demo-panel-body {
  padding: 1.5rem;
}

/* Accordion demo */
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.faq-trigger {
  width: 100%; padding: 1rem 1.25rem;
  background: none; border: none;
  color: var(--text); font-size: 0.9rem; font-weight: 600;
  display: flex; justify-content: space-between; align-items: center;
  text-align: left; gap: 0.75rem;
  transition: background 0.2s;
}
.faq-trigger:hover { background: rgba(255,255,255,0.03); }

.faq-trigger svg {
  flex-shrink: 0; width: 16px; height: 16px;
  color: var(--text-muted);
  transition: transform 0.35s cubic-bezier(0.22,1,0.36,1);
}
.faq-item.open .faq-trigger svg { transform: rotate(180deg); }

.faq-body {
  overflow: hidden;
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows 0.35s cubic-bezier(0.22,1,0.36,1);
}
.faq-item.open .faq-body { grid-template-rows: 1fr; }
.faq-body > div { overflow: hidden; }
.faq-content { padding: 0 1.25rem 1rem; color: var(--text-muted); font-size: 0.875rem; line-height: 1.6; }

/* FLIP sort demo */
.sort-bar {
  display: flex; gap: 0.5rem; margin-bottom: 1rem;
}

.flip-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}

.flip-card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  text-align: center;
  font-size: 0.8rem; font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s;
}
.flip-card:hover { border-color: var(--primary); }
.flip-card-num {
  font-size: 1.2rem; margin-bottom: 0.25rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-weight: 800;
}

/* Toggle demo */
.toggle-demo-area { display: flex; flex-direction: column; gap: 1rem; }

.toggle-target {
  background: linear-gradient(135deg, rgba(167,139,250,0.1), rgba(96,165,250,0.1));
  border: 1px solid rgba(167,139,250,0.2);
  border-radius: var(--radius);
  padding: 1.25rem;
  font-size: 0.875rem; color: var(--text-muted);
}

/* Toast demo */
.toast-area { display: flex; flex-direction: column; gap: 0.75rem; }

.toast-stack {
  position: fixed; bottom: 2rem; right: 2rem;
  display: flex; flex-direction: column; gap: 0.6rem;
  z-index: 9999;
}

.toast {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 0.875rem;
  min-width: 260px; max-width: 360px;
  backdrop-filter: blur(20px);
  pointer-events: auto;
}

.toast-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.toast--success .toast-dot { background: var(--green); }
.toast--info    .toast-dot { background: var(--secondary); }
.toast--warning .toast-dot { background: var(--yellow); }
.toast--error   .toast-dot { background: var(--accent); }

/* ── Scroll showcase section ─────────────────────────────────────────────────── */

.scroll-showcase-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.showcase-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: border-color 0.3s;
}
.showcase-card:hover { border-color: var(--border-glow); }

.showcase-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; margin-bottom: 1rem;
}
.showcase-icon--purple { background: rgba(167,139,250,0.15); }
.showcase-icon--blue   { background: rgba(96,165,250,0.15); }
.showcase-icon--pink   { background: rgba(244,114,182,0.15); }
.showcase-icon--green  { background: rgba(52,211,153,0.15); }
.showcase-icon--yellow { background: rgba(251,191,36,0.15); }
.showcase-icon--orange { background: rgba(251,146,60,0.15); }

.showcase-title { font-size: 1rem; font-weight: 700; margin-bottom: 0.4rem; }
.showcase-desc  { font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; }

/* ── Module cards (homepage) ─────────────────────────────────────────────────── */

.modules-mega-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.module-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: transform 0.3s cubic-bezier(0.22,1,0.36,1),
              border-color 0.3s, box-shadow 0.3s;
  position: relative; overflow: hidden;
}
.module-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}
.module-card:hover::before { opacity: 1; }
.module-card:hover {
  border-color: var(--border-glow);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.3);
}

.module-card-file {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem; color: var(--text-dim); margin-bottom: 0.6rem;
}
.module-card-name { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 0.35rem; }
.module-card-count { font-size: 0.8rem; color: var(--primary); font-weight: 600; }

/* Module pages demo cards */
.demo-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.25rem 2.5rem;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1.25rem;
  cursor: pointer; text-align: center;
  transition: border-color 0.2s, background 0.2s;
  position: relative; overflow: hidden;
}
.demo-card::after {
  content: '↺ click to replay';
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 0.5rem;
  background: rgba(167,139,250,0.12);
  font-size: 0.7rem; color: var(--primary);
  opacity: 0; transition: opacity 0.2s;
  font-family: 'JetBrains Mono', monospace;
  text-align: center;
}
.demo-card:hover::after { opacity: 1; }
.demo-card:hover { border-color: var(--border-glow); background: var(--card-hover); }

.box {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(124,58,237,0.25);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

/* ── Comparison table ────────────────────────────────────────────────────────── */

.compare-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.875rem;
}
.compare-table th {
  padding: 0.75rem 1rem; text-align: left;
  font-weight: 700; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em;
}
.compare-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.compare-table tr:hover td { background: rgba(255,255,255,0.02); }
.compare-table .th-gleam { color: var(--primary); }
.check { color: var(--green); font-size: 1rem; }
.cross { color: var(--text-dim); }
.partial { color: var(--yellow); }

/* ── CTA / Banner ────────────────────────────────────────────────────────────── */

.cta-banner {
  background: linear-gradient(135deg, rgba(124,58,237,0.12), rgba(59,130,246,0.08));
  border: 1px solid rgba(167,139,250,0.2);
  border-radius: var(--radius-lg);
  padding: 4rem 3rem;
  text-align: center;
  position: relative; overflow: hidden;
}
.cta-banner::before {
  content: '';
  position: absolute; inset: -1px;
  background: linear-gradient(135deg, rgba(167,139,250,0.3), transparent 40%, rgba(96,165,250,0.3));
  border-radius: var(--radius-lg);
  mask: linear-gradient(#fff,#fff) padding-box, linear-gradient(#fff,#fff);
  mask-composite: exclude;
  -webkit-mask: linear-gradient(#fff,#fff) padding-box, linear-gradient(#fff,#fff);
  -webkit-mask-composite: destination-out;
  pointer-events: none;
}

.cta-banner-title { font-size: 2.5rem; font-weight: 900; margin-bottom: 1rem; letter-spacing: -0.02em; }
.cta-banner-sub { color: var(--text-muted); font-size: 1.05rem; max-width: 480px; margin: 0 auto 2.5rem; line-height: 1.6; }

/* ── Footer ──────────────────────────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 3rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap; gap: 1rem;
}
.footer-left { font-size: 0.875rem; color: var(--text-muted); }
.footer-left strong { color: var(--primary); }
.footer-right { font-size: 0.8rem; color: var(--text-dim); }

/* ── Hover effects on interactive elements ───────────────────────────────────── */

/* Module pages inherit the sidenav layout */
.section-header { margin-bottom: 3rem; }
.section-header h2 { font-size: 2rem; font-weight: 800; margin-bottom: 0.75rem; letter-spacing: -0.01em; }
.section-header p { color: var(--text-muted); font-size: 1rem; max-width: 600px; line-height: 1.6; }
.hero-eyebrow-page { color: var(--primary); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.75rem; }

/* ── Modal ───────────────────────────────────────────────────────────────────── */

.gleam-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex; align-items: center; justify-content: center;
}

.gleam-modal {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  max-width: 480px; width: 90%;
  position: relative;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}

.gleam-modal-close {
  position: absolute; top: 1rem; right: 1rem;
  background: var(--border); border: none;
  color: var(--text-muted); width: 28px; height: 28px;
  border-radius: 6px; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.gleam-modal-close:hover { background: rgba(255,255,255,0.1); color: var(--text); }

.gleam-modal-title { font-size: 1.25rem; font-weight: 800; margin-bottom: 0.75rem; }
.gleam-modal-body { color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; margin-bottom: 2rem; }

/* ── Timeline demo ───────────────────────────────────────────────────────────── */

.timeline-demo {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
}

.timeline-stage {
  display: flex; flex-direction: column; gap: 0.75rem;
  margin-bottom: 1.5rem; min-height: 220px;
  padding: 1.5rem;
  background: var(--bg-3); border-radius: var(--radius);
}

.tl-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  display: flex; align-items: center; gap: 0.75rem;
  font-size: 0.875rem;
  opacity: 0;
}
.tl-item-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.tl-item--1 .tl-item-dot { background: var(--primary); }
.tl-item--2 .tl-item-dot { background: var(--secondary); }
.tl-item--3 .tl-item-dot { background: var(--accent); }
.tl-item--4 .tl-item-dot { background: var(--green); }

/* ── Responsive ──────────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .hero-section { grid-template-columns: 1fr; padding-top: 6rem; }
  .hero-visual { display: none; }
  .ways-grid { grid-template-columns: 1fr; }
  .playground { grid-template-columns: 1fr; }
  .demos-grid { grid-template-columns: 1fr; }
  .scroll-showcase-grid { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidenav { transform: translateX(-100%); transition: transform 0.3s; }
  .sidenav.open { transform: translateX(0); }
  .site-main { margin-left: 0 !important; }
  .page-content { padding: 2rem 1.25rem 4rem; }
  .topnav-links { display: none; }
  .modules-mega-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 500px) {
  .modules-mega-grid { grid-template-columns: 1fr; }
  .hero-stats { flex-wrap: wrap; gap: 1rem; }
}

/* ── Flicker prevention ──────────────────────────────────────────────────────
   Hero elements with data-gleam (no scroll trigger) would render visible, then
   gleam.js fires and replays the entrance from opacity:0 — causing a flash.
   Hiding them until gleam.js adds .gleam prevents this entirely.
   ──────────────────────────────────────────────────────────────────────────── */
[data-gleam]:not(.gleam) {
  opacity: 0;
}

/* ── Hero wrap ───────────────────────────────────────────────────────────────── */
.hero-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.hero-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.hero-orb--1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(124,58,237,0.18), transparent 70%);
  top: -100px; right: -100px;
}
.hero-orb--2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(244,114,182,0.12), transparent 70%);
  bottom: -50px; left: 10%;
}

/* Install code snippet in hero btn-row */
.install-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 6px;
  white-space: nowrap;
}

/* ── Hover showcase ──────────────────────────────────────────────────────────── */
.hover-demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}
.hover-demo-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
}
.hover-demo-item--primary {
  background: var(--primary);
  border-color: transparent;
  color: #fff;
}
.hover-demo-icon { font-size: 1.5rem; margin-bottom: 0.5rem; }
.hover-demo-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.hover-demo-item--primary .hover-demo-label { color: rgba(255,255,255,0.7); }

/* ── Feature checklist ───────────────────────────────────────────────────────── */
.feature-list { max-width: 580px; }
.feature-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}
.feature-item-check { color: var(--green); font-size: 1rem; flex-shrink: 0; }

/* ── Gradient showcase ───────────────────────────────────────────────────────── */
.gradient-swatches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.gradient-swatch { border-radius: var(--radius); height: 80px; }
.gradient-labels {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.gradient-text-showcase {
  margin-top: 3rem;
  padding: 2.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
}

/* ── FX demo ─────────────────────────────────────────────────────────────────── */
.fx-demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.fx-demo-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  font-size: 1.5rem;
  font-weight: 900;
}
.fx-demo-item--holo {
  background: linear-gradient(135deg, #0d1b2a, #1a3a4a);
  color: #0cf;
  font-size: 1.2rem;
  font-weight: 700;
}
.fx-demo-item--vhs {
  background: linear-gradient(135deg, #1a0a0a, #3a0a0a);
  color: #f55;
  font-size: 1.2rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.05em;
}
.fx-demo-item--portal {
  background: linear-gradient(135deg, var(--bg-3), #1a0d3a);
  font-size: 1.2rem;
  font-weight: 700;
}

/* ── Stagger showcase grid ───────────────────────────────────────────────────── */
.showcase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 3rem;
}

/* ── Section label (module pages) ───────────────────────────────────────────── */
.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 1.25rem;
  margin-top: 2.5rem;
}
.section-label:first-child { margin-top: 0; }
