/* ============================================================
   Photon Creatives — self-hosted webfonts

   Files come from the @fontsource* packages via scripts/sync-fonts.mjs;
   the rules are written by hand so the family names stay plain and the
   URLs stay stable enough to preload. Latin subset, woff2 only.

   Two stacks live here, matching the two designs:
     2026    Playfair Display (display) + Lato (everything else)
     legacy  Newsreader + Manrope + JetBrains Mono

   Every face is `font-display: swap` — the page paints immediately in the
   fallback and swaps when the webfont lands. The metric-adjusted fallback
   families further down make that swap nearly invisible.
   ============================================================ */

/* --- 2026 ------------------------------------------------- */

/* Variable across the whole 400–900 range in one file each. */
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(/fonts/playfair-display-latin-wght-normal.woff2) format('woff2-variations');
}

@font-face {
  font-family: 'Playfair Display';
  font-style: italic;
  font-weight: 400 900;
  font-display: swap;
  src: url(/fonts/playfair-display-latin-wght-italic.woff2) format('woff2-variations');
}

/* Lato has no variable cut, so it is one file per weight. Only the weights
   the stylesheets ask for are shipped; an undeclared weight would be
   synthesised, which is why 700 is here even though it is rare. */
@font-face {
  font-family: Lato;
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url(/fonts/lato-latin-300-normal.woff2) format('woff2');
}

@font-face {
  font-family: Lato;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/lato-latin-400-normal.woff2) format('woff2');
}

@font-face {
  font-family: Lato;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(/fonts/lato-latin-700-normal.woff2) format('woff2');
}

@font-face {
  font-family: Lato;
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/lato-latin-400-italic.woff2) format('woff2');
}

/* --- legacy ----------------------------------------------- */

/* Newsreader's `standard` cut carries both axes, so the optical-size axis
   still tracks font-size the way the Google URL's `opsz@6..72` did. */
@font-face {
  font-family: Newsreader;
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url(/fonts/newsreader-latin-standard-normal.woff2) format('woff2-variations');
}

@font-face {
  font-family: Newsreader;
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
  src: url(/fonts/newsreader-latin-standard-italic.woff2) format('woff2-variations');
}

@font-face {
  font-family: Manrope;
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url(/fonts/manrope-latin-wght-normal.woff2) format('woff2-variations');
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url(/fonts/jetbrains-mono-latin-wght-normal.woff2) format('woff2-variations');
}

/* --- metric-adjusted fallbacks ----------------------------- */

/* While a webfont is still in flight the page renders in a local face, and
   the swap reflows the text — badly on the hero headline, where Georgia is
   set at 8vw. These faces scale a local font to the webfont's own metrics so
   the swap barely moves anything.

   The numbers are measured, not guessed: canvas `measureText` at 1000px over
   a sample string, comparing each webfont against its fallback.
     size-adjust      = webfont advance width / fallback advance width
     ascent/descent   = the webfont's own, divided by that size-adjust
   Re-measure if a family or its fallback changes; the line gap is 0 in all
   of these faces, so it is simply overridden to 0.

   Each face resolves via local() only. If the named font is missing the
   whole rule drops out and the browser moves on to the next family in the
   stack, which is why the plain fallbacks are still listed there. */

@font-face {
  font-family: 'Playfair Fallback';
  src: local('Georgia'), local('Times New Roman');
  size-adjust: 99.81%;
  ascent-override: 108.41%;
  descent-override: 25.15%;
  line-gap-override: 0%;
}

@font-face {
  font-family: 'Lato Fallback';
  src: local('Helvetica Neue'), local('Helvetica'), local('Arial');
  size-adjust: 98.29%;
  ascent-override: 100.42%;
  descent-override: 21.67%;
  line-gap-override: 0%;
}

@font-face {
  font-family: 'Newsreader Fallback';
  src: local('Georgia'), local('Times New Roman');
  size-adjust: 101.97%;
  ascent-override: 72.08%;
  descent-override: 25.99%;
  line-gap-override: 0%;
}

@font-face {
  font-family: 'Manrope Fallback';
  src: local('Helvetica Neue'), local('Helvetica'), local('Arial');
  size-adjust: 103.06%;
  ascent-override: 103.44%;
  descent-override: 29.11%;
  line-gap-override: 0%;
}

@font-face {
  font-family: 'JetBrains Mono Fallback';
  src: local('Menlo'), local('Consolas'), local('DejaVu Sans Mono');
  size-adjust: 99.66%;
  ascent-override: 102.35%;
  descent-override: 30.10%;
  line-gap-override: 0%;
}
