/* ==========================================================================
   COMPONENT STYLES - MODULAR, MOBILE-FIRST & ACCESSIBLE UI
   ========================================================================== */

/* 1. Header & Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 100%;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--container-max);
  flex-wrap: nowrap;
  gap: var(--space-2);
  min-width: 0;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-family-display);
  font-weight: var(--font-weight-bold);
  font-size: 1.05rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
  min-width: 0;
  transition: transform var(--transition-fast);
}

.brand-logo:hover {
  transform: scale(1.02);
}

.brand-isotype {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 8px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
  transition: filter var(--transition-fast), transform var(--transition-fast);
}

.brand-logo:hover .brand-isotype {
  filter: drop-shadow(0 0 10px rgba(56, 189, 248, 0.45));
  transform: rotate(-3deg);
}

.brand-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.brand-name-gradient {
  background: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
}

[data-theme="light"] .brand-name-gradient {
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-menu {
  display: none;
  align-items: center;
  gap: var(--space-4);
  list-style: none;
  margin: 0;
  padding: 0;
  white-space: nowrap;
}

@media (min-width: 992px) {
  .nav-menu {
    display: flex;
  }
}

.nav-link {
  font-size: 0.84rem;
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  transition: color var(--transition-fast);
  letter-spacing: -0.01em;
  white-space: nowrap;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-md);
}

.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.btn-header-cta {
  display: none;
  white-space: nowrap;
  padding: 0.45rem 0.95rem !important;
  font-size: 0.8rem !important;
  min-height: 38px;
}

@media (min-width: 1100px) {
  .btn-header-cta {
    display: inline-flex;
  }
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 992px) {
  .mobile-menu-toggle {
    display: none !important;
  }
  .mobile-nav-backdrop {
    display: none !important;
  }
}

/* Mobile Navigation Drawer */
.mobile-nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-smooth);
}

.mobile-nav-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.mobile-nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(85vw, 21rem);
  background: var(--bg-card);
  border-left: 1px solid var(--border-strong);
  z-index: 100;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transform: translateX(100%);
  transition: transform var(--transition-smooth);
  box-shadow: var(--shadow-elevated);
}

.mobile-nav-backdrop.open .mobile-nav-drawer {
  transform: translateX(0);
}

.mobile-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.mobile-nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  min-height: 48px;
}

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

.mobile-nav-footer {
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.mobile-nav-footer .btn {
  width: 100%;
  min-height: 48px;
  font-size: 0.9rem;
  font-weight: 600;
}

/* ==========================================================================
   2. BUTTON SYSTEM (TACTILE, ACCESSIBLE, HIGH PERFORMANCE)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--space-2);
  padding: 0.65rem 1.25rem;
  font-family: var(--font-family-body);
  font-size: var(--font-size-sm);
  font-weight: 600;
  line-height: 1.35;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  min-height: 44px; /* Standard Touch Target Height */
  box-sizing: border-box;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.97);
}

.btn svg {
  flex-shrink: 0;
}

.btn-primary {
  background: var(--text-primary);
  color: var(--text-inverse);
  border-color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-primary:hover {
  opacity: 0.92;
  color: var(--text-inverse);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.15);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

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

/* Icon Buttons (Min 40px Touch Target) */
.btn-icon {
  width: 2.5rem;
  height: 2.5rem;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-icon:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

/* 3. Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.3rem 0.75rem;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-muted);
  color: var(--text-secondary);
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
  text-align: left;
}

.badge-cyan {
  background: var(--bg-muted);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.badge-emerald {
  background: var(--color-success-bg);
  color: var(--color-success);
  border-color: var(--color-success-border);
}

.badge-amber {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border-color: var(--color-warning-border);
}

.badge-purple {
  background: var(--bg-muted);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

/* 4. Hero Section */
.hero-section {
  position: relative;
  padding: var(--space-10) 0 var(--space-12);
  border-bottom: 1px solid var(--border-subtle);
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

@media (min-width: 768px) {
  .hero-section {
    padding: var(--space-12) 0 var(--space-16);
  }
}

.hero-grid {
  display: grid;
  grid-template-columns: 100%;
  gap: var(--space-8);
  align-items: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

@media (min-width: 992px) {
  .hero-grid {
    grid-template-columns: 1.1fr 0.9fr;
    gap: var(--space-10);
  }
}

.hero-tag {
  margin-bottom: var(--space-4);
  max-width: 100%;
}

.hero-title {
  font-size: clamp(1.85rem, 6.5vw, 3.25rem);
  margin-bottom: var(--space-4);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.04em;
  overflow-wrap: break-word;
}

.hero-subtitle {
  font-size: clamp(0.95rem, 2.5vw, 1.125rem);
  color: var(--text-secondary);
  margin-bottom: var(--space-6);
  max-width: 36rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
  width: 100%;
}

.hero-ctas .btn {
  font-size: 0.9rem;
  padding: 0.75rem 1.35rem;
  min-height: 48px;
}

@media (max-width: 580px) {
  .hero-ctas {
    flex-direction: column;
  }
  .hero-ctas .btn {
    width: 100%;
    min-height: 50px;
    font-size: 0.92rem;
  }
}

.metrics-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

@media (min-width: 600px) {
  .metrics-strip {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
    padding: var(--space-4) var(--space-6);
  }
}

.metric-item {
  text-align: left;
}

.metric-value {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  font-family: var(--font-family-display);
}

.metric-label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

/* 5. Terminal / Code Showcase Window */
.terminal-window {
  background: var(--bg-code);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-elevated);
  overflow: hidden;
  font-family: var(--font-family-mono);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.terminal-header {
  background: #161b22;
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.terminal-dots {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: var(--radius-full);
}

.dot-red { background: #ff5f56; }
.dot-yellow { background: #ffbd2e; }
.dot-green { background: #27c93f; }

.terminal-title {
  font-size: var(--font-size-xs);
  color: var(--zinc-400);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.terminal-body {
  padding: var(--space-4);
  font-size: 0.825rem;
  color: #e4e4e7;
  line-height: 1.6;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.terminal-footer-bar {
  padding: var(--space-3) var(--space-4);
  background: #11161d;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.75rem;
  color: var(--text-muted);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* 6. Feature Cards (Pillars Grid) */
.pillars-grid {
  display: grid;
  grid-template-columns: 100%;
  gap: var(--space-4);
  width: 100%;
  max-width: 100%;
}

@media (min-width: 768px) {
  .pillars-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-6);
  }
}

.card-pillar {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

@media (min-width: 768px) {
  .card-pillar {
    padding: var(--space-6);
  }
}

.card-pillar:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.card-icon-wrapper {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-md);
  background: var(--bg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
  font-size: 1.25rem;
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

/* 7. Curriculum & Redesigned Module Cards */
.curriculum-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  width: 100%;
  max-width: 100%;
}

@media (min-width: 768px) {
  .curriculum-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: var(--space-8);
  }
}

.search-wrapper {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

@media (min-width: 768px) {
  .search-wrapper {
    max-width: 320px;
  }
}

.search-input {
  width: 100%;
  max-width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 16px; /* Prevents iOS auto-zoom */
  outline: none;
  min-height: 46px;
  box-sizing: border-box;
  transition: border-color var(--transition-fast);
}

.search-input:focus {
  border-color: var(--border-focus);
}

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

/* Phase Filter Tabs (Responsive Segmented Pill Bar) */
.phase-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
  padding: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  width: 100%;
  box-sizing: border-box;
}

.tab-btn {
  flex: 0 1 auto;
  text-align: center;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: var(--font-size-xs);
  cursor: pointer;
  white-space: nowrap;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: all var(--transition-fast);
}

.tab-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}

.tab-btn.active {
  background: var(--text-primary);
  color: var(--text-inverse);
  border-color: var(--text-primary);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.tab-btn-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  font-size: 0.72rem;
  padding: 0.05rem 0.45rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  margin-left: 0.25rem;
}

.tab-btn.active .tab-btn-count {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text-inverse);
  border-color: transparent;
}

.phase-hero-strip {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

@media (min-width: 640px) {
  .phase-hero-strip {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.phase-hero-title {
  font-family: var(--font-family-display);
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.phase-hero-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  max-width: 42rem;
  line-height: 1.45;
}

.phase-hero-count {
  font-family: var(--font-family-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-surface);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
  align-self: flex-start;
}

.phase-nav-footer {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 540px) {
  .phase-nav-footer {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.phase-nav-footer .btn {
  min-height: 44px;
  font-size: 0.85rem;
}

@media (max-width: 540px) {
  .phase-nav-footer .btn {
    width: 100%;
  }
}

/* Module Cards */
.module-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 190px;
  transition: all var(--transition-smooth);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  text-align: left;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.module-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.module-id-badge {
  font-family: var(--font-family-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--bg-muted);
  border: 1px solid var(--border-strong);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.05em;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.725rem;
  font-weight: var(--font-weight-medium);
  font-family: var(--font-family-body);
}

.status-indicator.completed {
  color: var(--color-success);
}

.status-indicator.planned {
  color: var(--text-muted);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-indicator.completed .status-dot {
  background: var(--color-success);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

.status-indicator.planned .status-dot {
  background: var(--zinc-600);
}

.card-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.module-phase-tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand-primary);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.module-title {
  font-family: var(--font-family-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.module-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

.module-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.725rem;
  color: var(--text-muted);
  font-family: var(--font-family-mono);
  overflow: hidden;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.meta-sep {
  color: var(--zinc-600);
}

.meta-project {
  color: var(--text-muted);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 130px;
}

.card-arrow {
  color: var(--text-muted);
  transition: transform var(--transition-fast), color var(--transition-fast);
  display: flex;
  align-items: center;
  margin-left: var(--space-2);
  flex-shrink: 0;
}

.module-card:hover .card-arrow {
  transform: translateX(4px);
  color: var(--text-primary);
}

/* 8. Hardware Visual Gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: 100%;
  gap: var(--space-4);
  width: 100%;
  max-width: 100%;
}

@media (min-width: 540px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
  }
}

@media (min-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-5);
  }
}

.gallery-card-fig {
  height: 150px;
  background: #000;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: var(--space-3);
  border: 1px solid var(--border-subtle);
}

.gallery-card-fig img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gallery-card-desc {
  font-size: var(--font-size-xs);
  line-height: 1.5;
  margin-top: var(--space-1);
}

/* 9. Comparison Section */
.table-desktop-view {
  display: none;
  width: 100%;
  max-width: 100%;
}

@media (min-width: 768px) {
  .table-desktop-view {
    display: block;
  }
}

.table-responsive-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  width: 100%;
  max-width: 100%;
}

.table-modern {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: var(--font-size-sm);
}

.table-modern th {
  padding: var(--space-4) var(--space-5);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-family-display);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.table-modern td {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.table-modern tr:last-child td {
  border-bottom: none;
}

/* Mobile Interactive Comparison (< 768px) */
.comparison-mobile-hub {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

@media (min-width: 768px) {
  .comparison-mobile-hub {
    display: none;
  }
}

.compare-mobile-pills {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-4);
  width: 100%;
  max-width: 100%;
}

.compare-mobile-pills::-webkit-scrollbar {
  display: none;
}

.compare-pill-btn {
  flex: 0 0 auto;
  padding: 0.5rem 1rem;
  font-family: var(--font-family-mono);
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.compare-pill-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.compare-pill-btn.active {
  background: var(--text-primary);
  color: var(--text-inverse);
  border-color: var(--text-primary);
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.compare-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  box-shadow: var(--shadow-subtle);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.compare-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
}

.compare-card-title {
  font-family: var(--font-family-display);
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--text-primary);
}

.compare-dual-grid {
  display: grid;
  grid-template-columns: 100%;
  gap: var(--space-2);
  width: 100%;
  max-width: 100%;
}

@media (min-width: 480px) {
  .compare-dual-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.compare-box {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--font-size-xs);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.compare-box-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-family-mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.compare-box-content {
  font-family: var(--font-family-mono);
  font-size: 0.8rem;
  font-weight: 600;
}

.compare-box-broken {
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.25);
  color: #fca5a5;
}

.compare-box-broken .compare-box-label {
  color: #fb7185;
}

.compare-box-fixed {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
}

.compare-box-fixed .compare-box-label {
  color: #34d399;
}

.compare-advantage-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  line-height: 1.5;
}

/* 10. Platform Quick-Start Tabs */
.platform-tabs-nav {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: var(--space-3);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  width: 100%;
  max-width: 100%;
}

.platform-tabs-nav::-webkit-scrollbar {
  display: none;
}

.platform-tab-btn {
  padding: 0.55rem 1.05rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  min-height: 42px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.platform-tab-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.platform-tab-btn.active {
  background: var(--text-primary);
  color: var(--text-inverse);
  border-color: var(--text-primary);
  font-weight: 700;
}

.platform-snippet {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.platform-snippet pre {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* 11. Modal Drawer */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 44rem;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-elevated);
  margin: auto;
  box-sizing: border-box;
}

@media (max-width: 600px) {
  .modal-dialog {
    width: 95vw !important;
    max-height: 92vh !important;
    border-radius: var(--radius-lg);
  }
  .modal-header {
    padding: var(--space-4) !important;
  }
  .modal-body {
    padding: var(--space-4) !important;
  }
}

.modal-header {
  padding: var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}

.modal-body {
  padding: var(--space-5);
  overflow-y: auto;
}

.modal-footer {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  width: 100%;
  box-sizing: border-box;
}

.modal-footer .btn {
  min-height: 44px;
}

@media (max-width: 480px) {
  .modal-footer {
    flex-direction: column;
  }
  .modal-footer .btn {
    width: 100%;
  }
}

/* Interactive Lesson & Demo Links in Modal */
.lesson-link-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding: 0.85rem 1rem;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.lesson-link-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  transform: translateX(3px);
}

.lesson-link-badge {
  font-family: var(--font-family-mono);
  font-size: 0.75rem;
  color: var(--text-primary);
  font-weight: 700;
  padding: 2px 6px;
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  height: fit-content;
}

.lesson-action-tag {
  font-size: 0.75rem;
  color: #38bdf8;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.demo-link-badge {
  font-family: var(--font-family-mono);
  font-size: 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.demo-link-badge:hover {
  background: rgba(244, 63, 94, 0.15);
  border-color: #f43f5e;
  color: #fda4af;
}

/* 12. Lightbox Modal for Manim Visuals */
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-smooth);
}

.lightbox-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.lightbox-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 54rem;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-elevated);
  margin: auto;
  box-sizing: border-box;
}

@media (max-width: 600px) {
  .lightbox-dialog {
    width: 95vw !important;
    max-height: 92vh !important;
    border-radius: var(--radius-lg);
  }
}

.lightbox-media {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2);
  max-height: 50vh;
  overflow: hidden;
}

.lightbox-media img {
  max-width: 100%;
  max-height: 48vh;
  object-fit: contain;
}

/* 13. Accordion (FAQ) */
.accordion-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

.accordion-header {
  padding: var(--space-4);
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-weight: 600;
  font-size: var(--font-size-sm);
  user-select: none;
  gap: var(--space-2);
  line-height: 1.4;
}

.accordion-header:hover {
  background: var(--bg-card-hover);
}

.accordion-icon {
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.accordion-item.active .accordion-icon {
  transform: rotate(180deg);
}

.accordion-content {
  padding: 0 var(--space-4) var(--space-4);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  display: none;
  line-height: 1.6;
}

.accordion-item.active .accordion-content {
  display: block;
}

/* 14. Footer */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  padding: var(--space-10) 0 var(--space-8);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.footer-grid {
  display: grid;
  grid-template-columns: 100%;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
  width: 100%;
  max-width: 100%;
}

@media (min-width: 640px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr 1fr;
  }
}

.footer-col h4 {
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.footer-links a {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.footer-links a:hover {
  color: var(--text-primary);
}

.footer-bottom {
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  width: 100%;
  max-width: 100%;
}

@media (min-width: 640px) {
  .footer-bottom {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

/* 15. Code Copy Button */
pre {
  position: relative;
}

.code-copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.72rem;
  font-family: var(--font-family-mono);
  background: rgba(22, 27, 34, 0.85);
  backdrop-filter: blur(4px);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
  z-index: 5;
  opacity: 0.7;
}

pre:hover .code-copy-btn, .code-copy-btn:focus-visible {
  opacity: 1;
}

.code-copy-btn:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.code-copy-btn.copied {
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.15);
  opacity: 1;
}

/* 16. Comprehensive Light Mode Support */
[data-theme="light"] {
  .site-header {
    background: rgba(248, 250, 252, 0.85);
    border-bottom: 1px solid #e2e8f0;
  }

  .mobile-nav-backdrop {
    background: rgba(15, 23, 42, 0.6);
  }

  .mobile-nav-drawer {
    background: #ffffff;
    border-left: 1px solid #e2e8f0;
  }

  .card-pillar,
  .module-card,
  .compare-card,
  .accordion-item,
  .metric-item,
  .phase-hero-strip {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  }

  .card-pillar:hover,
  .module-card:hover,
  .accordion-item:hover {
    border-color: #0284c7;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  }

  .card-icon-wrapper {
    background: #f1f5f9;
    border-color: #e2e8f0;
  }

  .badge-cyan {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #bae6fd;
  }

  .badge-emerald {
    background: #d1fae5;
    color: #047857;
    border-color: #a7f3d0;
  }

  .badge-purple {
    background: #ede9fe;
    color: #6d28d9;
    border-color: #ddd6fe;
  }

  .badge-amber {
    background: #fef3c7;
    color: #b45309;
    border-color: #fde68a;
  }

  .table-modern {
    background: #ffffff;
    border: 1px solid #e2e8f0;
  }

  .table-modern th {
    background: #f1f5f9;
    color: #0f172a;
    border-bottom: 2px solid #cbd5e1;
  }

  .table-modern td {
    color: #334155;
    border-bottom: 1px solid #e2e8f0;
  }

  .table-modern tr:hover td {
    background: #f8fafc;
  }

  .tab-btn {
    background: #f1f5f9;
    color: #334155;
    border-color: #cbd5e1;
  }

  .tab-btn.active {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
  }

  .tab-btn-count {
    background: #e2e8f0;
    color: #475569;
    border-color: #cbd5e1;
  }

  .tab-btn.active .tab-btn-count {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
  }

  .compare-pill-btn {
    background: #f1f5f9;
    color: #334155;
    border-color: #cbd5e1;
  }

  .compare-pill-btn.active {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
  }

  .platform-tab-btn {
    background: #f1f5f9;
    color: #334155;
    border-color: #cbd5e1;
  }

  .platform-tab-btn.active {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
  }

  .search-input {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #0f172a;
  }

  .search-input:focus {
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
  }

  .search-input::placeholder {
    color: #94a3b8;
  }

  .modal-dialog,
  .lightbox-dialog {
    background: #ffffff;
    border-color: #cbd5e1;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.16);
  }

  .modal-header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    color: #0f172a;
  }

  .modal-footer {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
  }

  .btn-secondary {
    background: #ffffff;
    color: #0f172a;
    border-color: #cbd5e1;
  }

  .btn-secondary:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
  }

  .site-footer {
    background: #f1f5f9;
    border-top: 1px solid #e2e8f0;
  }
}
