/* ============================================
   Theme Toggle Switch
   ============================================ */

button.theme-toggle {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.theme-toggle {
  position: relative;
  width: 60px;
  height: 30px;
  padding: 3px;
  border-radius: 100px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: background 0.3s, border-color 0.3s;
  flex-shrink: 0;
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-toggle-track {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  position: relative;
}

.theme-toggle-thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-card-hover);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

/* Dark mode (default): thumb on left showing moon */
.theme-toggle-thumb svg.icon-moon { display: block; }
.theme-toggle-thumb svg.icon-sun  { display: none; }

/* Light mode: thumb slides right, shows sun */
.light-theme .theme-toggle-thumb {
  transform: translateX(30px);
}
.light-theme .theme-toggle-thumb svg.icon-moon { display: none; }
.light-theme .theme-toggle-thumb svg.icon-sun  { display: block; }

/* Inactive icon (opposite side) */
.theme-toggle-inactive {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  color: var(--text-muted);
}

/* In dark mode: sun icon sits on the right */
.theme-toggle-inactive.inactive-sun  { order: 2; margin-left: auto; }
.theme-toggle-inactive.inactive-moon { order: 2; margin-left: auto; display: none; }

.light-theme .theme-toggle-inactive.inactive-sun  { display: none; }
.light-theme .theme-toggle-inactive.inactive-moon { display: flex; }

.theme-toggle svg {
  width: 14px;
  height: 14px;
  stroke-width: 1.5;
  fill: none;
  stroke: currentColor;
}

.theme-toggle-thumb svg {
  color: var(--text);
}

/* Mobile: show in mobile menu too */
.mobile-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.mobile-theme-toggle .theme-toggle {
  margin-left: auto;
}

@media (max-width: 768px) {
  .nav-theme-toggle { display: none; }
}

/* ============================================
   Light Theme — Variable Overrides
   ============================================ */

.light-theme {
  --bg: #f8f8fa;
  --bg-elevated: #f0f0f3;
  --bg-card: #ffffff;
  --bg-card-hover: #f5f5f7;
  --border: #e0e0e5;
  --border-light: #d0d0d8;
  --text: #1a1a1e;
  --text-secondary: #5a5a68;
  --text-muted: #7a7a88;
  --accent: #4169E1;
  --accent-light: #5A80F0;
  --accent-glow: rgba(65, 105, 225, 0.15);
  --accent-glow-strong: rgba(65, 105, 225, 0.3);
  --success: #22b07a;
  color-scheme: light;
}

/* Nav background */
.light-theme .nav {
  background: rgba(248, 248, 250, 0.85);
}

/* Hero — white bg with Royal Blue marble wave */
.light-theme .hero-shader-canvas {
  background: var(--bg);
  filter: blur(20px) invert(1) sepia(1) saturate(1.5) hue-rotate(195deg) brightness(0.85) contrast(1.3);
}

.light-theme .hero-shader-canvas.revealed {
  filter: invert(1) sepia(1) saturate(1.5) hue-rotate(195deg) brightness(0.85) contrast(1.3);
}

/* Overlays fade to light bg */
.light-theme .hero-shader-overlay {
  background: linear-gradient(to top, rgba(248,248,250,0.4) 0%, transparent 10%, transparent 100%);
}

.light-theme .hero-shader-fade {
  background: linear-gradient(to top, var(--bg), transparent);
  height: 40px;
}

/* Hero text — dark on light shader bg */
.light-theme .hero h1 {
  color: var(--text);
}

.light-theme .hero h1 em {
  color: var(--accent);
}

.light-theme .hero-badge {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.1);
  color: var(--text-secondary);
}

.light-theme .hero-sub {
  color: var(--text-secondary);
}

.light-theme .hero-stats .stat-value {
  color: var(--text);
}

.light-theme .hero-stats .stat-label {
  color: var(--text-muted);
}

.light-theme .hero-stats {
  border-top-color: var(--border);
}

.light-theme .scroll-indicator {
  color: var(--text-muted);
}

.light-theme .scroll-line {
  background: var(--text-muted);
}

/* Hero gradient fallback */
.light-theme .hero-gradient {
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
}

/* Hero buttons on light bg */
.light-theme .hero-actions .btn-outline {
  color: var(--text);
  border-color: var(--border);
}

.light-theme .hero-actions .btn-outline:hover {
  border-color: transparent;
  background: rgba(0,0,0,0.03);
}

/* Buttons — primary still white text on accent */
.light-theme .btn-primary {
  color: #fff;
}

.light-theme .btn-nav {
  color: #fff;
}

.light-theme .btn-outline:hover {
  border-color: transparent;
  background: rgba(0,0,0,0.03);
}

/* Product visual bg */
.light-theme .product-visual {
  background: rgba(0,0,0,0.02);
}

/* Product badge */
.light-theme .product-badge {
  color: #fff;
}

/* Hero stats border */
.light-theme .hero-stats {
  border-top-color: var(--border);
}

/* Form validation red stays the same */

/* Processing badge stays white on accent */
.light-theme .processing-badge {
  color: #fff;
}

/* Btn spinner */
.light-theme .btn-spinner {
  border-color: rgba(0,0,0,0.2);
  border-top-color: var(--accent);
}

/* Skip link */
.light-theme .skip-link {
  color: #fff;
}
