/* theme.css — the theme-toggle control plus a few global, theme-agnostic rules.
   All color/design tokens live in tokens.css (loaded first); every component
   themes itself through var(), so there is no per-component light/dark override
   list here anymore. What remains is the toggle button itself (with the handful
   of toggle-specific light tweaks that don't map to a shared token) and two
   global media queries that apply on every page. */

.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 48px;
  height: 26px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--subtle);
  font: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.theme-toggle:hover {
  border-color: var(--primary);
  color: var(--text);
}

.theme-toggle-dot {
  position: absolute;
  left: 3px;
  top: 3px;
  z-index: 2;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(250, 70, 22, 0.18);
  transition: transform 0.18s ease, background 0.15s, box-shadow 0.15s;
}

.theme-toggle-icon {
  position: relative;
  z-index: 1;
  width: 18px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  pointer-events: none;
}

.theme-toggle-icon-dark {
  color: var(--text);
}

.theme-toggle-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.theme-toggle-floating {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 500;
}

/* Light-mode toggle appearance: an orange-tinted track with an amber "sun" dot.
   These tints are specific to the toggle and intentionally don't map to shared
   tokens, so they stay as explicit overrides. */
html[data-theme="light"] .theme-toggle {
  background: #fff3f0;
  border-color: #fec4b4;
}

html[data-theme="light"] .theme-toggle:hover {
  color: #b32e09;
}

html[data-theme="light"] .theme-toggle-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
  transform: translateX(22px);
}

html[data-theme="light"] .theme-toggle-icon-dark {
  color: var(--muted);
}

html[data-theme="light"] .theme-toggle-icon-light {
  color: #92400e;
}

/* Loaded on every page: keep form controls ≥16px on phones so iOS Safari does
   not auto-zoom on focus. Page stylesheets override their own styled controls. */
@media (max-width: 768px) {
  input, select, textarea { font-size: 16px; }
}

/* Respect the OS "reduce motion" preference: drop the looping pulses/spinners
   and shorten transitions for users who are motion-sensitive. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
