/* ===========================================================================
   Self-hosted webfonts + metric-matched fallbacks  (CLS fix)
   ---------------------------------------------------------------------------
   Why this file exists
   --------------------
   Previously Figtree, Lora and Anonymous Pro were loaded from Google Fonts with
   `font-display: swap`. On a cold cache the text first painted in a system font
   and then re-flowed when the webfont arrived, producing sitewide Cumulative
   Layout Shift (the nav and body copy shifted ~420-550ms into load). See the
   SEO "Reduce page layout shifts" report.

   The fix (three layers):
     1. Self-host the fonts (woff2, variable where available) so they load from
        our own origin with no third-party round-trip, and PRELOAD the two
        above-the-fold faces (see <link rel="preload"> in header.php). On most
        connections the font now arrives before first paint.
     2. font-display: optional — if the font has NOT arrived by first paint, the
        browser keeps the fallback for that page view and never swaps it in.
        No swap == no layout shift, on every platform (this is the guarantee).
        The webfont still finishes downloading and is cached for the next page.
     3. Metric-matched fallback faces ("Figtree Fallback" / "Lora Fallback")
        whose ascent/descent/size-adjust are tuned so the fallback occupies the
        same space as the real font. On Windows/macOS (where local('Arial') /
        local('Times New Roman') resolve) this makes the fallback render almost
        indistinguishably from the real font. On Android/Linux these locals are
        absent, so layer 2 (optional) is what guarantees zero shift there.

   Trade-off: on a cold cache + slow connection the first page view may show the
   fallback instead of Figtree/Lora (later navigations show the real font from
   cache). To prioritise always showing the brand font over the cross-platform
   zero-CLS guarantee, change `font-display: optional` -> `swap` below.

   The fallback override values were generated with @capsizecss/core
   `createFontStack([figtree, arial])` and `createFontStack([lora, timesNewRoman])`.

   NOTE: This file is hand-authored and enqueued directly (goldenpress_register_styles
   in functions.php) — it is NOT part of the main.scss -> main.css build. Edit it here.
   =========================================================================== */

/* ---------- Figtree (display / headings / nav / UI) — variable 300–900 ---------- */
@font-face {
  font-family: 'Figtree';
  font-style: normal;
  font-weight: 300 900;
  font-display: optional;
  src: url('figtree-vf-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Figtree';
  font-style: normal;
  font-weight: 300 900;
  font-display: optional;
  src: url('figtree-vf-normal-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Figtree';
  font-style: italic;
  font-weight: 300 900;
  font-display: optional;
  src: url('figtree-vf-italic.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Figtree';
  font-style: italic;
  font-weight: 300 900;
  font-display: optional;
  src: url('figtree-vf-italic-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Lora (body copy) — variable 400–700 ---------- */
@font-face {
  font-family: 'Lora';
  font-style: normal;
  font-weight: 400 700;
  font-display: optional;
  src: url('lora-vf-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Lora';
  font-style: normal;
  font-weight: 400 700;
  font-display: optional;
  src: url('lora-vf-normal-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Lora';
  font-style: italic;
  font-weight: 400 700;
  font-display: optional;
  src: url('lora-vf-italic.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Lora';
  font-style: italic;
  font-weight: 400 700;
  font-display: optional;
  src: url('lora-vf-italic-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Anonymous Pro (code / pre) — static ---------- */
@font-face {
  font-family: 'Anonymous Pro';
  font-style: normal;
  font-weight: 400;
  font-display: optional;
  src: url('anonymous-pro-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Anonymous Pro';
  font-style: normal;
  font-weight: 700;
  font-display: optional;
  src: url('anonymous-pro-700-normal.woff2') format('woff2');
}

/* ---------- Metric-matched fallback faces ----------
   Generated by @capsizecss/core createFontStack(). These render in a system
   font (Arial / Times New Roman) but with overrides so their box matches the
   real font's metrics. Inserted into the font stack ahead of the generic
   system fonts (see --sans-serif-font-family / --serif-font-family). Only
   take effect where the local() font is installed (Windows/macOS). */
@font-face {
  font-family: 'Figtree Fallback';
  src: local('Arial');
  ascent-override: 94.3231%;
  descent-override: 24.8219%;
  size-adjust: 100.7176%;
}
@font-face {
  font-family: 'Lora Fallback';
  src: local('Times New Roman');
  ascent-override: 87.3264%;
  descent-override: 23.7847%;
  size-adjust: 115.2%;
}

/* The font stacks themselves ('Figtree','Figtree Fallback',… / 'Lora','Lora
   Fallback',…) are wired up via the --sans-serif-font-family / --serif-font-family
   custom properties in _typography.scss (compiled into main.css), so every
   font-family rule in the theme picks up the metric-matched fallback. */
