/* Webflow Design for Quixo: the dark theme (27 Nov 2026, owner decision "Build a Webflow dark theme").
 * Loaded right after webflow.css on every page. Light stays the default and is not touched: EVERY rule here is scoped under
 * html[data-theme="dark"] (set by public/assets/js/theme.js from localStorage 'qm-theme'). Tokens only: the dark values live in
 * public/brand/tokens/quixo-tokens.css (html[data-theme="dark"] block); no colour literals (scripts/check-brand.mjs).
 *
 * Look: near-black page with a faint dot grid, raised dark cards at the same radius with hairline borders, light ink plus a muted
 * grey that passes AA on the cards, black 3D buttons become light, the periwinkle -> indigo gradients stay (white type on indigo),
 * ink text on cyan (never white), the Q emblem flips to the light version, official customer and partner marks keep a light tile.
 * It also replaces the older html:not([data-theme="light"]) remap of site.css for the names it re-points. */

/* ------------------------------------------------------------------ ground, legacy names, derived variables */

html[data-theme="dark"] { color-scheme: dark; background-color: var(--q-page); }
html[data-theme="dark"] body {
  /* legacy names (site.css remaps these on body with the old stage values; restated here from the Webflow dark tokens) */
  --q-ground: var(--q-dark-page);
  --q-white: var(--q-dark-surface);
  --q-tile: var(--q-dark-surface);
  --q-pale: var(--q-dark-surface-muted);
  --q-black: var(--q-dark-ink);
  --q-ink: var(--q-dark-ink);
  --q-navy: var(--q-dark-ink);
  --q-ink-deep: var(--q-dark-ink-body);
  --q-ink-mid: var(--q-dark-ink-muted);
  --q-ink-mute: var(--q-dark-ink-muted);
  --q-gray: var(--q-dark-ink-muted);
  --q-hairline: var(--q-dark-hairline);
  --q-grid: var(--q-dark-hairline);
  --q-accent-ink: var(--q-dark-blue);
  --q-hue-deep: var(--q-dark-blue);
  --q-accent-soft: var(--q-dark-blue-wash);
  --q-hue-wash: var(--q-dark-blue-wash);
  --q-sky: var(--q-dark-sky);
  --q-peach: var(--q-dark-peach);
  --q-mint: var(--q-dark-mint);
  --q-butter: var(--q-dark-butter);

  --ground: var(--q-ground);
  --ink: var(--q-ink);
  --accent: var(--q-accent);
  --accent-ink: var(--q-accent-ink);
  --accent-fill: var(--q-accent-light);
  --grid: var(--q-grid);
  --muted: var(--q-ink-mid);
  --text-main: var(--ink);
  --text-muted: var(--muted);
  --rule: 1px solid var(--grid);
  --rule-ink: 1px solid var(--ink);
  --v3-ink: var(--q-ink);
  --v3-ink-mid: var(--q-ink-mid);
  --v3-ink-mute: var(--q-ink-mute);
  --v3-line: var(--q-hairline);
  --v3-ground: var(--q-surface);
  --v3-accent: var(--q-accent);
  --v3-accent-ink: var(--q-accent-ink);
  --v3-accent-wash: var(--q-hue-wash);
  --v3-pale: var(--q-pale);

  --wf-card: var(--q-surface);
  --wf-card-soft: var(--q-surface-muted);
  --wf-text: var(--q-dark-ink);
  --wf-body: var(--q-dark-ink-body);
  --wf-muted: var(--q-dark-ink-muted);
  --wf-line: var(--q-dark-hairline);
  --wf-page: var(--q-dark-page);
  --wf-blue: var(--q-dark-blue);

  background-color: var(--q-dark-page);
  background-image: radial-gradient(var(--q-dot) 1px, transparent 1.3px);
  color: var(--q-dark-ink-body);
}

/* Home page tokens (home.css derives --hs-* from the captured light values, so they are restated here). */
html[data-theme="dark"] .site-home {
  --hs-ink: var(--q-dark-ink);
  --hs-white: var(--q-dark-surface);
  --hs-grey: var(--q-dark-ink-muted);
  --hs-mute: var(--q-dark-ink-muted);
  --hs-line: var(--q-dark-hairline);
  --hs-page: var(--q-dark-page);
  --hs-shadow: var(--q-dark-page);
}

/* ------------------------------------------------------------------ brand marks */

/* The Q emblem is the black file; inverted it is the light emblem (q-emblem-white.svg). The lockup is inverted too. */
html[data-theme="dark"] :is(.brand, .foot-brand) img[src*="/brand/emblem/q-emblem-black"] { filter: invert(1); }
html[data-theme="dark"] img[src^="/brand/lockup/"] { filter: invert(1) hue-rotate(180deg); }
/* Official customer and partner marks keep their own colours, on a light tile. */
html[data-theme="dark"] :is(.logos li, .logos li > a, .logos li:not(:has(> a))) { background: var(--q-dark-logo-tile); border-color: var(--q-dark-hairline); }

/* ------------------------------------------------------------------ page chrome */

html[data-theme="dark"] body { background-image: radial-gradient(var(--q-dot) 1px, transparent 1.3px); }
html[data-theme="dark"] .site-head .nav { background: var(--q-dark-surface); border-color: var(--q-dark-hairline); box-shadow: var(--q-dark-shadow-float); }
html[data-theme="dark"] :is(.lang-switch, .sign-in, .theme-toggle) { color: var(--q-dark-ink); background: transparent; }
html[data-theme="dark"] :is(.lang-switch, .sign-in, .theme-toggle):hover { background: var(--q-dark-surface-muted); color: var(--q-dark-ink); }
html[data-theme="dark"] ::selection { background: var(--q-accent); color: var(--q-on-accent); }
html[data-theme="dark"] body[data-page][data-page] main > :is(section, .section, .h-section, .h-hero, .v3-band) { background: var(--q-dark-surface) !important; color: var(--q-dark-ink-body); }
html[data-theme="dark"] .hero-block, html[data-theme="dark"] main.hero {
  background: var(--q-dark-surface) radial-gradient(60% 80% at 100% 0%, color-mix(in srgb, var(--q-dark-hero-glow) 45%, transparent), transparent 70%);
}
html[data-theme="dark"] .site-foot, html[data-theme="dark"] body > footer.foot { background: var(--q-dark-surface); color: var(--q-dark-ink-body); }
html[data-theme="dark"] .site-foot a { color: var(--q-dark-ink-body); }
html[data-theme="dark"] .site-foot a:hover { color: var(--q-dark-ink); }
html[data-theme="dark"] .site-foot :is(.foot-label, .foot-powered, .qx-label) { color: var(--q-dark-ink); }
html[data-theme="dark"] .site-foot .foot-powered { color: var(--q-dark-ink-muted); }

/* ------------------------------------------------------------------ type */

html[data-theme="dark"] :where(h1, h2, h3, h4, h5, h6) { color: var(--q-dark-ink); }
html[data-theme="dark"] body main :is(h2, h3, .section h2, .section h3, .h-head h2) { color: var(--q-dark-ink); }
html[data-theme="dark"] body main :is(h1, .hs-hero h1, .hero-block h1) { background: var(--q-gradient-hero-text); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
html[data-theme="dark"] :is(.lede, .section p, .hs-intro p) { color: var(--q-dark-ink-body); }
html[data-theme="dark"] :is(.muted, .note, .hs-note, .h-sub) { color: var(--q-dark-ink-muted); }
html[data-theme="dark"] :focus-visible, html[data-theme="dark"] main :focus-visible { outline-color: var(--q-dark-blue) !important; }

/* ------------------------------------------------------------------ buttons: black 3D pill -> light pill, light pill -> raised dark pill */

html[data-theme="dark"] :is(.cta, .sign-up, .hs-btn.is-black, .qx-btn--primary, button.cta, [class*="-btn"].is-primary),
html[data-theme="dark"] :is(.cta, .sign-up, .hs-btn.is-black, .qx-btn--primary):hover {
  background: var(--q-dark-button); color: var(--q-on-accent) !important; box-shadow: var(--q-dark-shadow-button);
}
html[data-theme="dark"] .cta::after, html[data-theme="dark"] .hs-btn .hs-arrow, html[data-theme="dark"] .cta:hover::after { background: var(--q-accent); color: var(--q-on-accent); }
html[data-theme="dark"] :is(.cta-ghost, .hs-btn.is-white, .qx-btn--outline, .cta.is-light),
html[data-theme="dark"] :is(.cta-ghost, .hs-btn.is-white, .qx-btn--outline):hover {
  background: var(--q-dark-surface-muted); color: var(--q-dark-ink) !important; box-shadow: var(--q-dark-shadow-button-ghost);
}
html[data-theme="dark"] .eyebrow, html[data-theme="dark"] :is(.hs-kicker, .hs-label, .section-kicker) {
  background: color-mix(in srgb, var(--q-dark-surface-muted) 60%, transparent); border-color: var(--q-dark-hairline); color: var(--q-dark-ink); box-shadow: var(--q-shadow-eyebrow);
}
html[data-theme="dark"] body :is(.qx-faq summary::after, main summary::after) { background: var(--q-dark-button) !important; color: var(--q-on-accent) !important; box-shadow: none !important; }

/* ------------------------------------------------------------------ cards, panels, forms, tables */

html[data-theme="dark"] :is(.card, .panel, .tier-card, .report-card, .hs-card, .hp-panel, .hp-win, .faq-item, details.faq, .free-score-result, .free-score-form, .chips li, .dim) {
  background: var(--q-dark-surface-muted); border-color: var(--q-dark-hairline); color: var(--q-dark-ink-body);
}
html[data-theme="dark"] .dim.is-high { background: var(--q-accent); color: var(--q-on-accent); }
html[data-theme="dark"] :is(.card h3, .panel h3, .tier-card h3, .tier-price, .stats .num, .num) { color: var(--q-dark-ink); }
html[data-theme="dark"] :is(.card p, .tier-card p) { color: var(--q-dark-ink-body); }
html[data-theme="dark"] .card:hover { box-shadow: var(--q-dark-shadow-float); }
html[data-theme="dark"] .split > .panel:first-child { background: var(--q-dark-surface-muted); border-color: var(--q-dark-hairline); }
html[data-theme="dark"] :is(.stats li, .steps li) { border-color: var(--q-dark-hairline); }
html[data-theme="dark"] .badge { background: var(--q-dark-surface-muted); color: var(--q-dark-ink); border-color: var(--q-dark-hairline); }
html[data-theme="dark"] .badge[data-status="operational"] { background: var(--q-accent); color: var(--q-on-accent); }
html[data-theme="dark"] .badge[data-status="degraded"] { background: var(--q-dark-surface); }
html[data-theme="dark"] :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) { background: var(--q-dark-surface-muted); color: var(--q-dark-ink); border-color: var(--q-dark-hairline); }
html[data-theme="dark"] :is(label, .free-score-form label) { color: var(--q-dark-ink); }
html[data-theme="dark"] :is(.faq details, details.faq-item, main details) { background: var(--q-dark-surface-muted); border-color: var(--q-dark-hairline); }
html[data-theme="dark"] main details[open] { border-color: var(--q-dark-ink-strong-border); }
html[data-theme="dark"] main summary { color: var(--q-dark-ink); }
html[data-theme="dark"] .hs-tabs { background: var(--q-dark-surface-muted); }
html[data-theme="dark"] .hs-tab { color: var(--q-dark-ink); }
html[data-theme="dark"] .hs-tab.is-on { background: var(--q-dark-surface); }
html[data-theme="dark"] :is(.hs-marq-run, .hs-marq-run span) { color: var(--q-dark-ticker) !important; -webkit-text-fill-color: var(--q-dark-ticker); }
html[data-theme="dark"] .hs-star { color: var(--q-dark-ticker); }
html[data-theme="dark"] .hs-frame, html[data-theme="dark"] .hs-stage { border-color: var(--q-dark-hairline); }
html[data-theme="dark"] :is(td, th) { color: var(--q-dark-ink-body); border-color: var(--q-dark-hairline); }
html[data-theme="dark"] :is(th[scope="row"], thead th) { color: var(--q-dark-ink); }

/* ------------------------------------------------------------------ gradient islands: the periwinkle -> indigo gradients stay, white type, light buttons */

html[data-theme="dark"] body[data-page][data-page] main > :is(section, .section):is(.qx-close, .qx-close-band, .is-dark, .hs-closer, .h-agents),
html[data-theme="dark"] body[data-page] :is(.hs-cta, .h-contact-card, .qx-close) { background: var(--q-gradient-cta) !important; color: var(--q-on-button-dark); }
html[data-theme="dark"] :is(.cta, .hs-btn.is-black, .hs-btn.is-white, .cta-ghost) { --q-island-btn: var(--q-dark-button); }
html[data-theme="dark"] :is(.qx-close, .qx-close-band, .h-contact-card, .hs-cta, .hs-closer, .hs-band, .foot-audit, .tier-card:is(.is-featured, .is-primary)) :is(.cta, .cta-ghost, .hs-btn.is-black, .hs-btn.is-white, .qx-btn--primary, .qx-btn--outline) {
  background: var(--q-dark-button) !important; color: var(--q-on-accent) !important; box-shadow: var(--q-shadow-button-light);
}
html[data-theme="dark"] .tier-card:is(.is-featured, .is-primary) .badge { background: var(--q-dark-button); color: var(--q-on-accent); }
html[data-theme="dark"] .tier-card.is-featured .badge { background: var(--q-dark-button); color: var(--q-on-accent); }
html[data-theme="dark"] .foot-audit :is(p, .foot-audit-title) { color: var(--q-on-button-dark); }

/* Reduced motion: colour changes on the home story steps and rows are instant, so a state change never passes through a low-contrast mid-fade. */
@media (prefers-reduced-motion: reduce) {
  html[data-theme="dark"] .site-home :is(.hp-n, .hp-it, .hp-step, .hp-body-t, .hp-tag, .hp-plan em, .hp-aq em) { transition: none !important; }
}

/* Home story steps: the inactive steps were dimmed with opacity (0.45 / 0.6), which on the dark card drops their type below AA.
 * They stay at full opacity and read as inactive through the muted grey and the unfilled number disc. */
html[data-theme="dark"] .site-home .hp-step, html[data-theme="dark"] .site-home .hp-step:not(.is-on) { opacity: 1; }
html[data-theme="dark"] .site-home .hp-step:not(.is-on) :is(.hp-t, .hp-copy > :first-child) { color: var(--q-dark-ink-body); }
