/* Appearance palettes. Existing token names remain stable; --white is the foreground role. */
:root {
  color-scheme: dark;
  --ink: #0a0a0a;
  --ink-2: #121212;
  --ink-3: #161616;
  --white: #fff;
  --grey: #9aa0a6;
  --grey-dim: #7f8489;
  --grey-light: #c6cace;
  --ink-4: #1b1b1b;
  --ink-plate: #0e0e0e;
  --line-strong: rgba(255,255,255,.16);
  --accent: #208bf4;
  --line: rgba(255,255,255,.09);
  --button-ink: #111;
  --button-hover: #e6e6e6;
  --button-border: rgba(255,255,255,.28);
  --subtle-fill: rgba(255,255,255,.06);
  --header-surface: rgba(10,10,10,.78);
  --nav-ink: #d2d3d4;
  --footer-surface: #090909;
  --intro-ink: #c5c9cc;
  --selected-surface: #202326;
  --dealer-glow: #14171a;
  --search-surface: rgba(10,10,10,.7);
  --toolbar-surface: rgba(10,10,10,.92);
  --form-surface: rgba(10,10,10,.75);
  --form-card-border: rgba(255,255,255,.15);
  --field-border: rgba(255,255,255,.22);
  --field-surface: rgba(10,10,10,.8);
  --placeholder: #94999e;
  --required: #389dfb;
  --field-hover: rgba(255,255,255,.45);
  --error-surface: #261616;
  --error-border: #ffb4ad;
  --error-ink: #ffcbc6;
  --form-muted: #b2b7bb;
  --logo-surface: transparent;
}

:root[data-color-scheme="light"] {
  color-scheme: light;
  --ink: #fff;
  --ink-2: #f3f5f6;
  --ink-3: #e9edf0;
  --white: #18222b;
  --grey: #4e5964;
  --grey-dim: #57626c;
  --grey-light: #394550;
  --ink-4: #dce2e7;
  --ink-plate: #e9edf0;
  --line-strong: #77838e;
  --accent: #0768c4;
  --line: #cbd2d8;
  --button-ink: #fff;
  --button-hover: #303c47;
  --button-border: #77838e;
  --subtle-fill: rgba(24,34,43,.06);
  --header-surface: rgba(255,255,255,.96);
  --nav-ink: #394550;
  --footer-surface: #f3f5f6;
  --intro-ink: #394550;
  --selected-surface: #dce5ed;
  --dealer-glow: #e9edf0;
  --search-surface: #fff;
  --toolbar-surface: rgba(255,255,255,.96);
  --form-surface: #f3f5f6;
  --form-card-border: #77838e;
  --field-border: #77838e;
  --field-surface: #fff;
  --placeholder: #57626c;
  --required: #0768c4;
  --field-hover: #394550;
  --error-surface: #fff0ef;
  --error-border: #a32119;
  --error-ink: #8c1d16;
  --form-muted: #4e5964;
  --logo-filter: brightness(0);
}

/* No JS (or blocked bootstrap): follow OS only when no resolved preference exists. */
@media (prefers-color-scheme: light) {
  :root:not([data-color-scheme]) {
  color-scheme: light;
  --ink: #fff;
  --ink-2: #f3f5f6;
  --ink-3: #e9edf0;
  --white: #18222b;
  --grey: #4e5964;
  --grey-dim: #57626c;
  --grey-light: #394550;
  --ink-4: #dce2e7;
  --ink-plate: #e9edf0;
  --line-strong: #77838e;
  --accent: #0768c4;
  --line: #cbd2d8;
  --button-ink: #fff;
  --button-hover: #303c47;
  --button-border: #77838e;
  --subtle-fill: rgba(24,34,43,.06);
  --header-surface: rgba(255,255,255,.96);
  --nav-ink: #394550;
  --footer-surface: #f3f5f6;
  --intro-ink: #394550;
  --selected-surface: #dce5ed;
  --dealer-glow: #e9edf0;
  --search-surface: #fff;
  --toolbar-surface: rgba(255,255,255,.96);
  --form-surface: #f3f5f6;
  --form-card-border: #77838e;
  --field-border: #77838e;
  --field-surface: #fff;
  --placeholder: #57626c;
  --required: #0768c4;
  --field-hover: #394550;
  --error-surface: #fff0ef;
  --error-border: #a32119;
  --error-ink: #8c1d16;
  --form-muted: #4e5964;
  --logo-filter: brightness(0);
}
}

/* Intentional dark media/map plates retain their original palette, overlays and imagery. */
:where(.home-hero, .page-hero, .cat-hero, .lineup-card, .series-hero-photo, .series-hero-mark, .cat-model__photo, .editorial-video-stage, .home-quote-copy, .home-quote-phone, .home-quote-motion, .locator-map__frame, .editorial-gallery-grid:not(.editorial-gallery--detail .editorial-gallery-grid) figcaption) {
  color-scheme: dark;
  --ink: #0a0a0a;
  --ink-2: #121212;
  --ink-3: #161616;
  --white: #fff;
  --grey: #9aa0a6;
  --grey-dim: #7f8489;
  --grey-light: #c6cace;
  --ink-4: #1b1b1b;
  --ink-plate: #0e0e0e;
  --line-strong: rgba(255,255,255,.16);
  --accent: #208bf4;
  --line: rgba(255,255,255,.09);
  --button-ink: #111;
  --button-hover: #e6e6e6;
  --button-border: rgba(255,255,255,.28);
  --subtle-fill: rgba(255,255,255,.06);
  --header-surface: rgba(10,10,10,.78);
  --nav-ink: #d2d3d4;
  --footer-surface: #090909;
  --intro-ink: #c5c9cc;
  --selected-surface: #202326;
  --dealer-glow: #14171a;
  --search-surface: rgba(10,10,10,.7);
  --toolbar-surface: rgba(10,10,10,.92);
  --form-surface: rgba(10,10,10,.75);
  --form-card-border: rgba(255,255,255,.15);
  --field-border: rgba(255,255,255,.22);
  --field-surface: rgba(10,10,10,.8);
  --placeholder: #94999e;
  --required: #389dfb;
  --field-hover: rgba(255,255,255,.45);
  --error-surface: #261616;
  --error-border: #ffb4ad;
  --error-ink: #ffcbc6;
  --form-muted: #b2b7bb;
}
:where(.home-hero, .page-hero, .cat-hero, .lineup-card, .series-hero-photo, .series-hero-mark, .cat-model__photo, .editorial-video-stage, .home-quote-copy, .home-quote-phone, .home-quote-motion, .locator-map__frame, .editorial-gallery-grid:not(.editorial-gallery--detail .editorial-gallery-grid) figcaption) { color: var(--white); }

/* Beat global anchor inheritance so photo titles inherit the local dark plate foreground. */
.lineup-grid > a.lineup-card { color: var(--white); }

/* Use the transparent vector mark; only Light needs dark artwork. */
.brand img, .footer-brand img { height: auto; background: var(--logo-surface, transparent); filter: var(--logo-filter, none); }

/* Only the new control and the space it requires alter the existing dark header. */
.appearance-control { display: grid; gap: 1px; flex: none; width: 100px; font-size: 11px; line-height: 1.2; color: var(--grey-light); }
.appearance-control[hidden] { display: none; }
.appearance-control select { width: 100%; min-height: 44px; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: 2px; background: var(--ink-2); color: var(--white); font-size: 14px; cursor: pointer; }
@media (max-width: 1280px) {
  :root[data-appearance-ready] .desktop-nav { display: none; }
  :root[data-appearance-ready] .menu-toggle { display: block; flex: none; }
}
@media (max-width: 760px) {
  /* Dealers has no menu fallback; retain Apply now above the baseline 600px cutoff. */
  :root[data-appearance-ready] .header-quote:not([href="#apply"]) { display: none; }
}
@media (max-width: 600px) {
  :root[data-appearance-ready] .header-inner { gap: 10px; }
  :root[data-appearance-ready] .header-actions { gap: 8px; }
}

/* Disabled controls in Light retain readable text and an explicit inactive surface. */
:root[data-color-scheme="light"] .home-quote-card :is(input, textarea, select, button):disabled {
  background: var(--ink-3)!important; color: var(--grey)!important; cursor: not-allowed;
}
@media (prefers-color-scheme: light) {
  :root:not([data-color-scheme]) .home-quote-card :is(input, textarea, select, button):disabled {
    background: var(--ink-3)!important; color: var(--grey)!important; cursor: not-allowed;
  }
}

/* Same existing Resources chevron, with sufficient contrast on the light control. */
:root[data-color-scheme="light"] .resource-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='14' height='14'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%2357626c' stroke-width='1.8'/%3E%3C/svg%3E"); }
@media (prefers-color-scheme: light) {
  :root:not([data-color-scheme]) .resource-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='14' height='14'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%2357626c' stroke-width='1.8'/%3E%3C/svg%3E"); }
}

/* Small outlined Light/Dark switch; default mode follows the device. */
.appearance-actions { display: flex; align-items: center; justify-content: flex-end; }
.appearance-actions[hidden], .appearance-control [data-appearance-fallback][hidden] { display: none; }
.appearance-toggle { display: inline-flex; align-items: center; justify-content: center; flex: none; gap: 5px; padding: 0; border: 0; background: transparent; color: var(--white); cursor: pointer; }
.appearance-toggle { width: 58px; min-height: 44px; }
.appearance-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 5px; }
.appearance-track { width: 32px; height: 18px; position: relative; flex: none; border: 1px solid currentColor; border-radius: 999px; }
.appearance-track::before { content: ""; position: absolute; top: 3px; left: 3px; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.appearance-toggle[aria-checked="true"] .appearance-track::before { transform: translateX(14px); }
.appearance-toggle[aria-checked="true"] .appearance-sun, .appearance-toggle[aria-checked="false"] .appearance-moon { display: none; }
@media (prefers-reduced-motion: no-preference) { .appearance-track::before { transition: transform .16s ease-out; } }
