/* Metric-matched fallback faces for the self-hosted dadchecks webfonts.
 * Added by kanban t_60bd36c0 on 2026-11-11.
 * CORRECTED by kanban t_3031aaf1 on 2026-11-11 (first-visit CLS card).
 *
 * WHAT THIS DOES
 * --------------
 * Every webfont on this site loads with `font-display: swap`. While the
 * webfont is still downloading, the browser paints the next face in the
 * font stack. When the webfont arrives, the text is re-laid-out with
 * different glyph metrics. That reflow is a layout shift, and it is
 * visible to the user as text jumping.
 *
 * This file defines a fallback face for each webfont whose metrics are
 * OVERRIDDEN to match the webfont exactly. With the overrides in place
 * the fallback occupies precisely the space the webfont will occupy, so
 * the swap causes no reflow at all.
 *
 * WHY THE PREVIOUS VALUES WERE WRONG
 * ----------------------------------
 * The first version of this file (2026-11-11, kanban t_60bd36c0) shipped
 * `size-adjust` values that were the RECIPROCAL of the correct ones, and
 * ascent/descent overrides that did not match the font files. Its header
 * claimed a measured deviation of "-0.002 %" per family; that claim did
 * not reproduce.
 *
 * The failure was visible on the site. Lighthouse attributed 0.0886 of
 * layout shift to the cookie banner with the cause "Web font loaded"
 * (Inter-400-latin.woff2 + PressStart2P-400-latin.woff2), and 0.0084 to
 * the hero title (Anton-400-latin.woff2). The banner's paragraph re-wrapped
 * from 3 lines to 4 when Inter arrived (71.30px -> 95.06px) because the
 * fallback text was the wrong width.
 *
 * HOW THE VALUES WERE DERIVED (corrected)
 * ----------------------------------------
 * Solved in a real browser (Chromium, the engine Lighthouse measures with)
 * against the ACTUAL webfont files served from production:
 *
 *   1. `size-adjust` = webfont advance width / raw fallback advance width,
 *      both measured with CanvasRenderingContext2D.measureText() over the
 *      same string, so the two numbers are directly comparable.
 *      Inter   2866.211 / 2795.215 (Arial)             = 102.5399 %
 *      Anton   2143.408 / 2260.059 (Impact)            =  94.8386 %
 *      Marker  2681.445 / 2898.340 (Comic Sans MS)     =  92.5166 %
 *      PS2P    4700.000 / 2820.459 (Courier New)       = 166.6395 %
 *   2. `ascent-override` / `descent-override` are taken from the font
 *      files themselves (hhea ascender/descender over unitsPerEm), which
 *      is what the browser uses for line layout:
 *      Inter   1984 / -494 of 2048   =  96.875 % / 24.1211 %
 *      Anton   2409 / -674 of 2048   = 117.627 % / 32.9102 %
 *      Marker  1136 / -325 of 1024   = 110.9375 % / 31.7383 %
 *      PS2P    1000 /    0 of 1000   = 100.000 % /  0.0000 %
 *   3. The result was re-measured end to end in real DOM layout
 *      (element width, height and position before and after the swap) and
 *      compared against the webfont-loaded page.
 *
 * HOW TO READ size-adjust / ascent-override / descent-override
 * -----------------------------------------------------------
 * `size-adjust` scales the fallback's glyph outlines and advance widths.
 * It MUST be written as a percentage (102.54%), not as a unitless number
 * (1.0254) - a unitless value is invalid CSS and the browser silently
 * ignores the whole @font-face rule, which is a trap worth recording.
 *
 * `ascent-override` and `descent-override` REPLACE the face's ascent and
 * descent outright, expressed as a percentage of the em. They are
 * therefore exact on every platform, independently of which local font
 * was matched.
 *
 * The `src: local(...)` lists below are the metric-compatible families.
 * Arial, Helvetica, Liberation Sans and Nimbus Sans all share the same
 * advance widths, so one size-adjust is correct for all of them; Impact
 * and Haettenschweiler likewise; Courier New, Courier, Liberation Mono
 * and Nimbus Mono likewise. The Comic Sans / Chancery / Chalkboard list
 * for Permanent Marker is the cursive fallback set.
 *
 * ORDERING
 * --------
 * This file MUST be emitted AFTER dadchecks-design-tokens.css. That file
 * re-declares the --dc-font-* token stacks, so if it came later it would
 * overwrite the stacks below and the raw fallbacks would come back.
 * The enqueue lives in wp-content/mu-plugins/dadchecks-perf.php at
 * priority 1000 (the design-token override uses 999).
 */


/* --------------------------------------------------------------------------
 * Inter -> Arial / Helvetica / Liberation Sans / Nimbus Sans
 * --------------------------------------------------------------------------
 */
@font-face {
    font-family: "Inter Fallback";
    src: local("Arial"), local("Helvetica"), local("Liberation Sans"), local("Nimbus Sans");
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    size-adjust: 102.5399%;
    ascent-override: 96.8750%;
    descent-override: 24.1211%;
}

/* --------------------------------------------------------------------------
 * Anton -> Impact / Haettenschweiler
 * --------------------------------------------------------------------------
 */
@font-face {
    font-family: "Anton Fallback";
    src: local("Impact"), local("Haettenschweiler");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    size-adjust: 94.8386%;
    ascent-override: 117.6270%;
    descent-override: 32.9102%;
}

/* --------------------------------------------------------------------------
 * Permanent Marker -> the cursive fallback set
 * --------------------------------------------------------------------------
 */
@font-face {
    font-family: "Permanent Marker Fallback";
    src: local("Comic Sans MS"), local("Comic Sans"), local("Chalkboard SE"), local("Apple Chancery");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    size-adjust: 92.5166%;
    ascent-override: 110.9375%;
    descent-override: 31.7383%;
}

/* --------------------------------------------------------------------------
 * Press Start 2P -> Courier New / Courier / Liberation Mono / Nimbus Mono
 * --------------------------------------------------------------------------
 */
@font-face {
    font-family: "Press Start 2P Fallback";
    src: local("Courier New"), local("Courier"), local("Liberation Mono"), local("Nimbus Mono PS");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    size-adjust: 166.6395%;
    ascent-override: 100.0000%;
    descent-override: 0.0000%;
}

/* --------------------------------------------------------------------------
 * Token stacks.
 *
 * The metric-matched face goes FIRST in each stack, immediately after the
 * webfont. That is what makes the browser use the adjusted local face
 * during the swap window instead of the raw platform default.
 *
 * The real webfont is still declared by fonts-local.css and still wins
 * as soon as it arrives; these overrides exist purely so that the space
 * it occupies is identical.
 *
 * --dc-font-mono is deliberately NOT touched: JetBrains Mono / Fira Code
 * are not self-hosted webfonts on this site, there is no @font-face for
 * them, and so there is no swap to absorb.
 *
 * --dc-font-body is set on the body rule by dadchecks-design-tokens.css
 * and carries the same stack as --dc-font-sans, so it needs the same
 * treatment.
 * --------------------------------------------------------------------------
 */
:root {
    --dc-font-sans:    "Inter", "Inter Fallback", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --dc-font-display: "Anton", "Anton Fallback", Impact, "Arial Narrow", sans-serif;
    --dc-font-script:  "Permanent Marker", "Permanent Marker Fallback", cursive;
    --dc-font-pixel:   "Press Start 2P", "Press Start 2P Fallback", monospace;
    --dc-font-body:    "Inter", "Inter Fallback", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
