/* ============================================================================
   tokens.css - canonical design tokens (design-system, modular refactor).
   Single documented source of truth for color + the radius / shadow / space /
   font scales. Loaded first in <head>.
   TRANSITIONAL: the same color tokens are still ALSO defined inline in
   dashboard.html's first style block; because that inline :root loads AFTER
   this file, it currently WINS (identical values, so no visual change) and
   nothing depends on this file loading for existing tokens. The inline
   duplicates are removed in a later, separately-verified step once this file
   is proven. The NEW scales below are additive and become the vocabulary that
   new / migrated code uses (retiring the ~468 hardcoded #7c5cfc via --brand).
   ============================================================================ */
:root {
  /* ---- surfaces ---- */
  --bg:#f6f4fc; --bg-2:#efeafa; --panel:#ffffff;
  /* The one surface every tool.s result area paints on. Aliased, never a
     literal, so the theme still owns the colour. Change here to change every
     search-result modal at once. */
  --mv-result-surface: var(--panel);
  /* Companions to the surface above. The legacy .mvx wrapper forks the whole
     palette to light-only values and its dark counterpart never matches, so a
     result area that only had its background corrected would go dark while its
     ink stayed dark. These let one rule move surface and ink together. */
  --mv-result-raise: var(--bg-2);
  --mv-result-ink: var(--text);
  --mv-result-ink-2: var(--text-2);
  --mv-result-ink-3: var(--text-3);
  --mv-result-line: var(--border);
  /* The five names the legacy .mvx scopes fork, declared HERE so they resolve
     everywhere instead of only inside a result panel.

     app.css remaps exactly these five on .mvx.mv-results and legacy-mvx.css
     forks them on .mvx, and both still win on specificity wherever they apply,
     so nothing that works today changes. What changes is everywhere else. A
     tool's FORM (the .ci-tech-pair hero cards, .ci-runrow) carries neither
     class, so a bare var(--surface) there was invalid at computed-value time:
     an inherited property silently kept the parent value and a non-inherited
     one fell back to its initial, with no error and no console warning. The
     same wall hit .rcard in mv-aivis.css on free-tools/ai-visibility-checker
     and platform/chatgpt-seo-tools, which load THIS file but not app.css, so a
     fix made in app.css could not have reached them.

     Aliased to the --mv-result-* mirrors rather than to literals, so a form and
     the result panel under it stay the same colour and the theme still owns it.
     One declaration covers both themes: the mirrors are redeclared under
     [data-theme="dark"] and var() resolves against the element it is declared
     on, which is :root either way. */
  --surface: var(--mv-result-surface);
  --surface-hover: var(--mv-result-raise);
  --text-primary: var(--mv-result-ink);
  --text-secondary: var(--mv-result-ink-2);
  --text-tertiary: var(--mv-result-ink-3);
  /* Ink for the result modal icon chip and focus rings. Deliberately NOT
     --brand: brand purple on a dark panel is too dim to read. --purple-bright
     is defined per theme (deeper in light, lighter in dark), so one alias
     carries in both. */
  --mv-result-accent: var(--purple-bright);
  /* Icon-chip fill. Opaque, built on --panel, so the glyph contrast does not
     depend on whatever the chip happens to be layered over. Light mode needs a
     much weaker brand wash than dark: at 22% translucent the glyph measured
     3.20:1 here, against 5.94:1 in dark. */
  --mv-result-chip: color-mix(in srgb, var(--brand) 10%, var(--panel));
  /* ---- text ---- */
  /* muted and muted-soft carry small secondary text on tints, not only on the
     page ground, and the tints are where they failed: --muted measured 4.00 on
     the lavender testimonial card and 4.38 on the URL chip, --muted-soft 3.97
     on plain white. Both darkened 8% (#69618a -> #60597f, #837b9e -> #797192).
     That also lifts the free-tools footer labels, which sat at 4.85 and were
     the next thing to fail. Dark mode re-declares both, so this is light only. */
  --text:#1a1430; --text-2:#3a3358; --text-3:#5d557e; --muted:#60597f; --muted-soft:#797192;
  /* ---- accents (semantic) ---- */
  /* Light-mode accents. These three are darkened a hair from the original
     brand values so that small text and white-on-fill both clear WCAG AA 4.5:1.
     purple #7c5cfc -> #7a5af7 (2%), purple-bright #6d4ef0 -> #694be6 (4%),
     magenta #c0379a -> #bc3697 (2%). Dark mode re-declares all four below, so
     this changes light mode only.

     Second pass: the first one measured magenta against white and stopped
     there, but it also sets small text on pale tints - the pull-quote on the
     blue card came to 4.41 and the annualized-impact label on lavender to 4.48.
     magenta darkened a further 2% (#bc3697 -> #b83594) and magenta-bright 3%
     (#cf3f9b -> #c93d97, which was 4.34 on white). Both are small enough to be
     the same brand colour; darkening the accent was chosen over lightening the
     cards so the brand reads unchanged. */
  --purple:#7a5af7; --purple-bright:#694be6; --magenta:#b83594; --magenta-bright:#c93d97;
  /* Purple as TEXT. --purple is both a foreground and a fill - it backs 195
     rules - so it cannot simply be darkened the way --gold was. This is the
     same split --brand/--brand-solid and --gold/--gold-solid already make,
     pointed the other way: the fill keeps the brand value, the text gets a
     value that clears AA on the surfaces the text actually sits on.
     Measured in Chrome on the deployed reports: --purple reaches 4.53 on
     plain white but only 4.20 on a tint of its own hue, which is what the
     result shell puts it on. #664ccf measures 4.66 on the darkest ground the
     reports actually paint it on (#e5dffc, the tier chip over a tinted panel)
     and 6.00 on white. The first attempt, #6a4ed8, was modelled against the
     chip over WHITE and came to 4.41 on the real one - the margin matters,
     which is the same lesson --gold just taught. */
  --purple-text:#634ac9;
  /* Foreground half of the magenta split, same idea as --purple-text: --magenta
     is a fill and stays one. Measured live on the homepage bridge-stat, whose
     panel is a pale cyan tint: --magenta read 4.25 at 10.5px and 4.25 at 16px,
     and --magenta-bright read 4.23 on the comparison row. This clears 4.6 on
     every ground those three rules actually paint on, and holds the brand hue
     (316 deg, unchanged). Only small text uses it; the 132px figure beside it
     needs 3:1 and keeps --magenta. */
  --magenta-text:#af328d;
  /* green and gold are the two that carry small text on a tint of their own
     hue (status pills, the SAVE badge, "Contact sales"). Both sat under AA
     there, so both are darkened here: green 7% (#0a7d55 -> #09744f), gold 16%
     (#b07d0a -> #946908). Dark mode re-declares both, so this is light only.

     gold needed a second pass, and only a browser could show why. The pill it
     has to clear is "Contact sales": gold on rgba(230,179,71,0.13) over the
     --card gradient, which runs #ffffff -> #faf8ff. The tint was measured
     against the TOP of that gradient, where it reaches 4.52 and passes. The
     badge does not sit at the top. Over the card's lower end the same pill
     composites to #f7efe7 and #946908 falls to 4.31, so the real pill on
     index and pricing measured 4.48 in Chrome - under AA, while a check that
     samples one gradient stop calls it clear. A further 4% (#946908 ->
     #8e6508) puts the worst end of the card at 4.61 and plain white at 5.3.

     green needed a second pass for the same reason magenta did: measured on its
     own pale tint it passed, but the homepage sets it on two grounds that are
     not its own hue - the "Early customer" badge on a blue card (3.63) and the
     "Live data" pill on teal (4.23). A further 14% (#09744f -> #086344) clears
     both. It is the largest move here because those grounds are the darkest of
     any that carry small text. */
  /* green-bright and red were the last two semantic colours still under AA as
     text in light. Measured in Chrome against the three grounds they land on -
     --bg, --bg-2 and a white panel - the old values were 3.18/2.94/3.47 and
     4.01/3.71/4.37, so both failed on all three. Ten percent darker in HSL,
     hue and saturation untouched, puts the worst of the three at 5.33 and 4.98.

     Eight percent was enough to cross 4.5, and is not taken: it leaves 0.15 on
     --bg-2, which is the margin that disappears the next time a background is
     nudged. Dark is unchanged and was never the problem - green-bright is
     11.8:1 there.

     green-bright now sits close to green in light, which is the honest outcome:
     a "bright" green cannot carry 9px text on a pale ground. It stays distinct
     where it was meant to, in dark. */
  --cyan:#0e7490; --cyan-bright:#0aa6c9; --gold:#855f08; --green:#086344; --green-bright:#0b6e4b; --amber:#9a5b06; --red:#b32139;
  /* A green dark enough to carry WHITE text on a SOLID fill in both themes.
     --green is the accent (bright #14b87f in dark, so green TEXT reads on a
     dark panel), and white-on-that is 2.56:1 - fine for a glyph, not for a
     filled badge. The VERIFIED / state pill fills with this instead:
     white-on-#086344 is 7.30:1. One shade for both themes on purpose. */
  --green-solid:#086344;
  /* And the same for gold, for the same reason and in the same shape. --gold is
     the accent and is bright in dark mode, so white on it is 1.93:1 - the
     AI-ESTIMATED and VERIFIED + AI pills were filling with exactly that. White
     on this is 4.90:1.

     It is the LIGHT theme's own --gold reused, not a fresh mix: that value is
     already the darkest gold the palette carries, it was chosen for white-ish
     text on a tint, and one shade for both themes is what --green-solid does.

     This is for a SOLID fill under white text only. The app's other gold pill
     puts dark text on the amber accent and already clears 7:1, so it must keep
     using --amber and must not be moved onto this. */
  --gold-solid:#946908;
  /* Wash behind a status pill. --border is a purple tint, so green text on it
     came to 3.46:1; a tint of the pill's own hue reaches 4.69. */
  --green-tint:#ebf7f2;
  /* ---- lines ---- */
  --border:rgba(124,92,252,0.20); --border-strong:rgba(26,20,48,0.12); --hairline:rgba(26,20,48,0.08);
  --card:linear-gradient(180deg,#ffffff,#faf8ff);

  /* ===== NEW canonical primitives (additive) ===== */
  /* brand: the single knob for the product accent; retires hardcoded #7c5cfc */
  /* #7c5cfc gave white-on-brand 4.38:1, just under WCAG AA. Darkened 2% to
     #7a5af7, which clears 4.5 and is not a perceptible change in the colour.
     Not re-declared per theme: the brand surface is purple in both, so the fix
     has to apply to both. */
  --brand:#7a5af7; --brand-2:#d946a8;
  /* The gradient carries WHITE text in 63 rules across the app, and the brand
     ramp does not clear AA underneath it. Measured in Chrome by painting the
     real ramp and sampling every pixel: white on #7a5af7 -> #d946a8 bottoms out
     at 3.87:1, at the pink end rather than the midpoint.

     BOTH ends had to move. #7a5af7 on its own is 4.53:1, so darkening only the
     pink cannot lift the ramp past about 4.53 whatever value the pink takes -
     the purple end becomes the floor. These two are the same hues 10% darker in
     HSL, hue and saturation untouched, which puts the WORST point of the ramp
     at 5.17:1 at both angles in use, 135deg and 100deg. The margin is the
     point: sitting at 4.50 exactly, any later nudge to either end drops the
     whole app under AA with nothing to say so.

     --brand and --brand-2 keep their values and are not deprecated. They are
     the brand colours for cases where the hue is the FOREGROUND - pink text,
     the About page caret, the gradient-clipped headline - and those are legible
     already. This pair is only for a fill with white on top, which is the same
     split --green-solid and --gold-solid make. */
  --brand-solid:#5329f5; --brand-2-solid:#c42890;
  --gradient:linear-gradient(135deg, var(--brand-solid), var(--brand-2-solid));
  /* Foreground for anything sitting ON a brand-coloured surface (gradient/purple
     buttons, badges). Deliberately NOT re-declared under [data-theme="light"]:
     the brand surface stays purple in both themes, so its text must stay light.
     Using --text there turns the label near-black on purple in light mode. */
  --on-brand:#ffffff;
  /* Backdrop behind modals/overlays. Stays dark in both themes (its job is to
     dim the page), but lighter in light mode so it doesn't feel oppressive. */
  --mv-scrim:rgba(26,20,48,0.38);
  /* radius scale */
  --radius-xs:6px; --radius-sm:9px; --radius:12px; --radius-lg:16px; --radius-xl:20px; --radius-pill:999px;
  /* elevation scale (dark) */
  --shadow-sm:0 1px 2px rgba(26,20,48,0.06);
  --shadow-md:0 8px 24px rgba(26,20,48,0.10);
  --shadow-lg:0 18px 40px -14px rgba(26,20,48,0.16);
  /* spacing scale */
  --space-1:4px; --space-2:8px; --space-3:12px; --space-4:16px; --space-5:20px; --space-6:24px; --space-8:32px; --space-10:40px;
  /* typography */
  --font:'Inter','Inter Tight',system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
  --font-heading:'Inter Tight','Inter',system-ui,sans-serif;
  --font-mono:ui-monospace,'SF Mono',Menlo,Consolas,monospace;
}

/* Dark theme. Light is the default in :root above; dark is opt-in, set by
   the boot script from localStorage key "mv-theme". Only the variables that
   actually differ are redeclared — radius, spacing and type are shared. */
[data-theme="dark"]{
  --bg:#05020e;
  --bg-2:#0a0420;
  --panel:#0c0622;
  /* The one surface every tool.s result area paints on. Aliased, never a
     literal, so the theme still owns the colour. Change here to change every
     search-result modal at once. */
  --mv-result-surface: var(--panel);
  /* Companions to the surface above. The legacy .mvx wrapper forks the whole
     palette to light-only values and its dark counterpart never matches, so a
     result area that only had its background corrected would go dark while its
     ink stayed dark. These let one rule move surface and ink together. */
  --mv-result-raise: var(--bg-2);
  --mv-result-ink: var(--text);
  --mv-result-ink-2: var(--text-2);
  --mv-result-ink-3: var(--text-3);
  --mv-result-line: var(--border);
  /* Ink for the result modal icon chip and focus rings. Deliberately NOT
     --brand: brand purple on a dark panel is too dim to read. --purple-bright
     is defined per theme (deeper in light, lighter in dark), so one alias
     carries in both. */
  --mv-result-accent: var(--purple-bright);
  --mv-result-chip: color-mix(in srgb, var(--brand) 26%, var(--panel));
  --text:#f9f6ff;
  --text-2:#d6cfee;
  --text-3:#ada3ce;
  --muted:#9689ba;
  /* #6e6892 measured 3.71 on the card gradient's top stop (rgb(16,13,25)) and
     3.97 on --bg itself, so the CARD is the worst case here, not the page
     ground. Lifted ~15% to #7e78a7 -> 4.69 / 5.02. The light block re-declares
     this above and is already clear, so this is dark-only. Same operation the
     light palette recorded for the same two elements, in the other direction. */
  --muted-soft:#7e78a7;
  /* Folded into --brand. The old value gave white-on-brand 4.38:1, and this
     block was the last place in THIS file still holding it: :root has read
     #7a5af7 since the --brand change, so light passed the contrast audit while
     dark failed on the same 20 buttons. app.css forks this whole palette for
     the dashboard, admin and reports/, wins the cascade there, and was brought
     to the same value in the same commit. legacy-mvx.css still declares the old
     one twice; it is .mvx-scoped and under rule 6 it may only shrink, so it was
     left alone rather than half-edited. Purple TEXT on a dark panel does not
     use this - see the note above --mv-result-accent; it uses --purple-bright,
     which is why several call sites moved in the same commit. */
  --purple:#7a5af7;
  --purple-bright:#b09cff;
  /* Dark needs the opposite move. #7c5cfc clears 4.69 on the page ground but
     only 3.69 on a raised panel, and panels are where results render.
     #9770ff is 4.69 on the darkest panel the reports use. */
  --purple-text:#9770ff;
  /* Dark half. --magenta here is the lighter brand value and still failed as
     text: 3.85 at 16px and 4.06 at 10.5px on the dark cyan-tinted panel. This
     is that value mixed 15% toward white, the smallest step that clears 4.6,
     hue preserved at 320 deg. */
  --magenta-text:#df62b5;
  --magenta:#d946a8;
  --magenta-bright:#f472b6;
  --cyan:#06d6f5;
  --cyan-bright:#67e8f9;
  --gold:#e6b347;
  --green:#14b87f;
  --green-tint:rgba(20,184,127,0.14);
  --green-bright:#4ade80;
  --amber:#f59e0b;
  --red:#f56565;
  --border:rgba(124,92,252,0.14);
  --border-strong:rgba(255,255,255,0.10);
  --hairline:rgba(255,255,255,0.06);
  --card:linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.012));
  --mv-scrim:rgba(5,2,14,0.66);
  --shadow-sm:0 1px 2px rgba(0,0,0,0.30);
  --shadow-md:0 8px 24px rgba(0,0,0,0.30);
  --shadow-lg:0 18px 40px -12px rgba(0,0,0,0.55);
}

/* Reduced motion, everywhere this file loads (UXP-16, November 2026 audit).
   Support was added component by component: app.css had 14 rules for 22
   animations, the dashboard's inline styles 4 for 55, and legacy-mvx.css none
   for its 32 animations and 167 transitions. Someone who has asked their
   system for less motion now gets it on every page. Animations run once, at
   once, so a spinner rests in a static state rather than vanishing. This is
   the one rule in this file that is not a token; it lives here because this
   is the stylesheet the site and the app both load. The help portal has its
   own in kb.css. */
@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;
  }
}
