/* ----------------------------------------------------------------------------
   Self-hosted webfonts.

   `font-display: optional` (P3 M2 close, integration QA F-02 fix):
     - Browser uses webfont ONLY if it loads within ~100ms.
     - Otherwise the fallback (defined below) is used for the page lifetime.
     - With Inter 400/500/600/700 + JetBrains Mono 500 preloaded in
       themes/blocksy-child/functions.php wp_head action, warm-cache visitors
       get Inter; cold-cache + slow network gets the metric-matched fallback
       (zero CLS either way).
     - Trade-off vs `swap`: cold-cache visitors may not see Inter at all on
       the first page load. Acceptable since metrics overrides (below) make
       the fallback render with Inter's exact box dimensions.

   Fallback @font-face (Inter Fallback / JetBrains Mono Fallback):
     - Maps `local()` system fonts (Arial / Menlo) into a virtual family
       with size-adjust + ascent-override + descent-override + line-gap-override
       calibrated to Inter / JetBrains Mono metrics. When the real webfont
       isn't yet available, the browser uses the fallback rendered at
       webfont-equivalent box dimensions, eliminating the layout shift on
       font swap.

   References for metric values:
     - Inter override values from Vercel/Next.js font system + Google Fonts
       fallback recommendations (size-adjust 107.4%, ascent 90%, descent 22.43%).
     - JetBrains Mono override values from JetBrains Mono GitHub README +
       community-published fallback metrics.
   ---------------------------------------------------------------------------- */

/* Geist Variable — primary display + body family (brand system 2026-05-26).
   font-display:swap (not optional like Inter): Geist has no metric-matched
   fallback face, and the brand requires Geist to render; the functions.php
   preload keeps the FOUT window small. */
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/Geist-Variable.woff2") format("woff2-variations");
}

/* Inter — primary webfont */
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 400;
  font-display: optional;
  src: url("../fonts/inter-400.woff2") format("woff2");
}

@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 500;
  font-display: optional;
  src: url("../fonts/inter-500.woff2") format("woff2");
}

@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 600;
  font-display: optional;
  src: url("../fonts/inter-600.woff2") format("woff2");
}

@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 700;
  font-display: optional;
  src: url("../fonts/inter-700.woff2") format("woff2");
}

/* Inter — metric-matched system fallback. Renders with Inter's box dimensions
   so swap is invisible, eliminating CLS during font-load window. */
@font-face {
  font-family: "Inter Fallback";
  font-style: normal;
  font-weight: 100 900;
  src: local("Arial");
  ascent-override: 90%;
  descent-override: 22.43%;
  line-gap-override: 0%;
  size-adjust: 107.4%;
}

/* JetBrains Mono — primary webfont */
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: optional;
  src: url("../fonts/jetbrains-mono-400.woff2") format("woff2");
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 500;
  font-display: optional;
  src: url("../fonts/jetbrains-mono-500.woff2") format("woff2");
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 600;
  font-display: optional;
  src: url("../fonts/jetbrains-mono-600.woff2") format("woff2");
}

/* JetBrains Mono — metric-matched system fallback. */
@font-face {
  font-family: "JetBrains Mono Fallback";
  font-style: normal;
  font-weight: 100 900;
  src: local("Menlo"), local("Monaco"), local("Consolas");
  ascent-override: 70%;
  descent-override: 19%;
  line-gap-override: 0%;
  size-adjust: 100%;
}

/* Wire the fallback families into the inheritance chain. The :root
   custom properties propagate to all elements that reference --font-*. */
:root {
  --font-sans: "Geist", Inter, "Inter Fallback", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "JetBrains Mono Fallback", ui-monospace, "SFMono-Regular", menlo, monospace;
}
