/* =========================================================
   Theme switch + light theme (hand-tuned layer).
   Mechanical colour remaps live in theme-light.auto.css
   (regenerate with: node tools/build-light-theme.js).
   ========================================================= */

/* ---------- Logo variants ---------- */
.ks-logo-on-light {
  display: none !important;
}

html[data-theme="light"] .ks-logo-on-dark {
  display: none !important;
}

html[data-theme="light"] .ks-logo-on-light {
  display: inline-block !important;
}

/* ---------- Toggle button ---------- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--ks-border);
  border-radius: 50%;
  background: transparent;
  color: var(--ks-text);
  cursor: pointer;
  transition: color 0.2s var(--ks-ease), border-color 0.2s var(--ks-ease), background 0.2s var(--ks-ease);
}

.theme-toggle:hover {
  color: var(--ks-accent);
  border-color: var(--ks-accent);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--ks-accent);
  outline-offset: 2px;
}

.theme-toggle svg {
  flex: 0 0 auto;
}

/* Show the icon of the theme you'd switch TO */
.theme-toggle__moon,
html[data-theme="light"] .theme-toggle__sun {
  display: none;
}

html[data-theme="light"] .theme-toggle__moon {
  display: block;
}

.header__menu-theme {
  display: none;
}

/* Narrow desktop: tighten the nav so the toggle fits between menu and phone */
@media (min-width: 1101px) and (max-width: 1240px) {
  .header .header__row {
    gap: 14px;
  }

  .header__menu {
    gap: 0;
  }

  .header__menu a {
    padding-left: 8px;
    padding-right: 8px;
  }
}

@media (max-width: 1100px) {
  .header__theme {
    display: none !important;
  }

  .header__menu .header__menu-theme {
    display: block;
    margin-top: 18px;
  }

  .theme-toggle--wide {
    width: auto;
    height: 44px;
    padding: 0 20px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
  }
}

@media (max-width: 1100px) and (max-height: 700px) {
  .header__menu .header__menu-theme {
    margin-top: 12px;
  }
}

/* Smooth cross-fade only while switching, so normal hovers stay snappy */
html.ks-theme-switching,
html.ks-theme-switching *,
html.ks-theme-switching *::before,
html.ks-theme-switching *::after {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease !important;
}

/* =========================================================
   LIGHT THEME
   ========================================================= */
html[data-theme="light"] {
  --ks-bg: #f6f4ef;
  --ks-surface: #ffffff;
  --ks-elevated: #ffffff;
  --ks-border: rgba(20, 20, 24, 0.12);
  --ks-text: #141418;
  --ks-muted: #5c5c64;
  --ks-accent-text: #9a6a00;
  --ks-accent-soft: rgba(240, 180, 41, 0.18);
  --ks-glow: rgba(240, 180, 41, 0.22);
  --ks-glow-soft: rgba(240, 180, 41, 0.1);
  color-scheme: light;
  scrollbar-color: #d9a110 #ebe7de;
}

html[data-theme="light"] body {
  color: var(--ks-text);
}

/* Warm paper background instead of the dark gold glow */
html[data-theme="light"] body::before {
  background:
    radial-gradient(ellipse 90% 70% at 10% 0%, rgba(240, 180, 41, 0.16), transparent 60%),
    radial-gradient(ellipse 80% 60% at 95% 15%, rgba(255, 200, 90, 0.12), transparent 55%),
    radial-gradient(ellipse 85% 65% at 80% 95%, rgba(240, 180, 41, 0.1), transparent 58%),
    #f6f4ef;
}

html[data-theme="light"] body::after {
  opacity: 0.35;
}

html[data-theme="light"] ::-webkit-scrollbar-track,
html[data-theme="light"] ::-webkit-scrollbar-corner {
  background: #ebe7de;
}

html[data-theme="light"] ::-webkit-scrollbar-thumb {
  border-color: #ebe7de;
  box-shadow: none;
}

/* Legacy main.css headings/text are hard-coded white */
html[data-theme="light"] h2,
html[data-theme="light"] h3,
html[data-theme="light"] .ks-section,
html[data-theme="light"] .footer {
  color: var(--ks-text);
}

html[data-theme="light"] .ks-section h2 span,
html[data-theme="light"] .ks-section h3 span {
  color: var(--ks-accent-text);
}

html[data-theme="light"] .ks-eyebrow {
  color: var(--ks-accent-text) !important;
  background: rgba(240, 180, 41, 0.16) !important;
}

/* main.css paints this span with the bright legacy gold */
html[data-theme="light"] .section7__calc-title span {
  color: var(--ks-accent-text) !important;
}

html[data-theme="light"] .ks-timeline .section3__list-number.last {
  color: #141418 !important;
}

/* Calculator range sliders (base styles are inline in index.html) */
html[data-theme="light"] .irs-line {
  background: #ece8df !important;
  border-color: #ece8df !important;
  box-shadow: inset 0 1px 2px rgba(20, 20, 24, 0.08) !important;
}

html[data-theme="light"] .irs-handle {
  background: #ffffff !important;
  box-shadow: 0 2px 6px rgba(154, 106, 0, 0.22), 0 0 0 1px rgba(154, 106, 0, 0.08) !important;
}

html[data-theme="light"] .irs-bar {
  background: linear-gradient(90deg, #f7cd5c 0%, #f0b429 100%) !important;
  border-color: transparent !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45) !important;
}

/* ---------- Header ---------- */
html[data-theme="light"] .header::before {
  background: rgba(255, 255, 255, 0.82);
}

html[data-theme="light"] .header.is-scrolled::before {
  background: rgba(255, 255, 255, 0.94);
}

html[data-theme="light"] .header {
  border-bottom-color: rgba(20, 20, 24, 0.08) !important;
}

html[data-theme="light"] .header.is-scrolled {
  box-shadow: 0 10px 30px rgba(60, 45, 10, 0.1) !important;
}

html[data-theme="light"] .header__phone span a {
  color: var(--ks-text);
}

html[data-theme="light"] .header__menu a {
  color: rgba(20, 20, 24, 0.72);
}

html[data-theme="light"] .header__menu a:hover,
html[data-theme="light"] .header__menu a.is-active {
  color: var(--ks-text);
}

html[data-theme="light"] .header__burger-line,
html[data-theme="light"] .header__burger-line::before,
html[data-theme="light"] .header__burger-line::after {
  background: var(--ks-text);
}

html[data-theme="light"] .header.is-menu-open .header__burger-line {
  background: transparent;
}

@media (max-width: 1100px) {
  html[data-theme="light"] .header__nav {
    background: rgba(250, 248, 244, 0.97);
  }

  html[data-theme="light"] .header__menu a {
    color: rgba(20, 20, 24, 0.85);
  }

  html[data-theme="light"] .header__menu a:hover,
  html[data-theme="light"] .header__menu a.is-active {
    color: var(--ks-accent-text);
  }

  html[data-theme="light"] .header__menu-phone a {
    color: var(--ks-text);
  }

  html[data-theme="light"] .header__nav-close-x::before,
  html[data-theme="light"] .header__nav-close-x::after {
    background: var(--ks-text);
  }
}

/* ---------- Floating director widget ---------- */
html[data-theme="light"] .floating-consult {
  background: linear-gradient(165deg, #fffaf0 0%, #ffffff 60%) !important;
  border-color: rgba(240, 180, 41, 0.35) !important;
  color: var(--ks-text) !important;
  box-shadow: 0 18px 40px rgba(60, 45, 10, 0.16), 0 0 0 1px rgba(20, 20, 24, 0.04) !important;
}

html[data-theme="light"] .floating-consult.is-collapsed {
  background: none !important;
  box-shadow: none !important;
}

html[data-theme="light"] .floating-consult__name {
  color: var(--ks-text) !important;
}

html[data-theme="light"] .floating-consult__subtitle {
  color: rgba(20, 20, 24, 0.55) !important;
}

html[data-theme="light"] .floating-consult__close {
  background: rgba(20, 20, 24, 0.06) !important;
  color: rgba(20, 20, 24, 0.55) !important;
}

html[data-theme="light"] .floating-consult__link {
  color: var(--ks-accent-text) !important;
}

html[data-theme="light"] .floating-consult__bubble::after {
  border-color: #ffffff;
}

/* City check: dark phones photo sits behind the heading on desktop */
@media (min-width: 801px) {
  html[data-theme="light"] .section8-image {
    opacity: 0.16;
  }
}

html[data-theme="light"] .ks-slider-dots button {
  background: rgba(20, 20, 24, 0.18);
}

html[data-theme="light"] .ks-to-top {
  border-color: rgba(154, 106, 0, 0.3);
  background: rgba(255, 255, 255, 0.92);
  color: #9a6a00;
  box-shadow: 0 8px 24px rgba(60, 45, 10, 0.14);
}

html[data-theme="light"] .ks-to-top:hover {
  border-color: var(--ks-accent);
  background: var(--ks-accent);
  color: #111;
}

html[data-theme="light"] .ks-slider-dots button.is-active {
  background: var(--ks-accent);
}
