/* ═══════════════════════════════════════════════════════════════
   WebWeaveX Documentation Portal — Design System v3.0.0
   Dark-first · Glassmorphism · Animated · Innovative
   ═══════════════════════════════════════════════════════════════ */

/* ═══ CSS Custom Properties ═══ */
:root {
  /* Dark Theme (Default) */
  --bg-deep: #030712;
  --bg-primary: #0a0f1e;
  --bg-secondary: #0f1629;
  --bg-tertiary: #141c33;
  --bg-card: rgba(15, 22, 41, 0.7);
  --bg-card-hover: rgba(20, 28, 51, 0.9);
  --bg-glass: rgba(10, 15, 30, 0.65);
  --bg-glass-hover: rgba(15, 22, 41, 0.85);
  --bg-elevated: rgba(20, 28, 51, 0.6);

  --border-subtle: rgba(56, 189, 248, 0.06);
  --border-default: rgba(56, 189, 248, 0.1);
  --border-hover: rgba(56, 189, 248, 0.25);
  --border-active: rgba(167, 139, 250, 0.4);
  --border-glow: rgba(99, 102, 241, 0.3);

  --text-bright: #f8fafc;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-dim: #475569;

  --accent-blue: #38bdf8;
  --accent-indigo: #818cf8;
  --accent-purple: #a78bfa;
  --accent-pink: #f472b6;
  --accent-rose: #fb7185;
  --accent-green: #34d399;
  --accent-emerald: #10b981;
  --accent-yellow: #fbbf24;
  --accent-amber: #f59e0b;
  --accent-cyan: #22d3ee;
  --accent-orange: #fb923c;

  --gradient-hero: linear-gradient(135deg, #60a5fa 0%, #818cf8 30%, #a78bfa 55%, #f472b6 80%, #fb7185 100%);
  --gradient-hero-vivid: linear-gradient(135deg, #3b82f6 0%, #6366f1 30%, #8b5cf6 55%, #ec4899 80%, #f43f5e 100%);
  --gradient-card: linear-gradient(180deg, rgba(15, 22, 41, 0.8) 0%, rgba(10, 15, 30, 0.95) 100%);
  --gradient-glow: radial-gradient(ellipse 100% 60% at 50% -10%, rgba(99, 102, 241, 0.12) 0%, transparent 60%),
                   radial-gradient(ellipse 50% 40% at 85% 20%, rgba(167, 139, 250, 0.06) 0%, transparent 50%),
                   radial-gradient(ellipse 40% 30% at 15% 60%, rgba(56, 189, 248, 0.04) 0%, transparent 50%);
  --gradient-border: linear-gradient(135deg, var(--accent-blue), var(--accent-purple), var(--accent-pink));
  --gradient-mesh: radial-gradient(at 40% 20%, rgba(56, 189, 248, 0.08) 0px, transparent 50%),
                   radial-gradient(at 80% 0%, rgba(167, 139, 250, 0.06) 0px, transparent 50%),
                   radial-gradient(at 0% 50%, rgba(56, 189, 248, 0.04) 0px, transparent 50%),
                   radial-gradient(at 80% 50%, rgba(244, 114, 182, 0.04) 0px, transparent 50%),
                   radial-gradient(at 0% 100%, rgba(99, 102, 241, 0.06) 0px, transparent 50%);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', monospace;

  --sidebar-width: 272px;
  --header-height: 64px;
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 30px;
  --radius-full: 9999px;

  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-fast: 0.15s var(--ease-out-expo);
  --transition-normal: 0.3s var(--ease-out-expo);
  --transition-slow: 0.5s var(--ease-out-expo);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
  --shadow-glow-blue: 0 0 24px rgba(56, 189, 248, 0.12), 0 0 48px rgba(56, 189, 248, 0.06);
  --shadow-glow-purple: 0 0 24px rgba(167, 139, 250, 0.12), 0 0 48px rgba(167, 139, 250, 0.06);
  --shadow-glow-pink: 0 0 24px rgba(244, 114, 182, 0.12);
}

/* ═══ Light Theme ═══ */
[data-theme="light"] {
  --bg-deep: #f1f5f9;
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(241, 245, 249, 0.95);
  --bg-glass: rgba(255, 255, 255, 0.7);
  --bg-glass-hover: rgba(241, 245, 249, 0.9);
  --bg-elevated: rgba(241, 245, 249, 0.6);

  --border-subtle: rgba(15, 23, 42, 0.05);
  --border-default: rgba(15, 23, 42, 0.08);
  --border-hover: rgba(15, 23, 42, 0.15);
  --border-active: rgba(99, 102, 241, 0.3);
  --border-glow: rgba(99, 102, 241, 0.15);

  --text-bright: #0f172a;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  --gradient-hero: linear-gradient(135deg, #2563eb 0%, #4f46e5 30%, #7c3aed 55%, #db2777 80%, #e11d48 100%);
  --gradient-card: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.95) 100%);
  --gradient-glow: radial-gradient(ellipse 100% 60% at 50% -10%, rgba(99, 102, 241, 0.06) 0%, transparent 60%);
  --gradient-mesh: radial-gradient(at 40% 20%, rgba(37, 99, 235, 0.04) 0px, transparent 50%),
                   radial-gradient(at 80% 0%, rgba(124, 58, 237, 0.03) 0px, transparent 50%);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.08);
  --shadow-glow-blue: 0 0 24px rgba(37, 99, 235, 0.06);
  --shadow-glow-purple: 0 0 24px rgba(124, 58, 237, 0.06);
}

/* ═══ Reset & Base ═══ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-family: var(--font-sans);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background: var(--bg-primary);
  background-image: var(--gradient-mesh);
  background-attachment: fixed;
  transition: background 0.5s ease;
}

::selection { background: rgba(99, 102, 241, 0.3); color: var(--text-bright); }
a { color: var(--accent-blue); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--accent-indigo); }

/* ═══ Scrollbar ═══ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-indigo); }

/* ═══ Canvas Background ═══ */
#bg-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* ═══ Navbar ═══ */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--bg-glass);
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  transition: all var(--transition-normal);
}
.navbar.scrolled {
  border-bottom-color: var(--border-default);
  box-shadow: var(--shadow-sm);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-bright);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.5px;
}
.nav-logo-icon { width: 34px; height: 34px; transition: transform 0.4s var(--ease-spring); }
.nav-brand:hover .nav-logo-icon { transform: rotate(20deg) scale(1.08); }

.brand-gradient {
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-controls { display: flex; align-items: center; gap: 12px; }

/* Search */
.search-box { position: relative; width: 260px; }

.search-input {
  width: 100%;
  padding: 9px 16px 9px 38px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-default);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: var(--font-sans);
  outline: none;
  transition: all var(--transition-fast);
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
  border-color: var(--accent-indigo);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.12), var(--shadow-glow-purple);
  background: var(--bg-tertiary);
}

.search-icon {
  position: absolute; left: 13px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted); width: 16px; height: 16px;
  pointer-events: none;
}

.search-kbd {
  position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%);
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 2px 6px;
  background: var(--bg-tertiary);
}

/* Theme Toggle */
.theme-toggle-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  width: 38px; height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.4s var(--ease-spring);
  position: relative;
  overflow: hidden;
}
.theme-toggle-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(251, 191, 36, 0.15), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}
.theme-toggle-btn:hover {
  border-color: var(--accent-amber);
  color: var(--accent-amber);
  transform: rotate(30deg) scale(1.1);
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.15);
}
.theme-toggle-btn:hover::before { opacity: 1; }

/* GitHub Button */
.btn-github {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}
.btn-github:hover {
  border-color: var(--accent-purple);
  background: var(--bg-card-hover);
  color: var(--accent-purple);
  box-shadow: var(--shadow-glow-purple);
  transform: translateY(-1px);
}

/* ═══ Layout ═══ */
.layout-container {
  display: flex;
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
  position: relative;
  z-index: 1;
}

/* ═══ Sidebar ═══ */
.sidebar {
  width: var(--sidebar-width);
  background: transparent;
  border-right: 1px solid var(--border-subtle);
  padding: 28px 16px;
  position: fixed;
  top: var(--header-height);
  bottom: 0;
  overflow-y: auto;
  z-index: 50;
}

.sidebar-group { margin-bottom: 28px; }

.sidebar-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-dim);
  margin-bottom: 10px;
  padding: 0 12px;
}

.sidebar-link {
  display: block;
  padding: 7px 12px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  border-radius: var(--radius-xs);
  transition: all var(--transition-fast);
  border-left: 2px solid transparent;
  margin-bottom: 1px;
}
.sidebar-link:hover {
  color: var(--accent-blue);
  background: rgba(56, 189, 248, 0.05);
}
.sidebar-link.active {
  color: var(--accent-indigo);
  background: rgba(129, 140, 248, 0.08);
  border-left-color: var(--accent-indigo);
  font-weight: 600;
}

/* ═══ Main Content ═══ */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 0 60px 80px 60px;
  max-width: 1160px;
}

/* ═══ Hero ═══ */
.hero-banner {
  text-align: center;
  padding: 90px 20px 70px;
  position: relative;
  overflow: hidden;
}
.hero-banner::before {
  content: '';
  position: absolute;
  top: -200px; left: 50%;
  transform: translateX(-50%);
  width: 800px; height: 800px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, rgba(167, 139, 250, 0.04) 40%, transparent 70%);
  pointer-events: none;
  animation: heroPulse 6s ease-in-out infinite;
}

.hero-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  color: var(--accent-indigo);
  padding: 7px 22px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 28px;
  animation: fadeInUp 0.7s var(--ease-out-expo);
  backdrop-filter: blur(8px);
}

.hero-title {
  font-size: 3.8rem;
  font-weight: 900;
  letter-spacing: -2px;
  margin-bottom: 20px;
  line-height: 1.08;
  animation: fadeInUp 0.7s var(--ease-out-expo) 0.1s both;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 680px;
  margin: 0 auto 36px;
  line-height: 1.75;
  animation: fadeInUp 0.7s var(--ease-out-expo) 0.2s both;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  animation: fadeInUp 0.7s var(--ease-out-expo) 0.3s both;
}

.hero-install-cmd {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  padding: 10px 20px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-primary);
  margin-top: 16px;
  animation: fadeInUp 0.7s var(--ease-out-expo) 0.35s both;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.hero-install-cmd:hover {
  border-color: var(--accent-green);
  background: var(--bg-card-hover);
}
.hero-install-cmd .prompt { color: var(--accent-green); }
.hero-install-cmd .pkg { color: var(--accent-cyan); }
.hero-install-cmd .copy-icon {
  color: var(--text-muted);
  width: 14px; height: 14px;
  transition: color var(--transition-fast);
}
.hero-install-cmd:hover .copy-icon { color: var(--accent-green); }

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 56px;
  margin-top: 52px;
  padding-top: 36px;
  border-top: 1px solid var(--border-subtle);
  animation: fadeInUp 0.7s var(--ease-out-expo) 0.45s both;
}

.hero-stat { text-align: center; position: relative; }

.hero-stat-value {
  font-size: 2.2rem;
  font-weight: 800;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.hero-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 600;
  margin-top: 2px;
}

/* ═══ Buttons ═══ */
.btn-primary {
  background: var(--gradient-hero-vivid);
  color: #fff;
  padding: 13px 32px;
  border-radius: var(--radius-full);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 8px 24px -4px rgba(99, 102, 241, 0.35);
  transition: all var(--transition-fast);
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.3s;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 36px -4px rgba(139, 92, 246, 0.45);
  color: #fff;
}
.btn-primary:hover::before { opacity: 1; }

.btn-secondary {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  padding: 13px 32px;
  border-radius: var(--radius-full);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}
.btn-secondary:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  color: var(--text-bright);
  box-shadow: var(--shadow-glow-blue);
  transform: translateY(-1px);
}

/* ═══ Sections ═══ */
section {
  margin-bottom: 72px;
  scroll-margin-top: calc(var(--header-height) + 24px);
}
section h2 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.7px;
  margin-bottom: 14px;
  color: var(--text-bright);
}
section h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-bright);
}
section p {
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.75;
  max-width: 720px;
}

/* ═══ Section Divider ═══ */
.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-default) 20%, var(--border-hover) 50%, var(--border-default) 80%, transparent);
  margin: 0 0 72px 0;
  border: none;
}

/* ═══ Feature Cards ═══ */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; margin: 24px 0; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin: 24px 0; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 24px 0; }

.feature-card {
  background: var(--gradient-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 28px;
  transition: all 0.4s var(--ease-out-expo);
  position: relative;
  overflow: hidden;
}
.feature-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: var(--gradient-hero);
  opacity: 0;
  transition: opacity 0.4s;
}
.feature-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  background: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.06), transparent 60%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}
.feature-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), var(--shadow-glow-blue);
}
.feature-card:hover::before { opacity: 1; }
.feature-card:hover::after { opacity: 1; }

.card-icon {
  width: 48px; height: 48px;
  background: rgba(129, 140, 248, 0.08);
  border: 1px solid rgba(129, 140, 248, 0.12);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 16px;
  transition: all 0.4s var(--ease-spring);
}
.feature-card:hover .card-icon {
  transform: scale(1.1) rotate(-5deg);
  border-color: rgba(129, 140, 248, 0.3);
}

.card-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; color: var(--text-bright); }
.card-desc { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.65; }

/* ═══ SDK Tabs ═══ */
.sdk-tabs-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 24px 0;
}

.sdk-tab-header {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.sdk-tab-btn {
  padding: 14px 22px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.sdk-tab-btn:hover { color: var(--text-primary); background: rgba(129, 140, 248, 0.04); }
.sdk-tab-btn.active {
  color: var(--accent-indigo);
  border-bottom-color: var(--accent-indigo);
  background: rgba(129, 140, 248, 0.06);
}

.sdk-tab-content { padding: 28px; display: none; animation: fadeIn 0.3s ease; }
.sdk-tab-content.active { display: block; }

/* ═══ Code Blocks ═══ */
.code-wrapper {
  position: relative;
  background: #060a14;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin: 14px 0;
  overflow: hidden;
}
[data-theme="light"] .code-wrapper { background: #1e293b; }

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.copy-btn {
  background: none;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: var(--radius-xs);
  font-size: 0.72rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.copy-btn:hover {
  background: rgba(52, 211, 153, 0.1);
  border-color: var(--accent-green);
  color: var(--accent-green);
}

pre code {
  display: block;
  padding: 18px;
  font-family: var(--font-mono);
  font-size: 0.83rem;
  line-height: 1.75;
  overflow-x: auto;
  color: #e2e8f0;
  tab-size: 2;
}

/* ═══ Tables ═══ */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}
th, td {
  padding: 13px 20px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.88rem;
}
th {
  background: var(--bg-elevated);
  font-weight: 700;
  color: var(--text-bright);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(129, 140, 248, 0.03); }

/* ═══ Mermaid ═══ */
.mermaid-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 28px;
  margin: 24px 0;
  overflow-x: auto;
  text-align: center;
}

/* ═══ Search Dropdown ═══ */
.search-results-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 380px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  animation: fadeInDown 0.2s var(--ease-out-expo);
  backdrop-filter: blur(16px);
}
.search-result-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  display: block;
  text-decoration: none;
  color: var(--text-primary);
  transition: background var(--transition-fast);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-card-hover); }
.search-result-title { font-weight: 600; font-size: 0.88rem; color: var(--accent-indigo); margin-bottom: 2px; }
.search-result-excerpt { font-size: 0.76rem; color: var(--text-muted); line-height: 1.4; }

/* ═══ Footer ═══ */
.site-footer {
  padding: 52px 0 36px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 48px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}
.footer-brand { max-width: 320px; }
.footer-brand h3 { font-size: 1.2rem; font-weight: 800; margin-bottom: 10px; color: var(--text-bright); }
.footer-brand p { color: var(--text-muted); font-size: 0.85rem; line-height: 1.6; }
.footer-col h4 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-dim);
  margin-bottom: 14px;
}
.footer-col a {
  display: block;
  color: var(--text-secondary);
  font-size: 0.85rem;
  padding: 3px 0;
  transition: color var(--transition-fast);
}
.footer-col a:hover { color: var(--accent-indigo); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-dim);
  font-size: 0.8rem;
}

/* ═══ Scroll Reveal ═══ */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s var(--ease-out-expo), transform 0.7s var(--ease-out-expo);
}
.reveal.visible { opacity: 1; transform: translateY(0); }
.reveal-delay-1 { transition-delay: 0.08s; }
.reveal-delay-2 { transition-delay: 0.16s; }
.reveal-delay-3 { transition-delay: 0.24s; }

/* ═══ Keyframes ═══ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes heroPulse {
  0%, 100% { opacity: 0.8; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.05); }
}
@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.1); }
  50% { box-shadow: 0 0 40px rgba(99, 102, 241, 0.2); }
}

/* ═══ Badge Pulse ═══ */
.badge-pulse {
  animation: glow-pulse 3s ease-in-out infinite;
}

/* ═══ 3D Hero Logo ═══ */
.hero-3d-logo {
  width: 120px; height: 120px;
  margin: 0 auto 32px;
  perspective: 600px;
  animation: fadeInUp 0.7s var(--ease-out-expo) 0.05s both;
}
.hero-3d-logo .hex-spinner {
  width: 100%; height: 100%;
  position: relative;
  transform-style: preserve-3d;
  animation: hexRotate 8s linear infinite;
}
.hero-3d-logo .hex-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-3d-logo svg { width: 80px; height: 80px; filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.4)); }

@keyframes hexRotate {
  0% { transform: rotateY(0deg) rotateX(10deg); }
  100% { transform: rotateY(360deg) rotateX(10deg); }
}

/* ═══ Animated Gradient Text ═══ */
.gradient-text-animated {
  background: linear-gradient(90deg, #60a5fa, #a78bfa, #f472b6, #60a5fa);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 4s ease infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ═══ Live Terminal Hero ═══ */
.hero-terminal {
  max-width: 520px;
  margin: 28px auto 0;
  background: #0c0e1a;
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 0 40px rgba(99, 102, 241, 0.1), 0 20px 60px rgba(0,0,0,0.4);
  animation: fadeInUp 0.7s var(--ease-out-expo) 0.4s both;
  text-align: left;
}
.hero-terminal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid rgba(99, 102, 241, 0.1);
}
.hero-terminal-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
}
.hero-terminal-dot.red { background: #ff5f57; }
.hero-terminal-dot.yellow { background: #febc2e; }
.hero-terminal-dot.green { background: #28c840; }
.hero-terminal-title {
  flex: 1;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.hero-terminal-body {
  padding: 18px 20px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.8;
  color: #a5b4fc;
}
.hero-terminal-body .prompt { color: #34d399; }
.hero-terminal-body .cmd { color: #e2e8f0; }
.hero-terminal-body .output { color: #94a3b8; }
.hero-terminal-body .hash { color: #fbbf24; }
.hero-terminal-body .cursor {
  display: inline-block;
  width: 8px; height: 16px;
  background: #818cf8;
  animation: blink 1s step-end infinite;
  vertical-align: text-bottom;
  margin-left: 2px;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ═══ Floating Orbs ═══ */
.floating-orbs {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.15;
  animation: orbFloat 20s ease-in-out infinite;
}
.orb-1 {
  width: 400px; height: 400px;
  background: #6366f1;
  top: 10%; left: -5%;
  animation-delay: 0s;
}
.orb-2 {
  width: 300px; height: 300px;
  background: #ec4899;
  top: 50%; right: -5%;
  animation-delay: -7s;
  animation-duration: 25s;
}
.orb-3 {
  width: 250px; height: 250px;
  background: #38bdf8;
  bottom: 10%; left: 30%;
  animation-delay: -14s;
  animation-duration: 22s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -40px) scale(1.05); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(40px, 30px) scale(1.02); }
}

/* ═══ Glowing Card Borders ═══ */
.feature-card-glow {
  position: relative;
}
.feature-card-glow::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px; right: -1px; bottom: -1px;
  border-radius: calc(var(--radius-md) + 1px);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(167, 139, 250, 0.1), rgba(244, 114, 182, 0.3));
  z-index: -1;
  opacity: 0;
  transition: opacity 0.5s;
}
.feature-card-glow:hover::before {
  opacity: 1;
}

/* ═══ Animated Underline Headings ═══ */
section h2 {
  position: relative;
  display: inline-block;
}
section h2::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 3px;
  background: var(--gradient-hero);
  border-radius: 2px;
  transition: width 0.6s var(--ease-out-expo);
}
section h2:hover::after {
  width: 100%;
}

/* ═══ Stats Counter Glow ═══ */
.hero-stat-value {
  position: relative;
}
.hero-stat::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 3px;
  background: var(--gradient-hero);
  border-radius: 2px;
  opacity: 0.4;
}

/* ═══ Mobile ═══ */
/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — app-like behaviour across every screen size
   Breakpoints: 1200 · 900 (drawer) · 640 · 400
   ═══════════════════════════════════════════════════════════ */

/* ── Nothing may push the page sideways ── */
html, body { max-width: 100%; }
.main-content, .layout-container, section { min-width: 0; }

/* Anchor targets must clear the fixed navbar */
[id] { scroll-margin-top: calc(var(--header-height) + 14px); }

/* The brand mark must never be squeezed out by the controls */
.nav-brand { min-width: 0; flex-shrink: 1; }
.nav-logo-icon { flex-shrink: 0; }
.nav-brand > span { white-space: nowrap; }
.nav-controls { flex-shrink: 0; }

/* Long unbroken strings (coordinates, URLs, hashes) wrap instead of overflowing */
p, li, td, th, h1, h2, h3, .card-desc { overflow-wrap: break-word; }

/* Wide tables scroll inside themselves (wrapper injected by app.js) */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 24px 0;
  border-radius: var(--radius-md);
}
.table-scroll > table { margin: 0; min-width: 560px; }
.table-scroll::-webkit-scrollbar { height: 8px; }
.table-scroll::-webkit-scrollbar-thumb {
  background: var(--border-default); border-radius: 4px;
}

/* Code and diagrams scroll rather than clip */
.code-wrapper pre, .mermaid-box, .hero-terminal-body { max-width: 100%; overflow-x: auto; }
.sdk-tab-header { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.sdk-tab-header::-webkit-scrollbar { display: none; }

/* Media never overflows its column */
img, svg, canvas, video { max-width: 100%; height: auto; }

/* ── Drawer backdrop (mobile nav) ── */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 18, 0.66);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
  z-index: 85;
}
.sidebar-backdrop.visible { opacity: 1; visibility: visible; }

/* Hamburger — shown only once the drawer is in play */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}
.mobile-menu-btn:hover { border-color: var(--accent-blue); color: var(--accent-blue); }

/* ═══ ≤1200px — tighten the shell ═══ */
@media (max-width: 1200px) {
  .main-content { padding: 0 36px 72px 36px; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

/* ═══ ≤900px — sidebar becomes a drawer ═══ */
@media (max-width: 900px) {
  .navbar { padding: 0 16px; gap: 10px; }
  .mobile-menu-btn { display: flex; }

  /* .layout-container's z-index:1 traps the sidebar in a stacking context
     below the body-level backdrop. Drop it so the drawer sits above. */
  .layout-container { z-index: auto; }

  .sidebar {
    width: min(82vw, 320px);
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    z-index: 90;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-default);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
    overscroll-behavior: contain;
  }
  .sidebar.open { transform: translateX(0); }

  .main-content {
    margin-left: 0;
    padding: 0 20px 56px 20px;
    max-width: 100%;
  }

  .hero-banner { padding: 56px 4px 48px; }
  .hero-title { font-size: 2.4rem; letter-spacing: -1px; }
  .hero-subtitle { font-size: 1rem; }
  .hero-stats { gap: 28px; flex-wrap: wrap; }
  .hero-stat-value { font-size: 1.6rem; }
  .hero-3d-logo { transform: scale(0.85); }

  .search-box { width: 150px; }
  .search-kbd { display: none; }
  .btn-github span { display: none; }

  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }
  section h2 { font-size: 1.6rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ═══ ≤640px — phones ═══ */
@media (max-width: 640px) {
  .navbar { padding: 0 12px; }
  /* Search collapses; Ctrl-K / the drawer cover navigation here */
  .search-box { display: none; }

  .main-content { padding: 0 16px 48px 16px; }
  .hero-banner { padding: 40px 0 40px; }
  .hero-title { font-size: 1.95rem; }
  .hero-subtitle { font-size: 0.95rem; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .btn-primary,
  .hero-actions .btn-secondary { width: 100%; text-align: center; }
  .hero-install-cmd { font-size: 0.78rem; padding: 8px 14px; }
  .hero-stats { gap: 20px 28px; justify-content: space-around; }
  .hero-3d-logo { transform: scale(0.72); }

  .footer-grid { grid-template-columns: 1fr; }
  section h2 { font-size: 1.4rem; }
  section { margin-bottom: 40px; }

  .code-wrapper pre { font-size: 0.78rem; }
  th, td { padding: 10px 14px; font-size: 0.82rem; }
  .mermaid-box { padding: 16px; }

  /* Comfortable tap targets */
  .sidebar-link { padding: 11px 14px; font-size: 0.9rem; }
  .copy-btn, .theme-toggle-btn, .btn-github { min-height: 40px; }
}

/* ═══ ≤480px — icon-only brand, like an app's title bar ═══ */
@media (max-width: 480px) {
  .nav-brand > span { display: none; }
  .nav-logo-icon { width: 30px; height: 30px; }
  .nav-controls { gap: 8px; }
}

/* ═══ ≤400px — small phones ═══ */
@media (max-width: 400px) {
  .main-content { padding: 0 13px 40px 13px; }
  .hero-title { font-size: 1.7rem; letter-spacing: -0.5px; }
  .hero-3d-logo { display: none; }
  .hero-stats { gap: 16px 20px; }
  .hero-stat-value { font-size: 1.35rem; }
  .code-wrapper pre { font-size: 0.72rem; }
  .table-scroll > table { min-width: 460px; }
}

/* ═══ Landscape phones — reclaim vertical space ═══ */
@media (max-height: 480px) and (orientation: landscape) {
  .hero-banner { padding: 28px 0 28px; }
  .hero-3d-logo { display: none; }
  .sidebar { padding-top: 16px; }
}

/* ═══ Notch / safe-area support ═══ */
@supports (padding: env(safe-area-inset-left)) {
  .navbar {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  @media (max-width: 900px) {
    .main-content {
      padding-left: max(20px, env(safe-area-inset-left));
      padding-right: max(20px, env(safe-area-inset-right));
    }
  }
}

/* ═══ Coarse pointers (touch) — no hover-only affordances ═══ */
@media (hover: none) {
  .copy-btn { opacity: 1; }
  tr:hover td { background: transparent; }
}

/* ═══ Respect 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;
  }
}

/* ═══ Print ═══ */
@media print {
  .navbar, .sidebar, .sidebar-backdrop, #bg-canvas,
  .floating-orbs, .mobile-menu-btn { display: none !important; }
  .main-content { margin: 0; padding: 0; max-width: 100%; }
  body { background: #fff; }
}

/* ═══ Status pills & note boxes ═══ */
.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  white-space: nowrap;
  vertical-align: middle;
}
.pill-green { color: var(--accent-green); background: color-mix(in srgb, var(--accent-green) 12%, transparent); }
.pill-amber { color: var(--accent-amber); background: color-mix(in srgb, var(--accent-amber) 12%, transparent); }
.pill-blue  { color: var(--accent-blue);  background: color-mix(in srgb, var(--accent-blue) 12%, transparent); }

.note-box {
  margin-top: 20px;
  padding: 16px 20px;
  border-left: 3px solid var(--accent-amber);
  border-radius: 0 10px 10px 0;
  background: color-mix(in srgb, var(--accent-amber) 8%, transparent);
  font-size: 0.92rem;
  line-height: 1.7;
}
