/*
 * themes/public.css. The public marketing site's accent, and the one mount in the suite that
 * ships TWO palettes. Both are first class and both were solved the same way.
 *
 * Entry [213], on the owner's ruling of 2026-09-10: "solve every value for light at the same
 * floors, the same way you solved dark: keep the plum and magenta hues, move lightness." The
 * floors are docs/design.md's: 4.5 for text, 3.0 for an edge that must be perceivable.
 *
 * ## THE METHOD, ONCE, BECAUSE IT IS THE SAME METHOD TWICE
 *
 * Entry [207] measured the v2 mockup's ramp, found ONE failure (its muted text at 4.39 against a
 * 4.5 floor, a miss of 0.11), and replaced the whole palette with a derivation at the suite navy's
 * hue. The owner reversed that on 2026-09-10 and the lesson is in the method: `--ai` had already
 * been handled correctly in that same entry, by holding its hue and solving its lightness until
 * it cleared. A failing VALUE is not a failing HUE.
 *
 * So light holds the same hues dark holds, plum 280 to 282 for the grounds, rose 311 to 317 for
 * the ink, magenta 319 for the brand, and moves lightness until every pair clears. It is a plum
 * tinted light and NOT the suite's navy default, which is the other thing that ruling says.
 *
 * ## WHAT LIGHT STATES, AND WHAT IT DELIBERATELY DOES NOT
 *
 * Light states fourteen values: six grounds, three inks, five brand. It states NO semantic value
 * at all, so every tag, lamp, meter and verdict on this mount in light mode renders the suite's
 * own colour, byte for byte, exactly as it does on the thirteen control panels and the hub.
 *
 * That is a decision and not an omission. The suite's light semantics carry a known defect,
 * `--success` on `--success-subtle` at 1.99 and five more like it, and it is task 5.139's, ruled
 * on 2026-09-08 as its own row so that a fix to every coloured tag in the estate does not ride in
 * on a marketing page. A value re-solved here would fix one mount and hide the fourteen it does
 * not reach. `public-dark.php` measures those pairs in both modes and asserts, in light, that
 * this theme states neither half of them.
 *
 * Dark states twenty four, and the ten extra are the ones a dark ground genuinely breaks: a near
 * white subtle, a white button label, an indigo at 3.84, and a light grey rest arc.
 *
 * ## THE DARK BLOCK IS WRITTEN TWICE AND THAT IS MECHANICAL
 *
 * There is no way in CSS to say "this selector OR this media condition" in one rule, and the two
 * conditions for dark are exactly that: the system asks for it and nothing overrides, or the
 * reader asked for it. So the block appears under both selectors with identical values, and
 * `public-dark.php` asserts the two are identical rather than trusting them to stay that way.
 *
 * The contract `shared/views/layouts/public.php` documents: an explicit choice stamps
 * `data-theme="light"` or `data-theme="dark"` on <html>, and NO choice stamps nothing, so a
 * reader who never touches the toggle needs no JavaScript and gets their system's answer here.
 *
 * ## NOTHING OUTSIDE .theme-public CHANGES
 *
 * tokens.css is untouched and identical in every app. `tools/check-themes-exceptions.php` names
 * this mount with the reason and `tools/verify/public-dark.php` measures every pair below, twice.
 */

/* LIGHT, the base block, so a browser that resolves neither the media query nor the attribute
   still gets a complete palette rather than the suite navy showing through. */
.theme-public {
  /* The plum ramp at hue 280 to 282, on the suite's own light structure: the card is the
     lightest, the page one step down, and surface-2 and surface-3 recess from there. */
  --ground:    rgb(248 242 251);
  --surface:   rgb(252 248 254);
  --surface-2: rgb(244 237 247);
  --surface-3: rgb(237 228 241);

  /* A hairline is a hairline and the 3.0 floor is not its. --line measures 1.32 on --surface
     here, against 1.23 for the suite's slate on white. The floor belongs to --brand-border. */
  --line:      rgb(226 215 231);
  --line-soft: rgb(239 231 243);

  /*
   * INK at the same rose hues dark uses, on --ground / --surface / --surface-2.
   *
   * --ink-3 IS THE ONE THAT MOVED FAR, and it moved for the reason its dark sibling did. The
   * suite's light --ink-3 is L65 and measures 2.56 on white: below the floor on every screen in
   * the estate. Solved down to L44.5, where the tightest of its three grounds clears.
   */
  --ink:   rgb(42 24 37);      /* 15.20  15.92  14.57 */
  --ink-2: rgb(99 75 93);      /*  7.08   7.42   6.79 */
  --ink-3: rgb(125 102 121);   /*  4.71   4.94   4.52, solved from the suite's L65 at 2.56 */

  /*
   * THE BRAND IS THE SAME MAGENTA AT HUE 319, DARKENED UNTIL THE LABEL READS. --brand-ink is
   * NOT stated here: the suite's white is the label in light mode, so --brand had to be solved
   * against white as well as against the tint it sits on, which is the pair rule 11.1e states.
   *
   * AND THE HOVER DARKENS, WHICH IS THE OPPOSITE OF EVERY OTHER THEME. The suite's navy hover
   * lightens and so does dark's magenta, because both start far from their label. This one sits
   * at 5.05 against white: lightening it by the step dark uses measures 4.25 and the label fails.
   * On a light ground the emphasis has to come from below.
   */
  --brand:        rgb(198 42 148);   /* 4.59 on --ground, white on it 5.05 */
  --brand-hover:  rgb(173 37 129);   /* one step DARKER. White on it 6.25 */
  --brand-subtle: rgb(252 241 248);  /* the grade pill. --brand on it 4.59 */
  --brand-border: rgb(200 111 172);  /* 3.02 on --ground, the darker of the two it meets */
  --brand-accent: rgb(198 42 148);   /* the same magenta: on this mount the accent IS the fill */
}

/* DARK, when the system asks for it and the reader has not overridden it. Entry [211] solved
   these values; entry [213] only moved them into a mode. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-public {
    /* The plum ramp at the v2 mockup's own lightnesses. Nothing reads a ground as text. */
    --ground:    rgb(17 11 20);
    --surface:   rgb(28 19 32);
    --surface-2: rgb(41 30 47);
    --surface-3: rgb(52 38 59);

    /* --line measures 1.41 on --surface here. Same reasoning as the light block above. */
    --line:      rgb(60 44 68);
    --line-soft: rgb(41 30 47);

    /* INK at the mockup's rose hues, on ground / surface / surface-2. */
    --ink:   rgb(246 239 244);   /* 17.17  15.96  14.06, the mockup's own */
    --ink-2: rgb(187 170 183);   /*  8.82   8.21   7.23, the mockup's own */
    --ink-3: rgb(148 132 145);   /*  5.52   5.13   4.52, solved from L51 where it read 3.92 */

    /*
     * THE BRAND IS THE MOCKUP'S MAGENTA AND ON THIS MOUNT IT IS ALSO THE FILL. The suite navy
     * measures 1.20 on this ground, so the primary button's EDGE vanishes. The owner ruled the
     * accent as the fill rather than a lightened navy: a fourteenth brand value invented to serve
     * one button is a value somebody then has to maintain.
     *
     * AND THE LABEL MOVES WITH IT. White on this magenta is 3.43, under the floor, so the label
     * is the ground and the button is a magenta fill with a dark label.
     */
    --brand:        rgb(220 89 178);   /* 5.65 on --ground, 5.26 on --surface */
    /* The action colour AS TEXT on the dark surface, entry [243]: the suite's derived step is the
       blue's darker one and measures 2.72 here. Blue-300 measures 8.9 on --surface. */
    --action-text:  rgb(147 197 253);
    --brand-hover:  rgb(226 118 192);  /* the accent one step lighter. 7.01 with the ink below */
    --brand-ink:    rgb(17 11 20);     /* 5.65 on --brand. White would have been 3.43 */
    --brand-subtle: rgb(51 27 50);     /* the grade pill. --brand on it is 4.55 */
    --brand-border: rgb(170 65 137);   /* 3.29 on --surface, the 3.0 edge floor */
    --brand-accent: rgb(220 89 178);

    /*
     * --ai IS THE ONE SEMANTIC SOLID THAT FAILS HERE, and it is on screen rather than in theory:
     * `lamp.css` colours its label with it and the waiting room renders a lamp in the ai state.
     * The suite's rgb(99 91 255) measures 3.84 on this surface. Solved at its own hue 243 against
     * the surface and against its own tint. --ai-dim is its border sibling and moves with it or
     * the pair is half done. In LIGHT mode neither moves: see the header.
     */
    --ai:     rgb(129 122 255);   /* 5.30 on --surface */
    --ai-dim: rgb(85 77 255);     /* 3.35 on --surface, the 3.0 edge floor */

    /*
     * THE SIX SUBTLES, each its own solid composited at TWELVE per cent over --surface. A light
     * subtle is a near white tint and is unusable here. Twelve rather than ten, because the plum
     * surface sits closer in luminance to --ai and --brand than the navy did: below twelve those
     * two fall under 4.5 on their own tint, and above it nothing improves. The number beside each
     * is its own solid read on it, which is the pairing tag.css renders.
     */
    --success-subtle: rgb(34 41 46);   /* 6.97 */
    --warning-subtle: rgb(55 34 41);   /* 6.55 */
    --danger-subtle:  rgb(54 27 39);   /* 4.71 */
    --info-subtle:    rgb(26 44 58);   /* 9.44 */
    --muted-subtle:   rgb(44 38 51);   /* 6.50 */
    --ai-subtle:      rgb(40 31 59);   /* 4.57 */

    /*
     * AND THE ONE DIM THAT IS A LIGHT GREY. The five other `-dim` values are mid tones and read
     * as borders on either ground; --muted-dim is rgb(203 213 225), the lightest value in
     * tokens.css after white. It is the rest arc of `meter`'s ring, so on the scan screen it drew
     * a near white 150px disc round the agent. Solved at the plum hue against all three grounds it
     * meets: 4.40 on --surface, 4.74 on --ground, 3.58 on --muted-subtle, the tag border pairing.
     */
    --muted-dim:      rgb(136 120 142);

    /* THE THREE SOLIDS ARE NOT RESTATED, and that is the measurement's answer rather than an
       omission: --success 8.54, --warning 8.02, --danger 5.44 on --surface, all clear. */
  }
}

/*
 * DARK, chosen. Identical values to the block above, for the reason the header gives: CSS cannot
 * put a media condition and a selector in one rule, and this is the reader who asked for dark on
 * a system that did not. Held identical by assertion, not by care.
 */
:root[data-theme="dark"] .theme-public {
  --ground:    rgb(17 11 20);
  --surface:   rgb(28 19 32);
  --surface-2: rgb(41 30 47);
  --surface-3: rgb(52 38 59);
  --line:      rgb(60 44 68);
  --line-soft: rgb(41 30 47);
  --ink:   rgb(246 239 244);
  --ink-2: rgb(187 170 183);
  --ink-3: rgb(148 132 145);
  --brand:        rgb(220 89 178);
  --action-text:  rgb(147 197 253);
  --brand-hover:  rgb(226 118 192);
  --brand-ink:    rgb(17 11 20);
  --brand-subtle: rgb(51 27 50);
  --brand-border: rgb(170 65 137);
  --brand-accent: rgb(220 89 178);
  --ai:     rgb(129 122 255);
  --ai-dim: rgb(85 77 255);
  --success-subtle: rgb(34 41 46);
  --warning-subtle: rgb(55 34 41);
  --danger-subtle:  rgb(54 27 39);
  --info-subtle:    rgb(26 44 58);
  --muted-subtle:   rgb(44 38 51);
  --ai-subtle:      rgb(40 31 59);
  --muted-dim:      rgb(136 120 142);
}
