/* MathViz Documentation - Tokyo Night Dark Theme */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ============================================
   CSS Variables - Tokyo Night Color Palette
   ============================================ */
:root {
  /* Background colors */
  --bg-primary: #1a1b26;
  --bg-secondary: #16161e;
  --bg-elevated: #1f2335;
  --bg-hover: #292e42;
  --bg-active: #33467c;
  --bg-highlight: #3b4261;

  /* Surface colors */
  --surface-1: #24283b;
  --surface-2: #1f2335;
  --surface-3: #414868;

  /* Text colors */
  --text-primary: #c0caf5;
  --text-secondary: #a9b1d6;
  --text-muted: #565f89;
  --text-bright: #ffffff;

  /* Accent colors - Tokyo Night */
  --accent-blue: #7aa2f7;
  --accent-cyan: #7dcfff;
  --accent-green: #9ece6a;
  --accent-magenta: #bb9af7;
  --accent-orange: #ff9e64;
  --accent-red: #f7768e;
  --accent-yellow: #e0af68;
  --accent-teal: #73daca;

  /* Primary accent */
  --accent-primary: #7aa2f7;
  --accent-primary-hover: #89b4fa;
  --accent-primary-dim: rgba(122, 162, 247, 0.15);

  /* Border colors */
  --border-default: #3b4261;
  --border-subtle: #292e42;
  --border-bright: #565f89;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(122, 162, 247, 0.15);

  /* Code block syntax highlighting */
  --syntax-keyword: #bb9af7;
  --syntax-function: #7aa2f7;
  --syntax-string: #9ece6a;
  --syntax-number: #ff9e64;
  --syntax-comment: #565f89;
  --syntax-operator: #89ddff;
  --syntax-type: #7dcfff;
  --syntax-variable: #c0caf5;
  --syntax-constant: #ff9e64;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Sidebar */
  --sidebar-width: 280px;

  /* Z-index layers */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal: 300;
  --z-tooltip: 400;
}

/* ============================================
   Base Styles
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-md);
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-bright);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
  margin: 0 0 var(--space-md);
}

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

a:hover {
  color: var(--accent-cyan);
}

code, pre, kbd {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

code {
  padding: 0.2em 0.4em;
  background: var(--surface-1);
  border-radius: var(--radius-sm);
  font-size: 0.9em;
  color: var(--accent-cyan);
}

pre {
  margin: 0;
  padding: 0;
  background: transparent;
  overflow-x: auto;
}

pre code {
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: 0.875rem;
}

/* Selection */
::selection {
  background: var(--accent-primary-dim);
  color: var(--text-bright);
}

/* ============================================
   Layout
   ============================================ */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

/* Grid */
.grid {
  display: grid;
  gap: var(--space-lg);
}

.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .grid-cols-3, .grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .grid-cols-2, .grid-cols-3, .grid-cols-4 {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   Navigation Header
   ============================================ */
.nav-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: rgba(26, 27, 38, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 var(--space-xl);
  max-width: 1400px;
  margin: 0 auto;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-bright);
  flex-shrink: 0;
}

.nav-brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-magenta), var(--accent-blue));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.nav-link {
  padding: var(--space-sm) var(--space-md);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9375rem;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.nav-link:hover {
  color: var(--text-bright);
  background: var(--bg-hover);
}

.nav-link.active {
  color: var(--accent-blue);
  background: var(--accent-primary-dim);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.nav-search {
  position: relative;
}

.nav-search-input {
  width: 240px;
  padding: var(--space-sm) var(--space-md);
  padding-left: 36px;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: all var(--transition-fast);
}

.nav-search-input::placeholder { color: var(--text-muted); }

.nav-search-input:focus {
  outline: none;
  border-color: var(--accent-blue);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-glow);
}

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

.nav-search-kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  padding: 2px 6px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: inherit;
}

/* Mobile menu toggle */
.nav-mobile-toggle {
  display: none;
  padding: var(--space-sm);
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}

/* ============================================
   Mobile Navigation Overlay
   ============================================ */
.nav-mobile-menu {
  display: none;
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  z-index: calc(var(--z-modal) + 10);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-default);
  box-shadow: var(--shadow-xl);
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-mobile-menu.open {
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: slideDown 0.2s ease;
}

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

.nav-mobile-menu .nav-link {
  display: flex;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  font-size: 1rem;
  border-radius: var(--radius-md);
  min-height: 48px;
  color: var(--text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast);
}

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

.nav-mobile-menu .nav-link.active {
  color: var(--accent-blue);
  background: var(--accent-primary-dim);
}

.nav-mobile-menu .nav-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-xs) 0;
}

@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-search { display: none; }
  .nav-actions .btn { display: none; }
  .nav-mobile-toggle { display: flex; }
}

/* ============================================
   Mobile Sidebar Overlay (for tutorial pages)
   ============================================ */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  top: 64px;
  background: rgba(0, 0, 0, 0.6);
  z-index: calc(var(--z-modal) - 1);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.sidebar-backdrop.visible {
  display: block;
  animation: fadeIn 0.2s ease;
}

.sidebar-close-btn {
  display: none;
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  width: 36px;
  height: 36px;
  background: var(--bg-hover);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background var(--transition-fast);
}

.sidebar-close-btn:hover {
  background: var(--surface-3);
}

/* Floating button to open sidebar on mobile */
.sidebar-fab {
  display: none;
  position: fixed;
  bottom: var(--space-lg);
  left: var(--space-lg);
  z-index: var(--z-sticky);
  width: 52px;
  height: 52px;
  background: var(--accent-magenta);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: all var(--transition-fast);
}

.sidebar-fab:hover {
  transform: scale(1.05);
}

.sidebar-fab:active {
  transform: scale(0.95);
}

@media (max-width: 900px) {
  .sidebar-fab {
    display: flex;
  }

  .sidebar-close-btn {
    display: flex;
  }
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  min-height: 44px;
}

.btn-primary {
  background: var(--accent-blue);
  color: var(--bg-primary);
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
  color: var(--bg-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--text-bright);
  border-color: var(--border-bright);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-bright);
}

.btn-sm {
  padding: var(--space-xs) var(--space-sm);
  font-size: 0.8125rem;
  min-height: 36px;
}

.btn-lg {
  padding: var(--space-md) var(--space-xl);
  font-size: 1rem;
}

.btn-icon { padding: var(--space-sm); }

/* ============================================
   Hero Section
   ============================================ */
.hero {
  position: relative;
  padding: var(--space-3xl) 0;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(122, 162, 247, 0.15), transparent),
    radial-gradient(ellipse 60% 40% at 80% 50%, rgba(187, 154, 247, 0.1), transparent);
  pointer-events: none;
}

.hero-content {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3xl);
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

.hero-text { max-width: 600px; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-md);
  background: var(--accent-primary-dim);
  border: 1px solid rgba(122, 162, 247, 0.3);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent-blue);
  margin-bottom: var(--space-lg);
}

.hero-title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: var(--space-lg);
  background: linear-gradient(135deg, var(--text-bright) 0%, var(--accent-blue) 50%, var(--accent-magenta) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-description {
  font-size: 1.25rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-xl);
}

.hero-actions {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.hero-stats {
  display: flex;
  gap: var(--space-xl);
  margin-top: var(--space-xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border-subtle);
}

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

.hero-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-bright);
}

.hero-stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Hero Code Card */
.hero-code { position: relative; }

.code-window {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
}

.code-window-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-subtle);
}

.code-window-dots { display: flex; gap: var(--space-sm); }

.code-window-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--surface-3);
}

.code-window-dot.red { background: #f7768e; }
.code-window-dot.yellow { background: #e0af68; }
.code-window-dot.green { background: #9ece6a; }

.code-window-title {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.code-window-actions { display: flex; gap: var(--space-xs); }

.code-window-body {
  padding: var(--space-lg);
  max-height: 400px;
  overflow-y: auto;
}

/* ============================================
   Code Blocks with Syntax Highlighting
   ============================================ */
.code-block {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: var(--space-md) 0;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-subtle);
}

.code-block-lang {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.code-block-body {
  padding: var(--space-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.copy-btn:hover {
  background: var(--surface-3);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.copy-btn.copied {
  background: rgba(158, 206, 106, 0.2);
  border-color: var(--accent-green);
  color: var(--accent-green);
}

/* Prism.js Syntax Highlighting - Tokyo Night Theme */
.token.comment, .token.prolog, .token.doctype, .token.cdata {
  color: #565f89;
  font-style: italic;
}

.token.punctuation { color: #9aa5ce; }

.token.property, .token.tag, .token.boolean, .token.number,
.token.constant, .token.symbol { color: #ff9e64; }

.token.selector, .token.attr-name, .token.string, .token.char { color: #9ece6a; }

.token.operator, .token.entity, .token.url { color: #89ddff; }

.token.atrule, .token.attr-value, .token.keyword { color: #bb9af7; }

.token.function { color: #7aa2f7; }
.token.class-name { color: #7dcfff; }
.token.regex, .token.important, .token.variable { color: #c0caf5; }

/* MathViz specific tokens */
.token.builtin { color: #73daca; }
.token.decorator, .token.annotation { color: #e0af68; }

/* Override Prism theme for Tokyo Night */
code[class*="language-"],
pre[class*="language-"] {
  color: var(--text-primary);
  background: var(--bg-secondary);
  text-shadow: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  tab-size: 2;
}

pre[class*="language-"] {
  padding: 1.25rem;
  margin: 0;
  overflow: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

:not(pre) > code[class*="language-"] {
  padding: 0.2em 0.4em;
  border-radius: var(--radius-sm);
  white-space: normal;
}

/* Custom MathViz syntax classes */
.mv-keyword { color: var(--syntax-keyword); font-weight: 500; }
.mv-function { color: var(--syntax-function); }
.mv-string { color: var(--syntax-string); }
.mv-number { color: var(--syntax-number); }
.mv-comment { color: var(--syntax-comment); font-style: italic; }
.mv-type { color: var(--syntax-type); }
.mv-operator { color: var(--syntax-operator); }
.mv-variable { color: var(--syntax-variable); }
.mv-constant { color: var(--syntax-constant); }

/* ============================================
   Features Section
   ============================================ */
.section {
  padding: var(--space-3xl) 0;
}

.section-header {
  text-align: center;
  max-width: 700px;
  margin: 0 auto var(--space-2xl);
}

.section-badge {
  display: inline-block;
  padding: var(--space-xs) var(--space-md);
  background: var(--accent-primary-dim);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent-blue);
  margin-bottom: var(--space-md);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section-title {
  font-size: 2.5rem;
  margin-bottom: var(--space-md);
}

.section-description {
  font-size: 1.125rem;
  color: var(--text-secondary);
}

/* Feature Cards */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

.feature-card {
  position: relative;
  padding: var(--space-xl);
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: all var(--transition-normal);
}

.feature-card:hover {
  border-color: var(--border-default);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-magenta));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

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

.feature-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-primary-dim);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  font-size: 1.5rem;
}

.feature-icon.green { background: rgba(158, 206, 106, 0.15); color: var(--accent-green); }
.feature-icon.magenta { background: rgba(187, 154, 247, 0.15); color: var(--accent-magenta); }
.feature-icon.orange { background: rgba(255, 158, 100, 0.15); color: var(--accent-orange); }
.feature-icon.cyan { background: rgba(125, 207, 255, 0.15); color: var(--accent-cyan); }
.feature-icon.yellow { background: rgba(224, 175, 104, 0.15); color: var(--accent-yellow); }
.feature-icon.red { background: rgba(247, 118, 142, 0.15); color: var(--accent-red); }

.feature-title { font-size: 1.125rem; margin-bottom: var(--space-sm); }

.feature-description {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-bottom: var(--space-md);
}

.feature-code {
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  color: var(--accent-cyan);
}

/* ============================================
   Install Section
   ============================================ */
.install-section {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.install-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3xl);
  align-items: start;
}

.install-info h2 { margin-bottom: var(--space-md); }
.install-info p { color: var(--text-secondary); margin-bottom: var(--space-lg); }

.install-methods {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.install-method {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.install-method-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border-subtle);
}

.install-method-label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 600;
  font-size: 0.875rem;
}

.install-method-label .badge {
  padding: 2px 8px;
  background: var(--accent-green);
  color: var(--bg-primary);
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
}

.install-method-body { padding: var(--space-md); }

.install-method-body code {
  display: block;
  padding: 0;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.875rem;
  word-break: break-all;
}

/* Callout */
.callout {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--accent-primary-dim);
  border: 1px solid rgba(122, 162, 247, 0.3);
  border-radius: var(--radius-md);
  margin-top: var(--space-lg);
}

.callout-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  color: var(--accent-blue);
}

.callout-content { flex: 1; }

.callout-title {
  font-weight: 600;
  color: var(--accent-blue);
  margin-bottom: var(--space-xs);
}

.callout-text {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin: 0;
}

.callout.warning {
  background: rgba(224, 175, 104, 0.15);
  border-color: rgba(224, 175, 104, 0.3);
}

.callout.warning .callout-icon, .callout.warning .callout-title { color: var(--accent-yellow); }

.callout.success {
  background: rgba(158, 206, 106, 0.15);
  border-color: rgba(158, 206, 106, 0.3);
}

.callout.success .callout-icon, .callout.success .callout-title { color: var(--accent-green); }

/* ============================================
   Editor Preview Section
   ============================================ */
.editor-preview {
  position: relative;
  padding: var(--space-3xl) 0;
  background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.editor-mockup {
  max-width: 1000px;
  margin: 0 auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-subtle);
}

.editor-tabs { display: flex; gap: var(--space-xs); }

.editor-tab {
  padding: var(--space-xs) var(--space-md);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.editor-tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.editor-tab.active { background: var(--bg-primary); color: var(--text-bright); }

.editor-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 400px;
}

.editor-pane {
  padding: var(--space-lg);
  border-right: 1px solid var(--border-subtle);
}

.editor-pane:last-child {
  border-right: none;
  background: var(--bg-primary);
}

.editor-pane-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-md);
}

/* ============================================
   Documentation Layout
   ============================================ */
.docs-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: calc(100vh - 64px);
}

/* Sidebar */
.docs-sidebar {
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  padding: var(--space-lg);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

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

.sidebar-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-xs);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  min-height: 40px;
}

.sidebar-link:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.sidebar-link.active {
  color: var(--accent-blue);
  background: var(--accent-primary-dim);
  font-weight: 500;
}

.sidebar-link-icon {
  width: 18px;
  height: 18px;
  opacity: 0.7;
}

/* Sidebar step number badges */
.sidebar-link .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.sidebar-link.active .step-num {
  background: var(--accent-blue);
  color: var(--bg-primary);
}

/* Docs Content */
.docs-content {
  padding: var(--space-xl) var(--space-2xl);
  max-width: 900px;
}

.docs-content h1 {
  font-size: 2.5rem;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
}

.docs-content h2 {
  font-size: 1.75rem;
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
}

.docs-content h3 {
  font-size: 1.25rem;
  margin-top: var(--space-xl);
  margin-bottom: var(--space-sm);
}

.docs-content h2 .anchor, .docs-content h3 .anchor {
  margin-left: var(--space-sm);
  color: var(--text-muted);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.docs-content h2:hover .anchor, .docs-content h3:hover .anchor { opacity: 1; }

.docs-content p { margin-bottom: var(--space-md); }

.docs-content ul, .docs-content ol {
  margin: 0 0 var(--space-md);
  padding-left: var(--space-xl);
}

.docs-content li { margin-bottom: var(--space-sm); }

.docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-md) 0;
}

.docs-content th, .docs-content td {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-default);
  text-align: left;
}

.docs-content th { background: var(--surface-1); font-weight: 600; }
.docs-content td { background: var(--bg-secondary); }
.docs-content tr:hover td { background: var(--surface-1); }

/* Table of Contents */
.toc {
  position: sticky;
  top: 80px;
  padding: var(--space-lg);
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.toc-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-md);
}

.toc-list { list-style: none; padding: 0; margin: 0; }
.toc-item { margin-bottom: var(--space-sm); }

.toc-link {
  display: block;
  padding: var(--space-xs) 0;
  color: var(--text-muted);
  font-size: 0.875rem;
  border-left: 2px solid transparent;
  padding-left: var(--space-md);
  transition: all var(--transition-fast);
}

.toc-link:hover { color: var(--text-primary); }

.toc-link.active {
  color: var(--accent-blue);
  border-left-color: var(--accent-blue);
}

.toc-link.level-3 {
  padding-left: var(--space-xl);
  font-size: 0.8125rem;
}

/* ============================================
   Tutorial-specific Styles
   ============================================ */

/* Tutorial section card */
.tutorial-section {
  margin-bottom: var(--space-3xl);
  scroll-margin-top: 80px;
}

.tutorial-section-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.tutorial-step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--accent-blue);
  color: var(--bg-primary);
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.tutorial-section-title {
  font-size: 1.5rem;
  margin: 0;
}

/* Code comparison panel (mviz vs python) */
.code-compare {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: var(--space-lg) 0;
}

.code-compare-tabs {
  display: flex;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.code-compare-tab {
  padding: var(--space-sm) var(--space-lg);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.code-compare-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.code-compare-tab.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
  background: var(--bg-secondary);
}

.code-compare-tab .tab-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.code-compare-tab .tab-dot.mviz { background: var(--accent-magenta); }
.code-compare-tab .tab-dot.python { background: var(--accent-green); }

.code-compare-panel {
  display: none;
  background: var(--bg-secondary);
}

.code-compare-panel.active {
  display: block;
}

.code-compare-panel pre {
  margin: 0;
  border: none;
  border-radius: 0;
}

.code-compare-panel pre code {
  font-size: 0.8125rem;
}

/* Video container for tutorials */
.tutorial-video {
  margin: var(--space-lg) 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-default);
  background: var(--bg-secondary);
}

.tutorial-video video {
  display: block;
  width: 100%;
  max-height: 400px;
  object-fit: contain;
}

/* Tutorial explanation blocks */
.tutorial-explain {
  padding: var(--space-lg);
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin: var(--space-lg) 0;
}

.tutorial-explain h4 {
  color: var(--accent-cyan);
  font-size: 1rem;
  margin-bottom: var(--space-sm);
}

.tutorial-explain ul {
  margin: 0;
  padding-left: var(--space-lg);
}

.tutorial-explain li {
  margin-bottom: var(--space-xs);
  color: var(--text-secondary);
}

.tutorial-explain li code {
  font-size: 0.8125rem;
}

/* Tutorial progress bar */
.tutorial-progress {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-xl);
}

.tutorial-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.tutorial-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-magenta));
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.tutorial-progress-text {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Gallery item styles (kept for backward compatibility) */
.gallery-grid {
  display: flex;
  flex-direction: column;
  gap: 3rem;
  margin-top: 2rem;
}

.gallery-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.gallery-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.gallery-code {
  padding: 1.5rem;
  border-right: 1px solid var(--border-default);
  overflow-x: auto;
}

.gallery-code h3 {
  margin: 0 0 1rem 0;
  font-size: 1.125rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.gallery-code h3::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--accent-green);
  border-radius: 50%;
}

.gallery-code pre { margin: 0; font-size: 0.875rem; }

.gallery-video {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
}

.gallery-video h3 {
  margin: 0 0 1rem 0;
  font-size: 1.125rem;
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.gallery-video h3::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--accent-magenta);
  border-radius: 50%;
}

.gallery-video video {
  max-width: 100%;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.gallery-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.gallery-title { font-size: 1.25rem; font-weight: 600; margin: 0; }

.gallery-badge {
  background: var(--accent-primary);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

/* ============================================
   Footer
   ============================================ */
.footer {
  padding: var(--space-2xl) 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
}

.footer-content {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-2xl);
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

.footer-brand { margin-bottom: var(--space-md); }

.footer-brand-name {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: var(--space-sm);
}

.footer-brand-desc {
  color: var(--text-muted);
  font-size: 0.9375rem;
  max-width: 300px;
}

.footer-section-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: var(--space-md);
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.footer-link {
  color: var(--text-muted);
  font-size: 0.9375rem;
  transition: color var(--transition-fast);
}

.footer-link:hover { color: var(--accent-blue); }

.footer-bottom {
  margin-top: var(--space-2xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-xl);
  padding-right: var(--space-xl);
}

.footer-copyright { color: var(--text-muted); font-size: 0.875rem; }

.footer-social { display: flex; gap: var(--space-md); }

.footer-social-link {
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.footer-social-link:hover { color: var(--accent-blue); }

/* ============================================
   Search Modal
   ============================================ */
.search-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.search-modal.open { display: flex; }

.search-modal-content {
  width: 100%;
  max-width: 600px;
  margin: 0 var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.search-modal-input {
  width: 100%;
  padding: var(--space-lg);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 1.125rem;
  font-family: inherit;
}

.search-modal-input::placeholder { color: var(--text-muted); }
.search-modal-input:focus { outline: none; }

.search-results { max-height: 400px; overflow-y: auto; }

.search-result {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  cursor: pointer;
  transition: background var(--transition-fast);
  min-height: 48px;
}

.search-result:hover, .search-result.selected { background: var(--bg-hover); }

.search-result-icon { flex-shrink: 0; width: 20px; height: 20px; color: var(--text-muted); }
.search-result-content { flex: 1; }
.search-result-title { font-weight: 500; color: var(--text-bright); margin-bottom: 2px; }
.search-result-path { font-size: 0.8125rem; color: var(--text-muted); }
.search-empty { padding: var(--space-xl); text-align: center; color: var(--text-muted); }

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.animate-fade-in { animation: fadeIn 0.5s ease forwards; }
.animate-slide-up { animation: slideUp 0.5s ease forwards; }

/* Reveal animation */
.reveal {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.js-loaded .reveal:not(.visible) {
  opacity: 0;
  transform: translateY(20px);
}

.reveal.visible, .reveal.is-visible {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

.reveal:nth-child(1) { transition-delay: 0ms; }
.reveal:nth-child(2) { transition-delay: 100ms; }
.reveal:nth-child(3) { transition-delay: 200ms; }
.reveal:nth-child(4) { transition-delay: 300ms; }
.reveal:nth-child(5) { transition-delay: 400ms; }
.reveal:nth-child(6) { transition-delay: 500ms; }

/* Typing animation */
.typing-animation {
  overflow: hidden;
  border-right: 2px solid var(--accent-blue);
  white-space: nowrap;
  animation: typing 3s steps(40, end), blink 0.75s step-end infinite;
}

@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink {
  from, to { border-color: transparent; }
  50% { border-color: var(--accent-blue); }
}

/* ============================================
   Utilities
   ============================================ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-bright { color: var(--text-bright); }
.text-accent { color: var(--accent-blue); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-bright); }

/* Print styles */
@media print {
  .nav-header, .docs-sidebar, .footer { display: none; }
  .docs-content { max-width: 100%; padding: 0; }
  body { background: white; color: black; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ============================================
   MOBILE RESPONSIVENESS - Enhanced
   ============================================ */

/* Tablet breakpoint */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 240px;
  }

  .hero-content {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-text {
    max-width: 100%;
    margin: 0 auto;
  }

  .hero-actions { justify-content: center; }
  .hero-stats { justify-content: center; }
  .hero-stat { text-align: center; }

  .feature-grid { grid-template-columns: repeat(2, 1fr); }

  .editor-content { grid-template-columns: 1fr; }

  .install-grid { grid-template-columns: 1fr; }

  .gallery-content { grid-template-columns: 1fr; }
  .gallery-code {
    border-right: none;
    border-bottom: 1px solid var(--border-default);
  }

  .section-title { font-size: 2rem; }
}

/* Mobile breakpoint */
@media (max-width: 900px) {
  .docs-layout {
    grid-template-columns: 1fr;
  }

  .docs-sidebar {
    position: fixed;
    top: 64px;
    left: 0;
    width: 85%;
    max-width: 320px;
    height: calc(100vh - 64px);
    z-index: var(--z-modal);
    border-right: 1px solid var(--border-default);
    box-shadow: var(--shadow-xl);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .docs-sidebar.open {
    transform: translateX(0);
  }

  .footer-content {
    grid-template-columns: 1fr 1fr;
  }
}

/* Small mobile breakpoint */
@media (max-width: 640px) {
  body {
    font-size: 15px;
    line-height: 1.65;
  }

  h1 { font-size: 1.875rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }

  .container {
    padding: 0 var(--space-md);
  }

  .nav-inner {
    padding: 0 var(--space-md);
  }

  .hero {
    padding: var(--space-2xl) 0;
  }

  .hero-content {
    padding: 0 var(--space-md);
    gap: var(--space-xl);
  }

  .hero-title {
    font-size: clamp(1.75rem, 8vw, 2.5rem);
  }

  .hero-description {
    font-size: 1.0625rem;
  }

  .hero-badge {
    font-size: 0.75rem;
    padding: var(--space-xs) var(--space-sm);
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions .btn {
    justify-content: center;
    width: 100%;
  }

  .hero-stats {
    flex-wrap: wrap;
    gap: var(--space-lg);
    justify-content: center;
  }

  .hero-stat-value { font-size: 1.25rem; }

  .hero-code {
    margin: 0 calc(-1 * var(--space-md));
  }

  .code-window {
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .code-window-body {
    padding: var(--space-md);
  }

  .section {
    padding: var(--space-2xl) 0;
  }

  .section-header {
    margin-bottom: var(--space-xl);
  }

  .section-title {
    font-size: 1.75rem;
  }

  .section-description {
    font-size: 1rem;
  }

  .feature-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .feature-card {
    padding: var(--space-lg);
  }

  .docs-content {
    padding: var(--space-md);
  }

  .docs-content h1 {
    font-size: 1.75rem;
    padding-bottom: var(--space-sm);
  }

  .docs-content h2 {
    font-size: 1.375rem;
  }

  .docs-content h3 {
    font-size: 1.125rem;
  }

  /* Code blocks on mobile - full width, scrollable */
  .code-block {
    margin-left: calc(-1 * var(--space-md));
    margin-right: calc(-1 * var(--space-md));
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .code-compare {
    margin-left: calc(-1 * var(--space-md));
    margin-right: calc(-1 * var(--space-md));
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  pre[class*="language-"] {
    font-size: 0.8125rem;
    padding: var(--space-md);
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  code {
    font-size: 0.8125rem;
  }

  pre code {
    font-size: 0.8125rem;
  }

  .code-compare-panel pre code {
    font-size: 0.75rem;
  }

  /* Tutorial adjustments for mobile */
  .tutorial-section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .tutorial-step-badge {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
  }

  .tutorial-section-title {
    font-size: 1.25rem;
  }

  .tutorial-explain {
    padding: var(--space-md);
    margin-left: calc(-1 * var(--space-md));
    margin-right: calc(-1 * var(--space-md));
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .tutorial-video {
    margin-left: calc(-1 * var(--space-md));
    margin-right: calc(-1 * var(--space-md));
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  /* Tables become scrollable on mobile */
  .docs-content table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  .docs-content th, .docs-content td {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.875rem;
  }

  /* Gallery on mobile */
  .gallery-content {
    grid-template-columns: 1fr;
  }

  .gallery-code {
    border-right: none;
    border-bottom: 1px solid var(--border-default);
    padding: var(--space-md);
  }

  .gallery-video {
    padding: var(--space-md);
  }

  .gallery-header {
    padding: var(--space-sm) var(--space-md);
    flex-wrap: wrap;
  }

  .gallery-title {
    font-size: 1.0625rem;
  }

  /* Footer mobile */
  .footer-content {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .footer-bottom {
    flex-direction: column;
    gap: var(--space-md);
    text-align: center;
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }

  /* Callout mobile */
  .callout {
    flex-direction: column;
    gap: var(--space-sm);
  }

  /* Install methods mobile */
  .install-method-body code {
    font-size: 0.75rem;
    word-break: break-all;
    line-height: 1.8;
  }

  /* Button touch targets */
  .btn {
    min-height: 48px;
    padding: var(--space-md) var(--space-lg);
  }

  .btn-sm {
    min-height: 40px;
    padding: var(--space-sm) var(--space-md);
  }

  /* Sidebar link touch targets */
  .sidebar-link {
    min-height: 48px;
    padding: var(--space-md) var(--space-md);
  }

  /* Search modal on mobile */
  .search-modal {
    padding-top: 10vh;
  }

  .search-modal-content {
    margin: 0 var(--space-sm);
    max-height: 80vh;
  }

  .search-modal-input {
    padding: var(--space-md);
    font-size: 1rem;
  }

  /* Progress bar */
  .tutorial-progress {
    flex-wrap: wrap;
    padding: var(--space-sm) var(--space-md);
  }

  .tutorial-progress-bar {
    order: 2;
    width: 100%;
    flex: none;
  }

  .tutorial-progress-text {
    order: 1;
    width: 100%;
    text-align: center;
    margin-bottom: var(--space-xs);
  }
}

/* Extra small mobile */
@media (max-width: 380px) {
  body {
    font-size: 14px;
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }

  .hero-title {
    font-size: 1.5rem;
  }

  .nav-brand {
    font-size: 1rem;
  }

  .nav-brand-icon {
    width: 28px;
    height: 28px;
    font-size: 0.875rem;
  }

  pre[class*="language-"],
  pre code,
  .code-compare-panel pre code {
    font-size: 0.6875rem;
  }
}

/* (sidebar-mobile-toggle removed - replaced by .sidebar-fab) */

/* ============================================
   Landscape phone orientation
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
  .nav-header {
    position: relative;
  }

  .hero {
    padding: var(--space-lg) 0;
  }

  .section {
    padding: var(--space-xl) 0;
  }
}

/* ============================================
   Tutorial Level Headers
   ============================================ */
.tutorial-level-header {
  margin: var(--space-3xl) 0 var(--space-xl);
  padding: var(--space-xl) var(--space-lg);
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  border-left: 4px solid var(--accent-blue);
}

.tutorial-level-badge {
  display: inline-block;
  padding: 0.2rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
}

.tutorial-level-badge.beginner {
  background: rgba(158, 206, 106, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(158, 206, 106, 0.3);
}

.tutorial-level-badge.intermediate {
  background: rgba(224, 175, 104, 0.15);
  color: var(--accent-yellow);
  border: 1px solid rgba(224, 175, 104, 0.3);
}

.tutorial-level-badge.advanced {
  background: rgba(247, 118, 142, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(247, 118, 142, 0.3);
}

.tutorial-level-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-bright);
  margin: var(--space-xs) 0;
}

.tutorial-level-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Tutorial subtitle */
.tutorial-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: var(--space-xl);
}

/* ============================================
   Tutorial Completion Section
   ============================================ */
.tutorial-completion {
  margin-top: var(--space-3xl);
  padding: var(--space-2xl);
  background: linear-gradient(135deg, rgba(122, 162, 247, 0.08), rgba(187, 154, 247, 0.08));
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  text-align: center;
}

.tutorial-completion h2 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent-blue);
  margin-bottom: var(--space-md);
}

.tutorial-completion p {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

.tutorial-completion ul {
  list-style: none;
  padding: 0;
  margin: 0 auto var(--space-xl);
  max-width: 600px;
  text-align: left;
}

.tutorial-completion li {
  padding: var(--space-xs) 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.tutorial-completion li::before {
  content: '\2713';
  color: var(--accent-green);
  font-weight: 700;
  margin-right: var(--space-sm);
}

.tutorial-next-steps {
  margin-top: var(--space-xl);
}

.tutorial-next-steps h3 {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

.tutorial-next-links {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================
   Back to Top Button
   ============================================ */
.back-to-top {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  z-index: var(--z-sticky);
  width: 44px;
  height: 44px;
  background: var(--accent-blue);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--transition-normal), transform var(--transition-normal), background var(--transition-fast);
  pointer-events: none;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-2px);
}

.back-to-top:active {
  transform: translateY(0);
}

/* ============================================
   Enhanced Mobile Styles - Fluid Typography
   ============================================ */
@media (max-width: 1024px) {
  .tutorial-level-header {
    margin: var(--space-xl) 0 var(--space-lg);
    padding: var(--space-lg) var(--space-md);
  }

  .tutorial-level-title {
    font-size: 1.25rem;
  }
}

@media (max-width: 900px) {
  /* Fluid typography with clamp */
  .docs-content h1 {
    font-size: clamp(1.5rem, 5vw, 2rem);
  }

  .docs-content h2 {
    font-size: clamp(1.2rem, 4vw, 1.5rem);
  }

  .tutorial-subtitle {
    font-size: clamp(0.85rem, 3vw, 1.1rem);
  }

  /* Touch-friendly tab buttons */
  .code-compare-tab {
    min-height: 44px;
    padding: var(--space-sm) var(--space-md);
    font-size: 0.85rem;
  }

  /* Tutorial video responsive */
  .tutorial-video {
    margin-left: calc(-1 * var(--space-md));
    margin-right: calc(-1 * var(--space-md));
    border-radius: 0;
  }

  .tutorial-video video {
    border-radius: 0;
  }

  /* Level headers on mobile */
  .tutorial-level-header {
    margin: var(--space-lg) 0 var(--space-md);
    padding: var(--space-md);
  }

  .tutorial-level-title {
    font-size: 1.1rem;
  }

  .tutorial-level-desc {
    font-size: 0.85rem;
  }

  /* Completion section mobile */
  .tutorial-completion {
    padding: var(--space-lg);
  }

  .tutorial-completion h2 {
    font-size: 1.5rem;
  }

  .tutorial-next-links {
    flex-direction: column;
    align-items: stretch;
  }

  .tutorial-next-links .btn {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Back to top on mobile - larger touch target */
  .back-to-top {
    width: 48px;
    height: 48px;
    bottom: var(--space-lg);
    right: var(--space-lg);
  }

  /* Progress bar touch-friendly */
  .tutorial-progress {
    padding: var(--space-sm) var(--space-md);
  }
}

@media (max-width: 640px) {
  /* Extra small screen adjustments */
  .code-compare-tab {
    min-height: 48px;
    font-size: 0.8rem;
    padding: var(--space-sm);
  }

  .tutorial-section {
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
  }

  .tutorial-explain {
    padding: var(--space-sm);
  }

  .tutorial-explain h4 {
    font-size: 0.9rem;
  }

  .tutorial-explain li {
    font-size: 0.85rem;
    line-height: 1.5;
  }

  /* Code blocks horizontal scroll */
  .code-compare-panel pre {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--surface-3) transparent;
  }

  .code-compare-panel pre code {
    font-size: 0.6875rem;
    white-space: pre;
    word-break: normal;
    overflow-wrap: normal;
  }
}

@media (max-width: 380px) {
  .tutorial-step-badge {
    width: 24px;
    height: 24px;
    font-size: 0.65rem;
  }

  .tutorial-section-title {
    font-size: 1rem;
  }

  .docs-content {
    padding: var(--space-sm);
  }

  .callout {
    padding: var(--space-sm);
  }

  .callout-text {
    font-size: 0.8rem;
  }

  .back-to-top {
    bottom: var(--space-md);
    right: var(--space-md);
  }
}
