/* Inter, served by this project, with a fallback matched to its metrics.
 *
 * Every page used to fetch this typeface from fonts.googleapis.com and fonts.gstatic.com. Two
 * consequences, one of them visible:
 *
 * 1. A request to a third party on pages that promise they do not need one, and an asset outside
 *    the `?v=` contract every other asset here is held to. The same reasoning that moved the brand
 *    icons off a CDN (scripts/check-vendored-assets.mjs); the typeface was simply the last one
 *    left, and both Google hosts are now out of that file's allowlist.
 * 2. `display=swap` paints the page in a fallback and re-lays it out when Inter arrives. Inter is
 *    wider than Arial by between 2.8% and 7.8% depending on weight, so that reflow moved text,
 *    wrapped lines differently, and shifted anything sitting beside it.
 *
 * The fallback below is the fix for (2): one `@font-face` per weight, each scaled so a line of
 * text occupies the same width in the fallback as it will in Inter. The swap then changes which
 * glyphs are drawn and nothing about where anything sits.
 *
 * Every number here was measured in Chrome against the vendored file rather than quoted. The
 * vertical metrics came off a `line-height: normal` box with a baseline probe - Inter is ascent 97,
 * descent 24 per 100px em - and the vertical overrides are divided by the size-adjust factor
 * because that factor has already scaled the em they are resolved against.
 *
 * Each size-adjust was then *solved* rather than read off one sample: the ratio of Inter's width to
 * the fallback's was measured over 25 strings this product actually renders, and the mean taken.
 * Calibrating on a single string looked far better than it was - 0.005% against its own sample and
 * 2.9% against real ones.
 *
 * What this does and does not buy, stated plainly, because the numbers are easy to overclaim:
 * Inter and Arial have genuinely different letter proportions, so no single scale factor makes
 * every string match. Mean drift across that corpus is about 1%; the worst single short heading is
 * still 2-4%. An unmatched Arial fallback costs 2.8-7.8% *on average* and mismatches the vertical
 * metrics as well. Measured with the font blocked outright, article height is identical to the
 * pixel and the masthead differs by 3.3px. `scripts/check-fonts.mjs --measure` holds the mean
 * under 1.5% and the worst case under 4%, against strings it was not calibrated on.
 *
 * Loaded by every surface. Keep it first, ahead of the stylesheets that use the family. */

/* ------------------------------------------------------------------ Inter */

/* One variable file per subset covers 100-900, so four static weights became one request. The
   browser downloads only the subset a page's characters actually need; latin is 48KB and serves
   almost everything this product renders. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/inter-latin.woff2?v=20260913-self-hosted-1") 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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/inter-latin-ext.woff2?v=20260913-self-hosted-1") 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;
}

/* ------------------------------------------------------------------ metric-matched fallback */

/* Arial carries two real weights, so 400 and 500 both resolve to its regular and 600 and 700 both
   to its bold - which is why one size-adjust cannot serve all four and there are four rules here
   rather than one. */

@font-face {
  font-family: "Inter Fallback";
  font-style: normal;
  font-weight: 400;
  src: local("Arial"), local("Helvetica Neue"), local("Liberation Sans");
  size-adjust: 106.475%;
  ascent-override: 90.98%;
  descent-override: 22.65%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Inter Fallback";
  font-style: normal;
  font-weight: 500;
  src: local("Arial"), local("Helvetica Neue"), local("Liberation Sans");
  size-adjust: 107.797%;
  ascent-override: 89.87%;
  descent-override: 22.38%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Inter Fallback";
  font-style: normal;
  font-weight: 600;
  src: local("Arial Bold"), local("Arial"), local("Helvetica Neue"), local("Liberation Sans");
  size-adjust: 101.137%;
  ascent-override: 95.79%;
  descent-override: 23.85%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Inter Fallback";
  font-style: normal;
  font-weight: 700;
  src: local("Arial Bold"), local("Arial"), local("Helvetica Neue"), local("Liberation Sans");
  size-adjust: 102.349%;
  ascent-override: 94.65%;
  descent-override: 23.57%;
  line-gap-override: 0%;
}
