:root {
  color-scheme: dark;
}

html[data-theme='light'] {
  color-scheme: light;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(17, 22, 34, 0.92);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--border-light);
  transform: translateY(-1px);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

html[data-theme='light'] {
  --bg-deep: #f5f8fc;
  --bg-base: #edf3f9;
  --bg-surface: #ffffff;
  --bg-elevated: #e6edf5;
  --bg-soft: rgba(79, 70, 229, 0.06);
  --border: #d7e0ec;
  --border-light: #b8c5d6;
  --mint: #0f9d6a;
  --mint-dim: #0c7b54;
  --mint-glow: rgba(15, 157, 106, 0.12);
  --mint-glow-strong: rgba(15, 157, 106, 0.2);
  --amber: #b45309;
  --amber-dim: #92400e;
  --amber-glow: rgba(180, 83, 9, 0.12);
  --indigo: #4f46e5;
  --indigo-dim: #4338ca;
  --indigo-glow: rgba(79, 70, 229, 0.12);
  --cyan: #0891b2;
  --cyan-glow: rgba(8, 145, 178, 0.12);
  --rose: #e11d48;
  --text: #142132;
  --text-secondary: #526174;
  --text-dim: #748397;
  --shadow: 0 20px 50px rgba(148, 163, 184, 0.18);
}

html[data-theme='light'] body {
  background:
    radial-gradient(circle at top left, rgba(8, 145, 178, 0.09), transparent 28%),
    radial-gradient(circle at 82% 0%, rgba(15, 157, 106, 0.1), transparent 26%),
    linear-gradient(180deg, #fbfdff 0%, #f5f8fc 46%, #edf3f9 100%) !important;
  color: var(--text);
}

html[data-theme='light'] a:hover {
  color: var(--text);
}

html[data-theme='light'] nav.scrolled,
html[data-theme='light'] .topnav,
html[data-theme='light'] .topnav.scrolled {
  background: rgba(248, 251, 255, 0.88) !important;
  border-bottom: 1px solid rgba(184, 197, 214, 0.75) !important;
  box-shadow: 0 10px 30px rgba(148, 163, 184, 0.12);
}

html[data-theme='light'] #nav:not(.scrolled) {
  background: transparent !important;
  border-bottom-color: transparent !important;
  box-shadow: none !important;
}

html[data-theme='light'] .theme-toggle,
html[data-theme='light'] .mobile-nav summary {
  background: rgba(255, 255, 255, 0.92) !important;
  border-color: rgba(184, 197, 214, 0.9) !important;
  color: var(--text-secondary) !important;
}

html[data-theme='light'] .mobile-nav[open] summary,
html[data-theme='light'] .theme-toggle:hover {
  border-color: var(--border-light) !important;
  color: var(--text) !important;
}

html[data-theme='light'] .mobile-nav-panel {
  background: rgba(255, 255, 255, 0.97) !important;
  border-color: rgba(184, 197, 214, 0.9) !important;
  box-shadow: 0 18px 40px rgba(148, 163, 184, 0.2) !important;
}

html[data-theme='light'] .mobile-nav-links a:hover,
html[data-theme='light'] .mobile-nav-links a.active {
  background: rgba(15, 23, 42, 0.04) !important;
}

html[data-theme='light'] .hero,
html[data-theme='light'] .summary-card,
html[data-theme='light'] .panel,
html[data-theme='light'] .spotlight,
html[data-theme='light'] .compare-card,
html[data-theme='light'] .drawer,
html[data-theme='light'] .empty-state,
html[data-theme='light'] .skill-card,
html[data-theme='light'] .code-block,
html[data-theme='light'] .callout,
html[data-theme='light'] .problem-card,
html[data-theme='light'] .stage-card,
html[data-theme='light'] .capability-card,
html[data-theme='light'] .benchmark-card,
html[data-theme='light'] .arch-card,
html[data-theme='light'] .runtime-card,
html[data-theme='light'] .harness-card,
html[data-theme='light'] .summary-card,
html[data-theme='light'] .rank-badge,
html[data-theme='light'] .skill-cli,
html[data-theme='light'] .code-header,
html[data-theme='light'] .sidebar,
html[data-theme='light'] .doc-table th,
html[data-theme='light'] .variant-table th,
html[data-theme='light'] .chart-panel,
html[data-theme='light'] .drawer-panel {
  box-shadow: var(--shadow);
}

html[data-theme='light'] .hero {
  background:
    radial-gradient(circle at top right, rgba(15, 157, 106, 0.12), transparent 32%),
    radial-gradient(circle at left center, rgba(79, 70, 229, 0.1), transparent 26%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(239, 245, 252, 0.94)) !important;
  border-color: rgba(184, 197, 214, 0.8) !important;
}

html[data-theme='light'] .hero::after {
  background: radial-gradient(circle, rgba(8, 145, 178, 0.1), transparent 66%) !important;
}

html[data-theme='light'] .eyebrow {
  background: rgba(79, 70, 229, 0.08) !important;
  border-color: rgba(79, 70, 229, 0.16) !important;
  color: var(--indigo) !important;
}

html[data-theme='light'] .hero-pill,
html[data-theme='light'] .meta-pill,
html[data-theme='light'] .harness-chip,
html[data-theme='light'] .level-chip,
html[data-theme='light'] .skill-tag {
  background: rgba(255, 255, 255, 0.86) !important;
  border-color: rgba(184, 197, 214, 0.85) !important;
}

html[data-theme='light'] .capability-harness-card,
html[data-theme='light'] .capability-highlight-item,
html[data-theme='light'] .capability-link {
  background: rgba(248, 251, 255, 0.96) !important;
  border-color: rgba(184, 197, 214, 0.9) !important;
}

html[data-theme='light'] .capability-domain-bar {
  background: rgba(184, 197, 214, 0.34) !important;
  box-shadow: inset 0 0 0 1px rgba(184, 197, 214, 0.4);
}

html[data-theme='light'] .capability-harness-card span,
html[data-theme='light'] .capability-highlight-item,
html[data-theme='light'] .capability-domain-row,
html[data-theme='light'] .capability-link {
  color: var(--text-secondary) !important;
}

html[data-theme='light'] .capability-harness-card strong,
html[data-theme='light'] .capability-highlight-item strong {
  color: var(--text) !important;
}

html[data-theme='light'] .summary-card,
html[data-theme='light'] .panel,
html[data-theme='light'] .spotlight,
html[data-theme='light'] .compare-card,
html[data-theme='light'] .drawer,
html[data-theme='light'] .empty-state,
html[data-theme='light'] .problem-card,
html[data-theme='light'] .stage-card,
html[data-theme='light'] .capability-card,
html[data-theme='light'] .benchmark-card,
html[data-theme='light'] .arch-card,
html[data-theme='light'] .runtime-card,
html[data-theme='light'] .harness-card,
html[data-theme='light'] .skill-card,
html[data-theme='light'] .skill-cli,
html[data-theme='light'] .code-block,
html[data-theme='light'] .sidebar,
html[data-theme='light'] .rank-badge,
html[data-theme='light'] .summary-card {
  background: rgba(255, 255, 255, 0.88) !important;
  border-color: rgba(184, 197, 214, 0.8) !important;
}

html[data-theme='light'] .code-header,
html[data-theme='light'] .doc-table th,
html[data-theme='light'] .variant-table th,
html[data-theme='light'] th,
html[data-theme='light'] .toolbar {
  background: rgba(236, 242, 248, 0.9) !important;
  border-color: rgba(184, 197, 214, 0.8) !important;
}

html[data-theme='light'] .matrix-table td:first-child {
  background: rgba(248, 251, 255, 0.98) !important;
}

html[data-theme='light'] .field input,
html[data-theme='light'] .field select,
html[data-theme='light'] .filter-select,
html[data-theme='light'] .search-input {
  background-color: rgba(255, 255, 255, 0.94) !important;
  border-color: rgba(184, 197, 214, 0.85) !important;
  color: var(--text) !important;
}

html[data-theme='light'] tbody tr:hover {
  background: rgba(79, 70, 229, 0.05) !important;
}

html[data-theme='light'] tbody tr.active {
  background: rgba(15, 157, 106, 0.08) !important;
}

html[data-theme='light'] .mini-domain-bar,
html[data-theme='light'] .mini-bar.no-skill,
html[data-theme='light'] .legend-dot.no-skill {
  background: rgba(116, 131, 151, 0.16) !important;
  border-color: rgba(184, 197, 214, 0.9) !important;
}

html[data-theme='light'] .track.original .track-name,
html[data-theme='light'] .track.original .track-value {
  color: rgba(255, 255, 255, 0.98) !important;
  text-shadow: 0 1px 2px rgba(49, 46, 129, 0.35);
}

html[data-theme='light'] .harness-card,
html[data-theme='light'] .domain-gap-row,
html[data-theme='light'] .legend-item,
html[data-theme='light'] .meta-pill,
html[data-theme='light'] .primitive-group,
html[data-theme='light'] .drawer-card {
  background: rgba(248, 251, 255, 0.96) !important;
  border-color: rgba(184, 197, 214, 0.9) !important;
}

html[data-theme='light'] .domain-bar,
html[data-theme='light'] .mini-domain-bar {
  background: rgba(184, 197, 214, 0.34) !important;
  box-shadow: inset 0 0 0 1px rgba(184, 197, 214, 0.4);
}

html[data-theme='light'] .domain-row,
html[data-theme='light'] .primitive-list li,
html[data-theme='light'] .legend-item,
html[data-theme='light'] .meta-pill,
html[data-theme='light'] .drawer-card strong {
  color: var(--text-secondary) !important;
}

html[data-theme='light'] .harness-card strong,
html[data-theme='light'] .domain-gap-row strong,
html[data-theme='light'] .primitive-list strong,
html[data-theme='light'] .drawer-card span {
  color: var(--text) !important;
}

html[data-theme='light'] .filters {
  background: linear-gradient(to bottom, rgba(245, 248, 252, 0.96) 60%, transparent) !important;
}

html[data-theme='light'] footer {
  border-top-color: rgba(184, 197, 214, 0.8) !important;
}

html[data-theme='light'] .hero-gradient {
  background:
    radial-gradient(ellipse 60% 50% at 50% 40%, rgba(15, 157, 106, 0.08) 0%, transparent 70%),
    radial-gradient(ellipse 80% 60% at 30% 80%, rgba(79, 70, 229, 0.05) 0%, transparent 70%),
    linear-gradient(to bottom, transparent 70%, var(--bg-deep) 100%) !important;
}

html[data-theme='light'] .pipeline-node-rect {
  fill: var(--bg-surface) !important;
  stroke: var(--border) !important;
}

html[data-theme='light'] .pipeline-connector {
  stroke: var(--border-light) !important;
}

html[data-theme='light'] .btn-secondary {
  background: rgba(255, 255, 255, 0.7) !important;
}

@media (max-width: 700px) {
  .theme-toggle {
    width: 38px;
    height: 38px;
  }
}