/* ============================================
   Visual Learning Hub - Design System v2
   Modern, clean, optimized for visual learning
   ============================================ */

/* --- Metric-Matched Font Fallbacks (Zero CLS on font swap) --- */
@font-face {
  font-family: 'Poppins Fallback';
  src: local('Arial');
  size-adjust: 112%;
  ascent-override: 105%;
  descent-override: 35%;
  line-gap-override: 0%;
}

@font-face {
  font-family: 'Inter Fallback';
  src: local('Arial');
  size-adjust: 100.5%;
  ascent-override: 100%;
  descent-override: 25%;
  line-gap-override: 0%;
}

@font-face {
  font-family: 'JetBrains Mono Fallback';
  src: local('Courier New');
  size-adjust: 112%;
  ascent-override: 100%;
  descent-override: 25%;
  line-gap-override: 0%;
}

/* --- CSS Custom Properties (Light Theme) --- */
:root {
  /* Core Colors - Indigo/Blue learning palette */
  --color-bg: #f8faff;
  --color-bg-secondary: #eef2ff;
  --color-bg-tertiary: #e0e7ff;
  --color-surface: #ffffff;
  --color-text: #1e293b;
  --color-text-secondary: #475569;
  --color-text-muted: #6b7a8d;
  --color-border: #c7d2fe;
  --color-border-light: #e0e7ff;
  --color-link: #4f46e5;
  --color-link-hover: #4338ca;
  --color-accent: #f59e0b;
  --color-accent-text: #92400e;

  /* Domain Colors */
  --color-domain-dev-tools: #7c3aed;
  --color-domain-programming: #2563eb;
  --color-domain-databases: #059669;
  --color-domain-devops: #d97706;
  --color-domain-networking: #dc2626;
  --color-domain-security: #db2777;

  /* Callout Colors */
  --color-info-bg: #eef2ff;
  --color-info-border: #6366f1;
  --color-info-text: #3730a3;
  --color-info-icon: #6366f1;
  --color-warning-bg: #fffbeb;
  --color-warning-border: #f59e0b;
  --color-warning-text: #92400e;
  --color-warning-icon: #f59e0b;
  --color-tip-bg: #ecfdf5;
  --color-tip-border: #10b981;
  --color-tip-text: #065f46;
  --color-tip-icon: #10b981;
  --color-insight-bg: #faf5ff;
  --color-insight-border: #a78bfa;
  --color-insight-text: #5b21b6;
  --color-insight-icon: #a78bfa;
  --color-deprecated-bg: #fef2f2;
  --color-deprecated-border: #ef4444;
  --color-deprecated-text: #991b1b;
  --color-outdated-bg: #fffbeb;
  --color-outdated-border: #f59e0b;
  --color-outdated-text: #92400e;

  /* TL;DR - Prominent gradient */
  --color-tldr-bg: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  --color-tldr-border: #6366f1;
  --color-tldr-text: #1e293b;
  --color-tldr-label: #4f46e5;

  /* Test Yourself */
  --color-test-bg: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  --color-test-border: #10b981;
  --color-test-accent: #059669;

  /* Cheat Sheet */
  --color-cheat-bg: linear-gradient(135deg, #faf5ff 0%, #ede9fe 100%);
  --color-cheat-border: #a78bfa;
  --color-cheat-accent: #7c3aed;

  /* ELI12 */
  --color-eli12-bg: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  --color-eli12-border: #fb923c;
  --color-eli12-accent: #ea580c;

  /* Code */
  --color-code-bg: #1e1e2e;
  --color-code-border: #313244;
  --color-code-text: #cdd6f4;
  --color-inline-code-bg: #e0e7ff;
  --color-inline-code-text: #4338ca;

  /* Shadows - More depth */
  --shadow-sm: 0 1px 3px rgba(79, 70, 229, 0.04), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(79, 70, 229, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 24px rgba(79, 70, 229, 0.12), 0 4px 8px rgba(0, 0, 0, 0.06);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);

  /* Typography */
  --font-heading: 'Poppins', 'Poppins Fallback', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans: 'Inter', 'Inter Fallback', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'JetBrains Mono Fallback', 'Fira Code', monospace;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.5rem;
  --font-size-5xl: 3.25rem;
  --line-height-tight: 1.2;
  --line-height-normal: 1.65;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* Layout */
  --max-width: 1200px;
  --sidebar-width: 260px;
  --right-sidebar-width: 220px;
  --header-height: 64px;
  --border-radius: 10px;
  --border-radius-lg: 16px;
  --border-radius-xl: 24px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 300ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 500ms cubic-bezier(0.16, 1, 0.3, 1);

}

/* --- Dark Theme - Cinema-inspired with proper contrast --- */
[data-theme="dark"] {
  --color-bg: #0c0f1a;
  --color-bg-secondary: #131829;
  --color-bg-tertiary: #1c2240;
  --color-surface: #171d33;
  --color-text: #e2e8f0;
  --color-text-secondary: #a0aec0;
  --color-text-muted: #8892a6;
  --color-border: #2a3255;
  --color-border-light: #1e2544;
  --color-link: #818cf8;
  --color-link-hover: #a5b4fc;
  --color-accent: #fbbf24;
  --color-accent-text: #fef3c7;

  --color-info-bg: rgba(99, 102, 241, 0.12);
  --color-info-border: #818cf8;
  --color-info-text: #c7d2fe;
  --color-info-icon: #818cf8;
  --color-warning-bg: rgba(245, 158, 11, 0.12);
  --color-warning-border: #fbbf24;
  --color-warning-text: #fde68a;
  --color-warning-icon: #fbbf24;
  --color-tip-bg: rgba(16, 185, 129, 0.12);
  --color-tip-border: #34d399;
  --color-tip-text: #a7f3d0;
  --color-tip-icon: #34d399;
  --color-insight-bg: rgba(167, 139, 250, 0.12);
  --color-insight-border: #a78bfa;
  --color-insight-text: #ddd6fe;
  --color-insight-icon: #a78bfa;
  --color-deprecated-bg: rgba(239, 68, 68, 0.12);
  --color-deprecated-border: #f87171;
  --color-deprecated-text: #fecaca;
  --color-outdated-bg: rgba(245, 158, 11, 0.12);
  --color-outdated-border: #fbbf24;
  --color-outdated-text: #fde68a;

  --color-tldr-bg: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(79, 70, 229, 0.18) 100%);
  --color-tldr-border: #818cf8;
  --color-tldr-text: #e2e8f0;
  --color-tldr-label: #a5b4fc;

  --color-test-bg: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.15) 100%);
  --color-test-border: #34d399;
  --color-test-accent: #6ee7b7;

  --color-cheat-bg: linear-gradient(135deg, rgba(167, 139, 250, 0.1) 0%, rgba(124, 58, 237, 0.15) 100%);
  --color-cheat-border: #a78bfa;
  --color-cheat-accent: #c4b5fd;

  --color-eli12-bg: linear-gradient(135deg, rgba(251, 146, 60, 0.1) 0%, rgba(234, 88, 12, 0.15) 100%);
  --color-eli12-border: #fb923c;
  --color-eli12-accent: #fdba74;

  --color-code-bg: #0d1117;
  --color-code-border: #21262d;
  --color-code-text: #c9d1d9;
  --color-inline-code-bg: rgba(99, 102, 241, 0.25);
  --color-inline-code-text: #c7d2fe;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.2);

}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  transition: background-color var(--transition-normal), color var(--transition-normal);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--color-link);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-link-hover);
  text-decoration: underline;
}

img { max-width: 100%; height: auto; display: block; }

/* Anchor scroll offset for sticky header */
section[id], details[id] {
  scroll-margin-top: calc(var(--header-height) + var(--space-4));
}

::selection {
  background: rgba(99, 102, 241, 0.2);
  color: var(--color-text);
}

pre::selection, pre *::selection,
code::selection, code *::selection {
  background: rgba(99, 102, 241, 0.4);
  color: #e2e8f0;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: var(--line-height-tight);
  color: var(--color-text);
  font-weight: 600;
  letter-spacing: -0.02em;
}

h1 {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  margin-bottom: var(--space-6);
}

h2 {
  font-size: var(--font-size-2xl);
  margin-top: var(--space-10);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--color-border-light);
}

h3 {
  font-size: var(--font-size-xl);
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
}

p {
  margin-bottom: var(--space-4);
  max-width: 65ch;
}

strong {
  font-weight: 600;
  color: var(--color-text);
}

/* --- Header / Top Nav - Glassmorphism --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(248, 250, 255, 0.8);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid rgba(199, 210, 254, 0.5);
  transition: background-color var(--transition-normal);
}

[data-theme="dark"] .site-header {
  background: rgba(12, 15, 26, 0.8);
  border-bottom-color: rgba(42, 50, 85, 0.5);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-5);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.site-logo {
  font-family: var(--font-heading);
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--color-link) 0%, #7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.site-logo:hover {
  text-decoration: none;
  opacity: 0.85;
}

/* Domain Tabs */
.domain-tabs {
  display: flex;
  gap: var(--space-1);
  overflow-x: auto;
  scrollbar-width: none;
}

.domain-tabs::-webkit-scrollbar { display: none; }

.domain-tab {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--border-radius);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.domain-tab:hover {
  background: var(--color-bg-secondary);
  color: var(--color-text);
  text-decoration: none;
}

.domain-tab.active {
  background: var(--color-link);
  color: #ffffff;
  font-weight: 600;
}

/* Header Links */
.header-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

.header-link {
  padding: var(--space-1) var(--space-3);
  border-radius: 100px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.header-link:hover {
  color: var(--color-link);
  background: var(--color-bg-secondary);
}

.header-link.active {
  color: var(--color-link);
  font-weight: 600;
}

/* Header Search */
.header-search {
  position: relative;
  flex-shrink: 0;
}

.header-search input {
  width: 200px;
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-8);
  border: 1px solid var(--color-border);
  border-radius: 100px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-family: var(--font-sans);
  transition: all var(--transition-fast);
}

.header-search input:focus {
  outline: none;
  border-color: var(--color-link);
  width: 280px;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.header-search .search-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  width: 16px;
  height: 16px;
}

/* Theme Toggle */
.theme-toggle {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 100px;
  padding: var(--space-2);
  cursor: pointer;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--color-bg-secondary);
  color: var(--color-link);
  border-color: var(--color-link);
}

[data-theme="dark"] .theme-toggle {
  background: var(--color-bg-tertiary);
  border-color: var(--color-border);
  color: #e2e8f0;
}

[data-theme="dark"] .theme-toggle:hover {
  border-color: var(--color-link);
  color: var(--color-link);
  background: rgba(129, 140, 248, 0.12);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  flex-shrink: 0;
}

.theme-toggle svg circle,
.theme-toggle svg line,
.theme-toggle svg path {
  stroke: currentColor;
}

[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun circle,
[data-theme="dark"] .theme-toggle .icon-sun line {
  stroke: #fbbf24;
}

/* Mobile Menu Toggle */
.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: var(--space-2);
  cursor: pointer;
  color: var(--color-text-secondary);
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
}

/* Mobile Nav Panel (shown when hamburger is tapped on pages without sidebar) */
.mobile-nav {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  z-index: 89;
  padding: var(--space-3) var(--space-4);
  overflow-y: auto;
  max-height: calc(100vh - var(--header-height));
}

.mobile-nav.open {
  display: block;
}

.mobile-nav-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.mobile-nav-section + .mobile-nav-section {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.mobile-nav-link {
  display: block;
  padding: var(--space-2) var(--space-3);
  color: var(--color-text-secondary);
  text-decoration: none;
  border-radius: var(--border-radius);
  font-size: var(--font-size-sm);
  transition: background 0.15s, color 0.15s;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
  background: var(--color-primary-bg);
  color: var(--color-primary);
}

/* --- Layout --- */
.page-layout {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-8) var(--space-5);
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: var(--space-8);
  min-height: calc(100vh - var(--header-height));
}

.page-layout.with-right-sidebar {
  grid-template-columns: var(--sidebar-width) 1fr var(--right-sidebar-width);
}

.page-layout.full-width { grid-template-columns: 1fr; }

/* --- Sidebar (Left) --- */
.sidebar {
  position: sticky;
  top: calc(var(--header-height) + var(--space-8));
  max-height: calc(100vh - var(--header-height) - var(--space-16));
  overflow-y: auto;
  padding-right: var(--space-4);
  scrollbar-width: thin;
}

.sidebar-section { margin-bottom: var(--space-6); }

.sidebar-title {
  font-family: var(--font-heading);
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

.sidebar-nav { list-style: none; }
.sidebar-nav li { margin-bottom: 2px; }

.sidebar-nav a {
  display: block;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--border-radius);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  border-left: 2px solid transparent;
}

.sidebar-nav a:hover {
  background: var(--color-bg-secondary);
  color: var(--color-text);
  text-decoration: none;
}

.sidebar-nav a.active {
  background: rgba(79, 70, 229, 0.08);
  color: var(--color-link);
  font-weight: 600;
  border-left-color: var(--color-link);
}

.sidebar-nav .nested { padding-left: var(--space-4); }

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: none;
  border: none;
  border-radius: var(--border-radius);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background var(--transition-fast);
}

.sidebar-toggle:hover { background: var(--color-bg-secondary); }
.sidebar-toggle .chevron { transition: transform var(--transition-fast); width: 14px; height: 14px; }
.sidebar-toggle[aria-expanded="false"] .chevron { transform: rotate(-90deg); }

/* --- Right Sidebar --- */
.right-sidebar {
  position: sticky;
  top: calc(var(--header-height) + var(--space-8));
  max-height: calc(100vh - var(--header-height) - var(--space-16));
  overflow-y: auto;
  padding-left: var(--space-4);
  font-size: var(--font-size-sm);
}

.toc-title {
  font-family: var(--font-heading);
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

.toc-list { list-style: none; border-left: 2px solid var(--color-border-light); }

.toc-list li a {
  display: block;
  padding: var(--space-1) var(--space-3);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  transition: all var(--transition-fast);
  border-left: 2px solid transparent;
  margin-left: -2px;
}

.toc-list li a:hover, .toc-list li a.active {
  color: var(--color-link);
  border-left-color: var(--color-link);
  text-decoration: none;
}

/* --- Main Content --- */
.main-content { min-width: 0; }
.main-content article { max-width: 760px; }

/* --- Breadcrumb --- */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-1);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
}

.breadcrumb a { color: var(--color-text-secondary); }
.breadcrumb a:hover { color: var(--color-link); }
.breadcrumb .separator { color: var(--color-text-muted); margin: 0 var(--space-1); }
.breadcrumb .current { color: var(--color-text); font-weight: 500; }

/* ============================================
   LEARNING COMPONENTS - The soul of the site
   ============================================ */

/* --- TL;DR Box - Most important, must pop --- */
.tldr-box {
  background: var(--color-tldr-bg);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-left: 4px solid var(--color-tldr-border);
  border-radius: 0 var(--border-radius-lg) var(--border-radius-lg) 0;
  padding: var(--space-5) var(--space-6);
  margin-bottom: var(--space-8);
  position: relative;
  overflow: hidden;
}

.tldr-box::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.tldr-box .tldr-label {
  font-family: var(--font-heading);
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-tldr-label);
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.tldr-box .tldr-label::before {
  content: '\26A1';
  font-size: var(--font-size-base);
}

.tldr-box p {
  margin-bottom: 0;
  font-size: var(--font-size-lg);
  line-height: var(--line-height-normal);
  color: var(--color-tldr-text);
  max-width: none;
}

/* --- Explain Like I'm 12 - Warm, inviting --- */
.eli12 {
  margin-bottom: var(--space-8);
  border: 1px solid rgba(251, 146, 60, 0.25);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  background: var(--color-eli12-bg);
}

.eli12 summary {
  padding: var(--space-3) var(--space-5);
  cursor: pointer;
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--color-eli12-accent);
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  transition: all var(--transition-fast);
  user-select: none;
}

.eli12 summary:hover { opacity: 0.8; }
.eli12 summary::-webkit-details-marker { display: none; }

.eli12 summary::before {
  content: '\25B6';
  display: inline-block;
  transition: transform var(--transition-fast);
  font-size: var(--font-size-xs);
}

.eli12[open] summary::before { transform: rotate(90deg); }

.eli12 .eli12-content {
  padding: var(--space-4) var(--space-5);
  font-style: italic;
  color: var(--color-text-secondary);
  line-height: var(--line-height-normal);
  border-top: 1px solid rgba(251, 146, 60, 0.15);
}

/* --- Callout Boxes - Distinct left border + icon --- */
.callout {
  padding: var(--space-4) var(--space-5);
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  border-left: 4px solid;
  margin-bottom: var(--space-5);
  position: relative;
}

.callout .callout-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.callout.info { background: var(--color-info-bg); border-color: var(--color-info-border); color: var(--color-info-text); }
.callout.warning { background: var(--color-warning-bg); border-color: var(--color-warning-border); color: var(--color-warning-text); }
.callout.tip { background: var(--color-tip-bg); border-color: var(--color-tip-border); color: var(--color-tip-text); }
.callout.insight { background: var(--color-insight-bg); border-color: var(--color-insight-border); color: var(--color-insight-text); }

/* Freshness banners */
.banner-deprecated {
  background: var(--color-deprecated-bg);
  border-left: 4px solid var(--color-deprecated-border);
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  color: var(--color-deprecated-text);
  font-weight: 500;
}

.banner-outdated {
  background: var(--color-outdated-bg);
  border-left: 4px solid var(--color-outdated-border);
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  color: var(--color-outdated-text);
  font-weight: 500;
}

/* --- Test Yourself - Engaging, game-like --- */
.test-yourself {
  background: var(--color-test-bg);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--border-radius-xl);
  padding: var(--space-8);
  margin-top: var(--space-10);
  margin-bottom: var(--space-8);
  position: relative;
  overflow: hidden;
}

.test-yourself::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -5%;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.1) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.test-yourself h2 {
  font-size: var(--font-size-xl);
  margin-top: 0;
  margin-bottom: var(--space-5);
  border-bottom: none;
  color: var(--color-test-accent);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.test-yourself h2::before { content: '\1F9E0'; font-size: 1.2em; }

.test-question {
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid rgba(16, 185, 129, 0.15);
}

.test-question:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.test-question p { font-weight: 600; margin-bottom: var(--space-2); max-width: none; }

.test-answer {
  display: none;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border-radius: var(--border-radius);
  margin-top: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border-light);
}

.test-answer.visible { display: block; animation: fadeIn 0.2s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

.reveal-btn {
  background: var(--color-surface);
  border: 1px solid var(--color-test-border);
  border-radius: 100px;
  padding: var(--space-1) var(--space-4);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-test-accent);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all var(--transition-fast);
}

.reveal-btn:hover {
  background: var(--color-test-accent);
  color: #ffffff;
  border-color: var(--color-test-accent);
  transform: translateY(-1px);
}

/* --- Cheat Sheet --- */
.cheat-sheet {
  background: var(--color-cheat-bg);
  border: 1px solid rgba(167, 139, 250, 0.25);
  border-radius: var(--border-radius-xl);
  padding: var(--space-8);
  margin-bottom: var(--space-8);
}

.cheat-sheet h2 {
  font-size: var(--font-size-xl);
  margin-top: 0;
  margin-bottom: var(--space-5);
  border-bottom: none;
  color: var(--color-cheat-accent);
}

.cheat-sheet table { width: 100%; }
.cheat-sheet td, .cheat-sheet th { text-align: left; padding: var(--space-3) var(--space-3); }

.cheat-sheet th {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--color-cheat-accent);
  font-size: var(--font-size-sm);
}

.cheat-sheet td:first-child { font-weight: 600; white-space: nowrap; }

/* --- Cards - Elevated with hover glow --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-8);
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  padding: var(--space-6);
  transition: all var(--transition-normal);
  text-decoration: none;
  color: var(--color-text);
  display: block;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--border-radius-lg);
  opacity: 0;
  transition: opacity var(--transition-normal);
  background: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.06) 0%, transparent 60%);
  pointer-events: none;
}

.card:hover {
  border-color: var(--color-link);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  transform: translateY(-4px);
  text-decoration: none;
  color: var(--color-text);
}

.card:hover::before { opacity: 1; }

.card .card-icon { font-size: 2rem; margin-bottom: var(--space-3); }

.card .card-title {
  font-family: var(--font-heading);
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: var(--space-2);
  letter-spacing: -0.01em;
}

.card .card-description {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-3);
  line-height: var(--line-height-normal);
}

.card .card-meta { font-size: var(--font-size-xs); color: var(--color-text-muted); }

/* Domain card top border - now handled by gradient overlays + accent bars in homepage section */

/* --- Tables --- */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-5);
  font-size: var(--font-size-sm);
  border-radius: var(--border-radius);
  overflow: hidden;
}

th, td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--color-border-light);
}

th {
  font-family: var(--font-heading);
  font-weight: 600;
  background: var(--color-bg-secondary);
  color: var(--color-text);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tr:hover { background: var(--color-bg-secondary); }

/* --- Code Blocks - Always dark for contrast --- */
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

:not(pre) > code {
  background: var(--color-inline-code-bg);
  color: var(--color-inline-code-text);
  padding: 0.15em 0.45em;
  border-radius: 6px;
  font-size: 0.85em;
  font-weight: 500;
}

pre {
  background: var(--color-code-bg);
  border: 1px solid var(--color-code-border);
  border-radius: var(--border-radius);
  padding: var(--space-5);
  overflow-x: auto;
  margin-bottom: var(--space-5);
  line-height: 1.6;
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: var(--font-size-sm);
  color: var(--color-code-text);
  font-weight: 400;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: 100px;
  font-family: var(--font-heading);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  border: none;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
  color: #ffffff;
  text-decoration: none;
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  border-color: var(--color-link);
  color: var(--color-link);
  text-decoration: none;
}

/* --- Navigation (Next/Prev) --- */
.page-nav {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: var(--space-10);
  padding-top: var(--space-8);
  border-top: 2px solid var(--color-border-light);
}

.page-nav a {
  display: flex;
  flex-direction: column;
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  text-decoration: none;
  transition: all var(--transition-fast);
  max-width: 45%;
  background: var(--color-surface);
  color: var(--color-text);
}

.page-nav a.btn-primary {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #ffffff;
  border-color: transparent;
}

.page-nav a:hover {
  border-color: var(--color-link);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  transform: translateY(-2px);
}

.page-nav .nav-label {
  font-family: var(--font-heading);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-1);
}

.page-nav .nav-title { font-weight: 600; color: var(--color-link); }
.page-nav .next { text-align: right; margin-left: auto; }

/* --- Related Topics --- */
.related-topics {
  margin-top: var(--space-10);
  padding-top: var(--space-8);
  border-top: 2px solid var(--color-border-light);
}

.related-topics h2 { font-size: var(--font-size-xl); margin-top: 0; border-bottom: none; }

.related-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  list-style: none;
}

.related-list a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 100px;
  font-size: var(--font-size-sm);
  transition: all var(--transition-fast);
  font-weight: 500;
}

.related-list a:hover {
  border-color: var(--color-link);
  color: var(--color-link);
  text-decoration: none;
  transform: translateY(-1px);
}

/* --- Tags & Difficulty --- */
.tag {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  background: var(--color-bg-tertiary);
  border-radius: 100px;
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  font-weight: 500;
}

.difficulty {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  border-radius: 100px;
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.difficulty.beginner { background: #dcfce7; color: #166534; }
.difficulty.intermediate { background: #fef3c7; color: #92400e; }
.difficulty.advanced { background: #fce7f3; color: #9d174d; }

[data-theme="dark"] .difficulty.beginner { background: rgba(34, 197, 94, 0.15); color: #86efac; }
[data-theme="dark"] .difficulty.intermediate { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }
[data-theme="dark"] .difficulty.advanced { background: rgba(236, 72, 153, 0.15); color: #f9a8d4; }

/* --- Page Meta --- */
.page-meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-5);
}

/* ============================================
   CUSTOM DIAGRAMS - Hand-crafted HTML/CSS
   ============================================ */

/* --- Diagram Container --- */
.diagram-container {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-xl);
  padding: var(--space-8);
  margin-bottom: var(--space-8);
  position: relative;
  overflow: hidden;
}

.diagram-container svg { width: 100%; height: 100%; }

.diagram-container img {
  max-width: 100%;
  height: auto;
  border-radius: var(--border-radius);
  cursor: zoom-in;
}

/* Tap-to-zoom: enlarge diagram for detail on mobile */
.diagram-container.zoomed {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.diagram-container.zoomed img {
  max-width: none;
  width: 150%;
  cursor: zoom-out;
}

/* --- Mind Map (Level 1 - Overview pages) --- */
.mind-map {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: var(--space-4);
  position: relative;
}

.mind-map-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #ffffff;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--font-size-lg);
  text-align: center;
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.35);
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  line-height: var(--line-height-tight);
}

.mind-map-center .mm-icon {
  font-size: 1.8rem;
  margin-bottom: var(--space-1);
}

.mind-map-branches {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  max-width: 500px;
}

.mind-map-node {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text);
  transition: all var(--transition-fast);
  cursor: default;
  position: relative;
}

.mind-map-node::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  width: 12px;
  height: 2px;
  background: var(--color-border);
}

.mind-map-node:hover {
  border-color: var(--color-link);
  box-shadow: var(--shadow-md);
  transform: translateX(4px);
}

.mind-map-node .mm-node-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.mind-map-node .mm-node-label { font-weight: 600; }
.mind-map-node .mm-node-desc { font-size: var(--font-size-xs); color: var(--color-text-muted); }

/* Node color variants */
.mm-node-icon.blue { background: rgba(99, 102, 241, 0.12); color: #6366f1; }
.mm-node-icon.green { background: rgba(16, 185, 129, 0.12); color: #10b981; }
.mm-node-icon.purple { background: rgba(167, 139, 250, 0.12); color: #a78bfa; }
.mm-node-icon.orange { background: rgba(251, 146, 60, 0.12); color: #fb923c; }
.mm-node-icon.pink { background: rgba(236, 72, 153, 0.12); color: #ec4899; }
.mm-node-icon.amber { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }

[data-theme="dark"] .mm-node-icon.blue { background: rgba(99, 102, 241, 0.2); color: #a5b4fc; }
[data-theme="dark"] .mm-node-icon.green { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
[data-theme="dark"] .mm-node-icon.purple { background: rgba(167, 139, 250, 0.2); color: #c4b5fd; }
[data-theme="dark"] .mm-node-icon.orange { background: rgba(251, 146, 60, 0.2); color: #fdba74; }
[data-theme="dark"] .mm-node-icon.pink { background: rgba(236, 72, 153, 0.2); color: #f9a8d4; }
[data-theme="dark"] .mm-node-icon.amber { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }

/* --- Concept Map (Level 2 - Core Concepts pages) --- */
.concept-map {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  padding: var(--space-4) 0;
}

.concept-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-5) var(--space-4);
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  transition: all var(--transition-normal);
  text-decoration: none;
  color: var(--color-text);
  position: relative;
}

.concept-node:hover {
  border-color: var(--color-link);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  transform: translateY(-4px);
  text-decoration: none;
  color: var(--color-text);
}

.concept-node .cn-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: var(--space-3);
}

.concept-node .cn-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--font-size-base);
  margin-bottom: var(--space-1);
}

.concept-node .cn-desc {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  line-height: 1.4;
}

.concept-node .cn-arrow {
  font-size: var(--font-size-xs);
  color: var(--color-link);
  margin-top: var(--space-2);
  font-weight: 600;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.concept-node:hover .cn-arrow { opacity: 1; }

/* Central hub in concept map */
.concept-hub {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4) var(--space-6);
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  border: none;
  border-radius: var(--border-radius-xl);
  color: #ffffff;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--font-size-xl);
  gap: var(--space-3);
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.3);
  margin-bottom: var(--space-2);
}

.concept-hub .cn-icon {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

/* --- Flow Diagram (Level 3 - Deep Dive pages) --- */
.flow-diagram {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: var(--space-4) 0;
}

.flow-step {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  min-width: 280px;
  max-width: 420px;
  width: 100%;
  transition: all var(--transition-fast);
  position: relative;
}

.flow-step:hover {
  border-color: var(--color-link);
  box-shadow: var(--shadow-md);
}

.flow-step .fs-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--font-size-sm);
  flex-shrink: 0;
  color: #ffffff;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

.flow-step .fs-content { flex: 1; }

.flow-step .fs-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--font-size-sm);
  margin-bottom: 2px;
}

.flow-step .fs-desc {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/* Arrow between flow steps */
.flow-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  color: var(--color-link);
  font-size: var(--font-size-lg);
}

.flow-arrow svg {
  width: 20px;
  height: 20px;
  stroke: var(--color-link);
  stroke-width: 2;
  fill: none;
}

/* Flow branch (for split paths) */
.flow-branch {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
}

.flow-branch .flow-step {
  min-width: 180px;
  max-width: 220px;
}

.flow-branch-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-align: center;
  font-weight: 500;
  padding: var(--space-1) var(--space-3);
  background: var(--color-bg-tertiary);
  border-radius: 100px;
  margin: 0 var(--space-2);
  align-self: center;
}

/* --- Sequence Diagram (for hook lifecycle etc.) --- */
.sequence-diagram {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: var(--space-4);
  position: relative;
}

.seq-actors {
  display: flex;
  justify-content: space-around;
  margin-bottom: var(--space-4);
}

.seq-actor {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.seq-actor-box {
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface);
  border: 2px solid var(--color-link);
  border-radius: var(--border-radius);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--font-size-sm);
  text-align: center;
}

.seq-actor-line {
  width: 2px;
  background: var(--color-border);
  flex: 1;
  min-height: 20px;
}

.seq-messages {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4) 0;
}

.seq-message {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
}

.seq-message-arrow {
  flex: 1;
  height: 2px;
  background: var(--color-link);
  position: relative;
}

.seq-message-arrow::after {
  content: '';
  position: absolute;
  right: 0;
  top: -4px;
  border: solid var(--color-link);
  border-width: 0 2px 2px 0;
  padding: 4px;
  transform: rotate(-45deg);
}

.seq-message-arrow.reverse::after {
  right: auto;
  left: 0;
  transform: rotate(135deg);
}

.seq-message-arrow.dashed {
  background: none;
  border-top: 2px dashed var(--color-text-muted);
}

.seq-message-arrow.dashed::after {
  border-color: var(--color-text-muted);
}

.seq-message-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  white-space: nowrap;
  font-weight: 500;
  background: var(--color-bg-secondary);
  padding: var(--space-1) var(--space-2);
  border-radius: 4px;
}

/* --- Horizontal Timeline / Process Steps --- */
.process-steps {
  display: flex;
  align-items: flex-start;
  gap: 0;
  overflow-x: auto;
  padding: var(--space-4) 0;
}

.process-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 130px;
  position: relative;
  padding: 0 var(--space-3);
}

.process-step .ps-dot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-bottom: var(--space-3);
  position: relative;
  z-index: 2;
}

.process-step .ps-label {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--font-size-sm);
  margin-bottom: 2px;
}

.process-step .ps-desc {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/* Connector line between process steps */
.process-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 20px;
  left: calc(50% + 24px);
  width: calc(100% - 48px);
  height: 2px;
  background: linear-gradient(90deg, var(--color-link) 0%, var(--color-border) 100%);
  z-index: 1;
}

/* --- Responsive diagrams --- */
@media (max-width: 768px) {
  .diagram-container {
    padding: var(--space-3);
    margin-left: calc(-1 * var(--space-3));
    margin-right: calc(-1 * var(--space-3));
    border-radius: var(--border-radius);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .diagram-container.zoomed img {
    width: 200%;
  }

  .mind-map {
    flex-direction: column;
  }

  .mind-map-branches {
    grid-template-columns: 1fr;
    max-width: 100%;
  }

  .mind-map-node::before { display: none; }

  .concept-map {
    grid-template-columns: 1fr 1fr;
  }

  .flow-branch {
    flex-direction: column;
    align-items: center;
  }

  .flow-branch .flow-step {
    max-width: 100%;
  }

  .process-steps {
    flex-direction: column;
    align-items: stretch;
  }

  .process-step {
    flex-direction: row;
    text-align: left;
    gap: var(--space-3);
    min-width: auto;
  }

  .process-step:not(:last-child)::after {
    top: auto;
    left: 20px;
    width: 2px;
    height: calc(100% + var(--space-3));
    background: linear-gradient(180deg, var(--color-link) 0%, var(--color-border) 100%);
  }
}

/* ============================================
   INTERACTIVE INFOGRAPHIC
   Clickable architecture diagram for overview pages
   ============================================ */

.infographic {
  padding: var(--space-6) var(--space-4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  position: relative;
}

/* --- Connector lines (vertical spine) --- */
.ig-connector {
  width: 2px;
  height: 28px;
  background: var(--color-border);
  position: relative;
}

.ig-connector::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-link);
}

.ig-connector.dashed {
  background: none;
  border-left: 2px dashed var(--color-border);
}

.ig-connector.long { height: 36px; }

/* Animated pulse on connectors */
.ig-connector::before {
  content: '';
  position: absolute;
  top: 0;
  left: -2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-link);
  opacity: 0.6;
  animation: ig-pulse 2.5s ease-in-out infinite;
}

@keyframes ig-pulse {
  0%, 100% { top: 0; opacity: 0.6; }
  50% { top: calc(100% - 6px); opacity: 0.2; }
}

/* --- Nodes --- */
.ig-node {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  text-decoration: none;
  color: var(--color-text);
  transition: all var(--transition-normal);
  position: relative;
  min-width: 280px;
  max-width: 380px;
  width: 100%;
}

.ig-node:hover {
  text-decoration: none;
  color: var(--color-text);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

a.ig-node:hover {
  border-color: var(--color-link);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

a.ig-node .ig-node-cta {
  opacity: 0;
  transition: opacity var(--transition-fast);
  font-size: var(--font-size-xs);
  color: var(--color-link);
  font-weight: 600;
  position: absolute;
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
}

a.ig-node:hover .ig-node-cta { opacity: 1; }

.ig-node-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.ig-node-text { flex: 1; min-width: 0; }

.ig-node-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--font-size-base);
  line-height: 1.3;
}

.ig-node-desc {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  line-height: 1.4;
  margin-top: 2px;
}

/* --- Central Hub Node --- */
.ig-node.hub {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  border: none;
  color: #ffffff;
  padding: var(--space-5) var(--space-6);
  min-width: 320px;
  box-shadow: 0 8px 30px rgba(79, 70, 229, 0.35);
}

.ig-node.hub .ig-node-title { color: #ffffff; font-size: var(--font-size-lg); }
.ig-node.hub .ig-node-desc { color: rgba(255, 255, 255, 0.75); }
.ig-node.hub .ig-node-icon { background: rgba(255, 255, 255, 0.2); font-size: 1.5rem; width: 52px; height: 52px; border-radius: 50%; }

.ig-node.hub:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(79, 70, 229, 0.45);
}

a.ig-node.hub .ig-node-cta { color: rgba(255, 255, 255, 0.8); }

/* --- Static context node (non-clickable) --- */
.ig-node.static {
  border-style: dashed;
  opacity: 0.8;
}

.ig-node.static:hover {
  transform: none;
  box-shadow: none;
}

/* --- Branch Row (horizontal spread) --- */
.ig-branch {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
  position: relative;
  width: 100%;
  max-width: 760px;
}

/* Horizontal connector above branch items */
.ig-branch::before {
  content: '';
  position: absolute;
  top: -14px;
  left: 10%;
  right: 10%;
  height: 2px;
  background: var(--color-border);
}

.ig-branch .ig-node {
  min-width: 0;
  width: calc(33.33% - var(--space-3));
  min-width: 160px;
  flex-direction: column;
  text-align: center;
  padding: var(--space-4) var(--space-3);
  gap: var(--space-2);
}

.ig-branch .ig-node-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 1.4rem;
}

.ig-branch .ig-node-title { font-size: var(--font-size-sm); }
.ig-branch .ig-node-desc { font-size: 0.7rem; }

.ig-branch a.ig-node .ig-node-cta {
  position: static;
  transform: none;
  margin-top: var(--space-1);
}

/* Vertical connector stub from horizontal line to each branch node */
.ig-branch .ig-node::before {
  content: '';
  position: absolute;
  top: -14px;
  left: 50%;
  width: 2px;
  height: 14px;
  background: var(--color-border);
}

/* --- Branch label --- */
.ig-label {
  font-family: var(--font-heading);
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  padding: var(--space-1) var(--space-3);
  background: var(--color-bg-secondary);
  border-radius: 100px;
  margin: var(--space-2) 0;
}

/* --- Contained box for grouped items --- */
.ig-box {
  border: 2px dashed var(--color-border);
  border-radius: var(--border-radius-xl);
  padding: var(--space-8);
  padding-top: var(--space-10);
  position: relative;
  width: 100%;
  max-width: 560px;
  background: var(--color-bg-secondary);
}

.ig-box-label {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-heading);
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  background: var(--color-bg-secondary);
  padding: var(--space-1) var(--space-4);
  border-radius: 100px;
  border: 2px dashed var(--color-border);
  white-space: nowrap;
}

.ig-box-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-4);
}

/* --- Compact chip node --- */
.ig-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  text-decoration: none;
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.ig-chip:hover {
  border-color: var(--color-link);
  color: var(--color-link);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
}

.ig-chip-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.ig-chip-text {
  font-family: var(--font-heading);
  letter-spacing: -0.01em;
}

/* --- Direction arrows on connectors --- */
.ig-connector.down::after {
  bottom: -6px;
  left: -4px;
  width: 0;
  height: 0;
  border-radius: 0;
  background: none;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--color-link);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .ig-branch {
    flex-direction: column;
    align-items: center;
  }

  .ig-branch::before { display: none; }
  .ig-branch .ig-node::before { display: none; }

  .ig-branch .ig-node {
    width: 100%;
    max-width: 320px;
    flex-direction: row;
    text-align: left;
    gap: var(--space-3);
  }

  .ig-branch .ig-node-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius);
  }

  .ig-branch a.ig-node .ig-node-cta {
    position: absolute;
    right: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
  }

  .ig-node { min-width: 0; max-width: 100%; }
  .ig-node.hub { min-width: 0; }
}

/* --- CLS Prevention: JS-Injected Elements --- */
#header-placeholder { min-height: 64px; }
#footer-placeholder { min-height: 200px; }

/* --- Ad Slots (AdSense-Ready, CLS-Safe) --- */
.ad-banner {
  text-align: center;
  margin: var(--space-6) 0;
  min-height: 112px; /* 90px ad + 22px label */
  display: none;
}

.ad-banner.ads-active { display: block; }

.ad-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
  opacity: 0.6;
}

.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  border: 1px dashed var(--color-border-light);
  border-radius: var(--border-radius);
}

.ad-h {
  max-width: 728px;
  height: 90px;
  margin: 0 auto;
}

.ad-rect {
  width: 300px;
  height: 250px;
  max-width: 100%;
}

/* Legacy ad-slot support */
.ad-slot.active { display: block; }

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: var(--space-12) var(--space-5) var(--space-6);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  margin-top: var(--space-10);
  background: var(--color-bg-secondary);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-10);
  max-width: var(--max-width);
  margin: 0 auto;
  padding-bottom: var(--space-8);
}

.footer-brand .footer-logo {
  font-family: var(--font-heading);
  font-size: var(--font-size-lg);
  font-weight: 700;
  background: linear-gradient(135deg, var(--color-link) 0%, #7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  display: inline-block;
  margin-bottom: var(--space-3);
}

.footer-brand p {
  color: var(--color-text-muted);
  line-height: var(--line-height-normal);
  max-width: 300px;
}

.footer-heading {
  font-family: var(--font-heading);
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-4);
}

.footer-link-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-link-list li { margin-bottom: var(--space-2); }

.footer-link-list a {
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
  font-size: var(--font-size-sm);
}

.footer-link-list a:hover { color: var(--color-link); }

.footer-bottom {
  border-top: 1px solid var(--color-border);
  max-width: var(--max-width);
  margin: 0 auto;
  padding-top: var(--space-5);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  opacity: 0.7;
}

.footer-bottom a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.footer-bottom a:hover { color: var(--color-link); }

/* Legacy footer support */
.site-footer .footer-links { margin-top: var(--space-3); }
.site-footer .footer-links a { margin: 0 var(--space-2); color: var(--color-text-secondary); }
.site-footer .footer-copyright { margin-top: var(--space-3); opacity: 0.6; font-size: var(--font-size-xs); }

/* ============================================
   HOME PAGE - Hero & Sections
   ============================================ */

/* Hero Wrapper - Full bleed with dot grid + gradient orbs */
.hero-wrapper {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 1px 1px, rgba(99, 102, 241, 0.12) 1px, transparent 0) 0 0 / 28px 28px;
}

.hero-wrapper::before,
.hero-wrapper::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

/* Indigo orb - top left */
.hero-wrapper::before {
  width: 600px;
  height: 600px;
  top: -200px;
  left: -150px;
  background: radial-gradient(circle, rgba(79, 70, 229, 0.15) 0%, rgba(79, 70, 229, 0.05) 40%, transparent 70%);
}

/* Purple orb - bottom right */
.hero-wrapper::after {
  width: 500px;
  height: 500px;
  bottom: -150px;
  right: -100px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.12) 0%, rgba(167, 139, 250, 0.04) 40%, transparent 70%);
}

[data-theme="dark"] .hero-wrapper {
  background:
    radial-gradient(circle at 1px 1px, rgba(129, 140, 248, 0.08) 1px, transparent 0) 0 0 / 28px 28px;
}

[data-theme="dark"] .hero-wrapper::before {
  background: radial-gradient(circle, rgba(79, 70, 229, 0.2) 0%, rgba(79, 70, 229, 0.06) 40%, transparent 70%);
}

[data-theme="dark"] .hero-wrapper::after {
  background: radial-gradient(circle, rgba(124, 58, 237, 0.15) 0%, rgba(167, 139, 250, 0.05) 40%, transparent 70%);
}

.hero {
  text-align: center;
  padding: var(--space-20) var(--space-5) var(--space-16);
  max-width: 860px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* Hero Badge Pill */
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: 100px;
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-secondary);
  background: var(--color-surface);
  margin-bottom: var(--space-6);
  letter-spacing: 0.01em;
}

.hero-badge .badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  flex-shrink: 0;
}

.hero h1 {
  font-size: clamp(2.5rem, 5vw + 1rem, 4.5rem);
  font-weight: 800;
  margin-bottom: var(--space-5);
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 30%, #7c3aed 60%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.04em;
  line-height: 1.08;
}

[data-theme="dark"] .hero h1 {
  background: linear-gradient(135deg, #818cf8 0%, #a5b4fc 30%, #c4b5fd 60%, #e0e7ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.hero .subtitle {
  font-size: var(--font-size-xl);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-10);
  line-height: var(--line-height-normal);
  max-width: 620px;
  margin-left: auto;
  margin-right: auto;
}

.hero-search {
  max-width: 520px;
  margin: 0 auto var(--space-8);
  position: relative;
}

.hero-search input {
  width: 100%;
  padding: var(--space-4) var(--space-6);
  padding-right: 3.5rem;
  border: 2px solid var(--color-border);
  border-radius: 100px;
  font-size: var(--font-size-lg);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font-sans);
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-md);
}

.hero-search input:focus {
  outline: none;
  border-color: var(--color-link);
  box-shadow: var(--shadow-lg), 0 0 0 4px rgba(79, 70, 229, 0.1);
}

/* Keyboard shortcut badge inside search */
.hero-search .search-kbd {
  position: absolute;
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 2px 8px;
  pointer-events: none;
  line-height: 1.4;
}

/* Dual CTA buttons */
.hero-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  margin-bottom: var(--space-10);
  flex-wrap: wrap;
}

/* Stats bar */
.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border-light);
}

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

.hero-stat .stat-number {
  font-family: var(--font-heading);
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--color-text);
  display: block;
  line-height: 1.2;
}

.hero-stat .stat-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

/* Sections */
.section {
  padding: var(--space-16) var(--space-5);
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-band {
  background: var(--color-bg-secondary);
  max-width: none;
  padding-left: var(--space-5);
  padding-right: var(--space-5);
}

.section-band > * {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
}

.section-title {
  font-family: var(--font-heading);
  text-align: center;
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-3);
  letter-spacing: -0.02em;
  position: relative;
  padding-bottom: var(--space-4);
}

/* Gradient underline accent on section titles */
.section-title::after {
  content: '';
  display: block;
  width: 48px;
  height: 3px;
  background: linear-gradient(90deg, #4f46e5 0%, #7c3aed 100%);
  border-radius: 2px;
  margin: var(--space-3) auto 0;
}

.section-subtitle {
  text-align: center;
  color: var(--color-text-secondary);
  font-size: var(--font-size-base);
  margin-bottom: var(--space-10);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Gradient section divider */
.section-divider {
  height: 1px;
  max-width: var(--max-width);
  margin: 0 auto;
  background: linear-gradient(90deg, transparent 0%, var(--color-border) 20%, var(--color-link) 50%, var(--color-border) 80%, transparent 100%);
  opacity: 0.4;
}

/* Steps Grid with connecting line */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
  position: relative;
}

/* Connecting line between step circles (desktop only) */
.steps-grid::before {
  content: '';
  position: absolute;
  top: 56px;
  left: calc(16.67% + 32px);
  right: calc(16.67% + 32px);
  height: 2px;
  background: linear-gradient(90deg, #4f46e5, #7c3aed, #a78bfa);
  opacity: 0.3;
  z-index: 0;
}

.step-card {
  text-align: center;
  padding: var(--space-8) var(--space-5);
  border-radius: var(--border-radius-xl);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  transition: all var(--transition-normal);
  position: relative;
  z-index: 1;
}

.step-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.step-card .step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #ffffff;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-5);
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.35);
  position: relative;
}

.step-card h3 {
  font-family: var(--font-heading);
  margin-top: 0;
  margin-bottom: var(--space-3);
}

.step-card p {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  max-width: none;
  margin-bottom: var(--space-4);
}

/* Feature pills inside step cards */
.step-features {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: center;
}

.step-feature {
  display: inline-block;
  padding: 2px var(--space-3);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-light);
  border-radius: 100px;
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  font-weight: 500;
}

[data-theme="dark"] .step-feature {
  background: var(--color-bg-tertiary);
}

/* Facts Grid */
.facts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-5);
}

.fact-card {
  padding: var(--space-6) var(--space-6) var(--space-6) var(--space-8);
  background: var(--color-surface);
  border-radius: var(--border-radius-xl);
  border: 1px solid var(--color-border);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

/* Unique colored left borders per fact card */
.fact-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
}

.fact-card:nth-child(1)::before { background: linear-gradient(180deg, #4f46e5, #6366f1); }
.fact-card:nth-child(2)::before { background: linear-gradient(180deg, #7c3aed, #a78bfa); }
.fact-card:nth-child(3)::before { background: linear-gradient(180deg, #059669, #34d399); }
.fact-card:nth-child(4)::before { background: linear-gradient(180deg, #d97706, #fbbf24); }

.fact-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.fact-icon {
  font-size: 1.75rem;
  margin-bottom: var(--space-2);
  display: block;
  line-height: 1;
}

.fact-card .fact-stat {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 3vw, 3rem);
  font-weight: 800;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-2);
  line-height: 1.1;
}

/* Individual stat gradients matching border color */
.fact-card:nth-child(1) .fact-stat { background: linear-gradient(135deg, #4f46e5 0%, #818cf8 100%); -webkit-background-clip: text; background-clip: text; }
.fact-card:nth-child(2) .fact-stat { background: linear-gradient(135deg, #7c3aed 0%, #c4b5fd 100%); -webkit-background-clip: text; background-clip: text; }
.fact-card:nth-child(3) .fact-stat { background: linear-gradient(135deg, #059669 0%, #6ee7b7 100%); -webkit-background-clip: text; background-clip: text; }
.fact-card:nth-child(4) .fact-stat { background: linear-gradient(135deg, #d97706 0%, #fcd34d 100%); -webkit-background-clip: text; background-clip: text; }

.fact-card p {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: 0;
  max-width: none;
}

/* Domain card gradient overlays (replace top border) */
.card[data-domain] { border-top: none; }
.card[data-domain]::before {
  background: none;
}

.card[data-domain]::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--border-radius-lg);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-normal);
  z-index: 0;
}

.card[data-domain]:hover::after { opacity: 1; }

.card[data-domain="developer-tools"]::before { background: radial-gradient(ellipse at 0% 0%, rgba(139, 92, 246, 0.1) 0%, transparent 60%); opacity: 1; }
.card[data-domain="databases"]::before { background: radial-gradient(ellipse at 0% 0%, rgba(16, 185, 129, 0.1) 0%, transparent 60%); opacity: 1; }
.card[data-domain="data-analytics"]::before { background: radial-gradient(ellipse at 0% 0%, rgba(245, 158, 11, 0.08) 0%, transparent 60%); opacity: 1; }
.card[data-domain="healthcare"]::before { background: radial-gradient(ellipse at 0% 0%, rgba(220, 38, 38, 0.08) 0%, transparent 60%); opacity: 1; }
.card[data-domain="programming"]::before { background: radial-gradient(ellipse at 0% 0%, rgba(37, 99, 235, 0.1) 0%, transparent 60%); opacity: 1; }
.card[data-domain="learning"]::before { background: radial-gradient(ellipse at 0% 0%, rgba(139, 92, 246, 0.1) 0%, transparent 60%); opacity: 1; }

/* Domain card colored accent bar */
.card[data-domain] .card-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.card[data-domain="developer-tools"] .card-accent { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.card[data-domain="databases"] .card-accent { background: linear-gradient(90deg, #10b981, #6ee7b7); }
.card[data-domain="data-analytics"] .card-accent { background: linear-gradient(90deg, #f59e0b, #fcd34d); }
.card[data-domain="healthcare"] .card-accent { background: linear-gradient(90deg, #dc2626, #f87171); }
.card[data-domain="programming"] .card-accent { background: linear-gradient(90deg, #2563eb, #60a5fa); }
.card[data-domain="learning"] .card-accent { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }

/* Topic pills inside domain cards */
.card-topics {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: var(--space-3);
  position: relative;
  z-index: 1;
}

.card-topic {
  display: inline-block;
  padding: 1px var(--space-2);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-light);
  border-radius: 100px;
  font-size: 0.7rem;
  color: var(--color-text-muted);
  font-weight: 500;
  white-space: nowrap;
}

[data-theme="dark"] .card-topic {
  background: var(--color-bg-tertiary);
}

/* Card meta with arrow */
.card-meta-arrow {
  display: inline-block;
  transition: transform var(--transition-fast);
  margin-left: var(--space-1);
}

.card:hover .card-meta-arrow {
  transform: translateX(4px);
}

/* Homepage card grid larger */
#domain-cards.card-grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-6);
}

/* Section footnote box */
.section-footnote {
  text-align: center;
  color: var(--color-text-secondary);
  margin-top: var(--space-6);
  font-size: var(--font-size-sm);
  padding: var(--space-4) var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--border-radius);
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
  .page-layout.with-right-sidebar { grid-template-columns: var(--sidebar-width) 1fr; }
  .right-sidebar { display: none; }

  .domain-tabs { display: none; }
  .header-links { display: none; }
  .menu-toggle { display: flex; }
}

@media (max-width: 768px) {
  .hero { padding: var(--space-12) var(--space-4) var(--space-10); }
  .hero h1 { font-size: clamp(2rem, 6vw, 2.5rem); }
  .hero .subtitle { font-size: var(--font-size-base); }
  .hero-badge { font-size: 0.7rem; }
  .hero-cta { flex-direction: column; gap: var(--space-3); }
  .hero-cta .btn { width: 100%; justify-content: center; }
  .hero-stats { gap: var(--space-5); flex-wrap: wrap; }
  .hero-stat .stat-number { font-size: var(--font-size-xl); }
  .hero-search .search-kbd { display: none; }
  .steps-grid::before { display: none; }

  .header-inner { padding: 0 var(--space-3); }
  .header-search input { width: 140px; }
  .header-search input:focus { width: 180px; }

  .page-layout, .page-layout.with-right-sidebar {
    grid-template-columns: 1fr;
    padding: var(--space-5) var(--space-4);
    gap: 0;
  }

  .sidebar {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 280px;
    height: calc(100vh - var(--header-height));
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    padding: var(--space-4);
    z-index: 90;
    box-shadow: var(--shadow-lg);
    max-height: none;
  }

  .sidebar.open { display: block; }
  .right-sidebar { display: none; }
  .steps-grid { grid-template-columns: 1fr; }
  .facts-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; text-align: center; gap: var(--space-6); }
  .footer-brand p { max-width: none; margin: 0 auto; }
  .footer-bottom { flex-direction: column; gap: var(--space-2); text-align: center; }
  #domain-cards.card-grid { grid-template-columns: 1fr; }
  .page-nav { flex-direction: column; }
  .page-nav a { max-width: 100%; }
  .card-grid { grid-template-columns: 1fr; }
  h1 { font-size: var(--font-size-2xl); }
  h2 { font-size: var(--font-size-xl); }
  .tldr-box p { font-size: var(--font-size-base); }
  .tldr-box, .test-yourself, .cheat-sheet { padding: var(--space-5); }
  .test-yourself { border-radius: var(--border-radius-lg); }
}

/* --- Skip Link (Accessibility) --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--color-link);
  color: #fff;
  border-radius: var(--border-radius);
  z-index: 10001;
  text-decoration: none;
  font-weight: 600;
  font-family: var(--font-sans);
}
.skip-link:focus {
  top: 1rem;
}

/* --- "How It Works" Box (GEO Optimization) --- */
.hiw-box {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-light);
  border-radius: var(--border-radius-lg);
  padding: var(--space-6);
  margin: var(--space-6) 0;
}
.hiw-box h2 {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin-bottom: var(--space-3);
  font-family: var(--font-heading);
}
.hiw-box ol {
  padding-left: var(--space-5);
}
.hiw-box ol li {
  font-size: var(--font-size-sm);
  padding: var(--space-1) 0;
  color: var(--color-text-secondary);
}
.hiw-snippet {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  font-style: italic;
  margin-top: var(--space-3);
  line-height: 1.6;
}

/* --- Cookie Consent Banner --- */
.consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.consent-banner.show {
  transform: translateY(0);
}
.consent-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  background: var(--color-surface);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.1);
}
.consent-inner p {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin: 0;
}
.consent-inner a {
  color: var(--color-link);
  text-decoration: underline;
}
.consent-actions {
  display: flex;
  gap: 0.75rem;
  flex-shrink: 0;
}
.consent-actions button {
  padding: 0.5rem 1.25rem;
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.consent-actions button:hover {
  background: var(--color-bg-secondary);
}
.consent-actions .consent-accept {
  background: var(--color-link);
  color: #fff;
  border-color: var(--color-link);
}
.consent-actions .consent-accept:hover {
  background: var(--color-link-hover);
  border-color: var(--color-link-hover);
}
@media (max-width: 600px) {
  .consent-inner {
    flex-direction: column;
    text-align: center;
  }
}

/* --- Data Table Mobile Scroll --- */
.data-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1rem 0;
}

/* --- Focus States (Accessibility) --- */
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--color-link);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- Grid Entrance Animations (IntersectionObserver) --- */
.card, .fact-card, .step-card {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.card.visible, .fact-card.visible, .step-card.visible {
  opacity: 1;
  transform: translateY(0);
}
.card-grid .card:nth-child(2), .facts-grid .fact-card:nth-child(2) { transition-delay: 0.1s; }
.card-grid .card:nth-child(3), .facts-grid .fact-card:nth-child(3) { transition-delay: 0.15s; }
.card-grid .card:nth-child(4), .facts-grid .fact-card:nth-child(4) { transition-delay: 0.2s; }
.card-grid .card:nth-child(5) { transition-delay: 0.25s; }
.card-grid .card:nth-child(6) { transition-delay: 0.3s; }

/* Disable entrance animations if reduced motion preferred */
@media (prefers-reduced-motion: reduce) {
  .card, .fact-card, .step-card {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* --- Micro-Accessibility --- */
button, .btn { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
input, select, textarea { font-size: max(16px, 1rem); }

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Print --- */
@media print {
  .site-header, .sidebar, .right-sidebar, .ad-slot, .ad-banner, .theme-toggle, .consent-banner,
  .page-nav, .test-yourself .reveal-btn { display: none !important; }
  .page-layout { grid-template-columns: 1fr !important; }
  .test-answer { display: block !important; }
  body { color: #000; background: #fff; }
}
