/* TireOrigin theme system (PM batch 26). Dark is the default; light is
   an opt-in palette. Variables flip everything built on them; the rules
   below fix the few hardcoded darks (headers, glows, article text). */

:root[data-theme="light"] {
  --bg: #f5f3ee;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --fg: #211f1b;
  --fg-muted: #6f6a60;
  --accent: #c94f28;
  --accent-hover: #b0431f;
  --accent-glow: rgba(201, 79, 40, 0.18);
  --success: #178a5c;
  --warning: #9a7400;
  --info: #2058c8;
  --border: #e2ddd2;
}

/* headers use a hardcoded dark backdrop tint — flip it */
[data-theme="light"] header {
  background: rgba(245, 243, 238, 0.9) !important;
}

/* decorative glows and noise are dark-theme artifacts — hide them */
[data-theme="light"] .glow-orb,
[data-theme="light"] .glow,
[data-theme="light"] .noise-overlay {
  display: none !important;
}

/* article + legal page body text is hardcoded off-white — darken */
[data-theme="light"] .body p,
[data-theme="light"] .body li,
[data-theme="light"] main p {
  color: #3a372f !important;
}

/* subtle hovers that were white-on-dark become dark-on-white */
[data-theme="light"] .admin-row:hover {
  background: rgba(0, 0, 0, 0.03) !important;
}

/* the toggle button (created by theme.js) */
#themeToggleBtn {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9000;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--fg);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#themeToggleBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.24);
}
@media (max-width: 640px) {
  #themeToggleBtn {
    bottom: auto;
    top: 72px;
    right: 12px;
    width: 40px;
    height: 40px;
    font-size: 17px;
  }
}

/* ---- header pill switch (PM batch 27) ---- */
#themeSwitch {
  display: inline-flex;
  align-items: center;
  width: 62px;
  height: 30px;
  border-radius: 100px;
  background: var(--border);
  border: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  margin: 0 6px;
  flex-shrink: 0;
  transition: background 0.25s ease, border-color 0.25s ease;
  user-select: none;
}
#themeSwitch.on {
  background: rgba(201, 79, 40, 0.25);
  border-color: var(--accent);
}
#themeSwitchKnob {
  position: absolute;
  top: 2px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  transition: transform 0.25s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
#themeSwitch.on #themeSwitchKnob {
  transform: translateX(31px);
}
#themeSwitch:hover { border-color: var(--accent); }
#themeSwitch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 640px) {
  #themeSwitch { width: 54px; height: 27px; margin: 0 4px; }
  #themeSwitchKnob { width: 21px; height: 21px; font-size: 11px; }
  #themeSwitch.on #themeSwitchKnob { transform: translateX(26px); }
}
