/**
 * Harvest — derived tokens. Computed from the 4 base vars (--hrv-bg/--hrv-surface/
 * --hrv-text/--hrv-accent) set by web/css/tokens/_palette-*.css, so this file needs
 * no palette-specific values and works identically under every [data-hrv-palette].
 *
 * Rule: component/page CSS (added in later Sprint 03 tasks) must use these tokens,
 * not invent its own color-mix() ratio — a page that mixes its own 14% vs another
 * page's 10% "border" drifts silently.
 *
 * Scope MUST include [data-hrv-palette], not just :root. The base palette vars are
 * set on the element carrying the data-hrv-palette attribute (the <body>, per
 * Magento_Theme/layout/default.xml) — NOT on :root (html). A derived token like
 * `--hrv-band-text: var(--hrv-bg)` declared on :root alone would resolve against
 * HTML's value (only ever the Wheat default), so under any non-default palette
 * every derived token would silently compute against Wheat. Declaring these on
 * [data-hrv-palette] too makes them compute on the same element as the active
 * palette's base vars.
 */
:root,
[data-hrv-palette] {
  /* Palette-neutral state colors (light-surface tuned). */
  --hrv-error: #C2452D;
  --hrv-success: #4C7A3F;
  --hrv-warning: #C08A2D;

  --hrv-border: color-mix(in oklab, var(--hrv-text) 10%, var(--hrv-bg));
  --hrv-border-strong: color-mix(in oklab, var(--hrv-text) 35%, var(--hrv-bg));
  --hrv-text-muted: color-mix(in oklab, var(--hrv-text) 65%, var(--hrv-bg));
  --hrv-text-subtle: color-mix(in oklab, var(--hrv-text) 50%, var(--hrv-bg));
  --hrv-accent-hover: color-mix(in oklab, var(--hrv-accent) 85%, black);
  /*
   * AA-SAFE ACCENT TEXT, ADDED BY T34 — and it exists because --hrv-accent-hover is NOT AA-safe
   * for text on every palette, which several page files have assumed it is.
   *
   * MEASURED across all five palettes with a canvas-readback instrument (calibrated on rgb AND
   * oklab: black/white = 21.00, #767676/white = 4.54, oklab(0.6 0 0)/white = 3.95), against both
   * --hrv-surface and --hrv-bg. Worst case per mix, over 5 palettes x 2 backgrounds:
   *
   *     accent  @85% (= --hrv-accent-hover)   4.21   <- FAILS 4.5 on wheat, against --hrv-bg
   *     accent  @75% (= --hrv-accent-strong)  5.58   <- passes everywhere
   *     accent2 @85%                          4.07   <- FAILS on plum and basil
   *     accent2 @75% (= --hrv-accent-2-strong) 5.39  <- passes everywhere
   *
   * The 85% mixes are kept and unchanged: --hrv-accent-hover is a HOVER state, where the resting
   * state already carries the contrast and the shift only needs to be perceptible. These two are
   * for accent-coloured TEXT at rest, which must clear 4.5 on its own in every palette.
   *
   * Additive only — nothing existing is redefined, so no page changes appearance until it opts in.
   */
  --hrv-accent-strong: color-mix(in oklab, var(--hrv-accent) 75%, black);
  --hrv-accent-2-strong: color-mix(in oklab, var(--hrv-accent-2) 75%, black);
  --hrv-accent-text: var(--hrv-surface);
  --hrv-focus-ring: color-mix(in oklab, var(--hrv-accent) 60%, var(--hrv-bg));
  /* --hrv-band MOVED OUT (M2-3). It is a REAL per-palette value in the artboards
     (Wheat #3A2E17, Basil #24361F, Tomato #3B1A13, Plum #321A2D), not a derivation
     of the text colour. Declaring it here would also have SILENTLY KILLED those
     values: this file loads AFTER the palette files (default.xml lines 11 vs 17) at
     equal specificity, so a :root declaration here wins over the palette's own. The
     honey palette keeps the derived fallback in its own file, since honey is not in
     the artboards at all. */
  --hrv-band-text: var(--hrv-bg);
  /* Secondary text ON a dark band. Added for the newsletter lede, which sat on
     --hrv-text-muted (a LIGHT-SURFACE token) while its own container was inverted:
     AA 2.16 against the artboard's own 5.29. There was no muted band token to reach
     for, which is why the omission was easy to make and invisible to review.
     Mixed toward the band rather than fixed, so it tracks all four palettes.
     Kept at 82% — dark enough to read as secondary, light enough to clear AA on
     every band. Computed, not assumed (oklab mix + WCAG, all four palettes):
       wheat 8.51 · basil 8.24 · tomato 9.53 · plum 9.57   (AA needs 4.5)
     Calibration for that probe: it returns 12.31 for full --hrv-band-text on wheat,
     the same value S7 measured independently for the title. A contrast function
     that has not reproduced a known reading is not a contrast function. */
  --hrv-band-text-muted: color-mix(in oklab, var(--hrv-band-text) 82%, var(--hrv-band));
  --hrv-accent-tint: color-mix(in oklab, var(--hrv-accent) 8%, var(--hrv-surface));
  --hrv-overlay-scrim: color-mix(in oklab, var(--hrv-text) 72%, var(--hrv-bg));
  --hrv-shadow-tint: color-mix(in oklab, var(--hrv-text) 22%, transparent);

  /* --hrv-accent-2 MOVED OUT (M2-3). The old comment here claimed "the design source
     defines only the 4 base vars per palette". THAT IS TRUE OF
     design/store-theme/03-harvest-food/README.md AND FALSE OF THE ARTBOARDS, which
     are the authority: the `palettes` map at the foot of every comp supplies a real
     ac2 for each (Wheat #4C7A3F, Basil #C08A2D, Tomato #4C7A3F, Plum #C08A2D). The
     derivation rendered a BRONZE where the design is GREEN, so every eyebrow on
     every page lost the palette's second accent.
     It cannot live here even as a fallback: this file loads AFTER the palettes
     (default.xml lines 11 vs 17) and :root ties their specificity, so a declaration
     here would silently override the real values and leave them dead. Honey keeps
     the derived fallback in its own file — honey is not in the artboards. */

  /* Type tokens — Bricolage Grotesque (display) + Karla (body). */
  --hrv-font-display: 'Bricolage Grotesque', 'Segoe UI', sans-serif;
  --hrv-font-body: 'Karla', 'Segoe UI', sans-serif;
  /* System mono stack (SKUs, order/tracking numbers). Ships no webfont —
     deliberately resolves to the platform's own mono face. */
  --hrv-font-mono: ui-monospace, 'SFMono-Regular', 'Consolas', monospace;
}

/*
 * AA fix — on-accent label colour for Wheat.
 *
 * Wheat's accent (#C08A2D, from the design source) is a mid-tone gold: a white
 * label on it measures only 3.04:1 in-browser, below the WCAG AA 4.5:1 minimum
 * for normal text.
 *
 * PALETTE-5 HISTORY — READ THIS BEFORE "CORRECTING" ANYTHING BELOW.
 *
 * This block once read "measured across all 5 palettes … (basil 5.04, tomato 5.02,
 * plum 7.66, sea salt 4.82)". Two rewrites have since fought over it, and BOTH were
 * wrong in opposite directions:
 *   1. M4-4 claimed "THE THEME DOES NOT SHIP A SEA SALT PALETTE … the certification
 *      measured a palette that does not exist". TOO STRONG — Sea Salt exists in the
 *      design source with 49 artboards and real hexes (accent #2E7D80). Recomputing it
 *      reproduces 4.82 exactly, so that original measurement was GENUINE, not invented.
 *   2. The retraction of M4-4 then declared Sea Salt "the real fifth palette" and
 *      shipped it. ALSO WRONG, and worse: it re-opened a question the user had already
 *      settled, on the strength of the design source alone.
 *
 * THE SETTLED POSITION: the fifth palette is HONEY, per ClickUp. CLAUDE.md carries an
 * ABSOLUTE RULE added on the user's explicit instruction that names this precise
 * dispute — design source says Sea Salt, ClickUp says Honey, ClickUp wins, and "if
 * ClickUp looks wrong, still follow it and RAISE the discrepancy; do not decide
 * unilaterally that another source is more current."
 * So: 4.82 was a real measurement of a palette that was subsequently ruled OUT OF
 * SCOPE. Not a fabrication, not the current spec. Both things are true at once, which
 * is why each single-sided rewrite produced a false statement.
 *
 * RAISED AND UNRESOLVED (the genuine defect underneath): colors/Honey/ does not exist,
 * so honey's hexes are provisional and its 58 tasks' artboard paths dangle. ClickUp is
 * ALSO self-inconsistent — its list description says Honey while 58 task names in the
 * same list read "Sea Salt · …". Awaiting the user's ruling. That is the sanctioned
 * response; swapping the palette is not.
 *
 * MEASURED (white label on --hrv-accent, 4.5:1 required):
 *     wheat 3.04 FAIL (fixed below) | basil 5.04 | tomato 5.02 | plum 7.66
 *     honey 4.39 FAIL — provisional hexes, no artboard behind them
 * Honey's failure lands on .action.primary via _buttons.css (T3's "Shop the harvest"
 * button). NOT patched here: inventing a token to clear a threshold is how provisional
 * values get certified into permanence. DECLARED, not quietly certified — an all-clear
 * that skips the failing case is worse than no measurement at all.
 *
 * ── SECOND AUDIT, --hrv-accent-2 AS TEXT (B-1). ───────────────────────────────
 * The audit above covers exactly ONE pairing: a white label on --hrv-accent. It does
 * NOT cover --hrv-accent-2, which THIS SPRINT promoted from a derivation to real
 * per-palette artboard hexes (M2-3) — so the token this work introduced went
 * uncertified while the docblock above read like a completed cross-palette clearance.
 * That is the same defect the M4-4 correction was written to fix, recurring inside
 * its own fix. Numbers below computed here and cross-checked against the four figures
 * already published above, which they reproduce exactly:
 *
 *   --hrv-accent-2 as 12px/700 text (NOT WCAG large text, so 4.5:1 applies)
 *                        on --hrv-bg   on --hrv-surface   ON --hrv-accent-tint
 *     wheat    #4C7A3F      4.68 PASS     5.04 PASS         4.68 PASS
 *     tomato   #4C7A3F      4.57 PASS     5.04 PASS         4.53 PASS  <- by 0.03
 *     basil    #C08A2D      2.78 FAIL     3.04 FAIL         2.73 FAIL
 *     plum     #C08A2D      2.73 FAIL     3.04 FAIL         2.67 FAIL
 *
 * THE THIRD COLUMN IS THE ONE THAT MATTERS FOR THE PAGE THIS TABLE NAMES FIRST.
 * pages/_t3.css's hero eyebrow overlays .hrv-t3-hero-media, whose background is
 * --hrv-accent-tint — NOT --hrv-bg. Both published columns measured a background that
 * consumer does not have. The correction existed in harvest-carried-items.md (N-A) and
 * was never folded into the table it corrects: the same claim-outliving-its-code shape
 * this file keeps producing, this time as an omission rather than a false sentence.
 * Tint = color-mix(in oklab, accent 8%, surface), COMPUTED HERE rather than copied from
 * the reviewer who raised it: wheat #FAF6EF · basil #F0F4EF · tomato #FCF0EE · plum
 * #F4EFF3. The figures reproduce theirs exactly — which is why they are trusted, and is
 * the only reason to trust them.
 * VERDICTS DO NOT CHANGE. But TOMATO CLEARS BY 0.03, so any darkening of its tint or
 * lightening of accent-2 silently drops it below AA. Tomato's pass is contingent, not
 * settled.
 *
 * TWO OF FIVE FAIL (basil, plum) AND THEY ARE ONE DEFECT, NOT TWO. Every failing case is
 * --hrv-accent-2 used as small text. The token was derived as a decorative SECOND
 * ACCENT (chips, rules, icon fills) and never as a text colour; the eyebrow adopted it
 * later. Routing these palette-by-palette invited basil and plum being escalated separately as if unrelated. It is ONE systemic token question for design: does
 * accent-2 need a darkened text-safe variant (--hrv-accent-2-text) that the artboard
 * hex keeps for non-text use?
 *
 * CONSUMERS, all 12px eyebrows: pages/_t3.css (hero + panel), pages/_home.css (a
 * CLOSED page), components/_base.css .hrv-kicker (theme-wide).
 *
 * STATUS: OPEN, DECLARED, NOT PATCHED. Unlike honey — whose 4.39 is defensible
 * because its hexes are provisional with no artboard behind them — basil and plum are
 * ARTBOARD-SOURCED and non-provisional, so the failure cannot be waved through as
 * placeholder data, and at ~2.7:1 it is not marginal. It is equally not mine to
 * silently "fix": darkening an artboard-authoritative hue, or swapping the eyebrow to
 * --hrv-text-muted, is a DESIGN decision that changes what the comps specify. Routed
 * to design with two concrete options — (a) a darkened ac2 reserved for TEXT use with
 * the artboard hex kept for non-text, or (b) a different eyebrow token on basil/plum.
 * DO NOT let this docblock read as a clearance again: it now states exactly which
 * pairings were measured and which fail.
 *
 * The accent hex is design-authoritative and is NOT changed — instead the existing
 * --hrv-accent-text token flips to the dark text colour for this palette
 * (#241E14 on #C08A2D ≈ 5.6:1, AA pass). Wheat is the DEFAULT palette, so this
 * governs the default storefront's primary CTA (Add to Cart).
 *
 * Equal specificity to the generic [data-hrv-palette] block above
 * ([data-hrv-palette="wheat"] is also 0,1,0), so it MUST stay AFTER that block to
 * win on source order. :root is included so the pre-attribute fallback matches.
 */
:root,
[data-hrv-palette="wheat"] {
  --hrv-accent-text: var(--hrv-text);
}

/*
 * Base document wiring. Global (not page-scoped) so every real Magento page gets
 * the palette surface, not just Home — without this, real pages fall back to
 * Magento's default white/#333 (the exact gap the Atelier S4 review caught).
 */
body {
  background: var(--hrv-bg);
  color: var(--hrv-text);
  font-family: var(--hrv-font-body);
}
