/* Self-hosted webfonts — single origin, no third-party font requests.
 *
 * Previously the site pulled a render-blocking stylesheet from
 * fonts.googleapis.com which then pulled woff2 files from fonts.gstatic.com:
 * two extra origins, two extra DNS+TCP+TLS handshakes and one extra
 * round-trip in front of first paint. Both families are variable fonts, so
 * Google was serving ONE file per unicode subset regardless of how many
 * weights were requested — the five `wght` values in the old query string
 * resolved to the same byte-identical woff2 (verified by md5). Self-hosting is
 * therefore byte-neutral and strictly fewer connections.
 *
 * latin + latin-ext are kept with their original unicode-range values so an
 * English page still downloads only the latin file.
 *
 * Regenerate: see tools/README-fonts.md
 */

/* ---- Plus Jakarta Sans (variable, 200–800) — body + display ------------- */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('/assets/fonts/plus-jakarta-sans-latin.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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('/assets/fonts/plus-jakarta-sans-latin-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;
}

/* ---- Space Grotesk (variable, 500–700) — display headlines only ---------
 * Added so the big headlines read as their own voice instead of a bigger
 * version of the body text. Modern grotesk, heavy weight, tight tracking.
 * Loaded for headlines only, so the latin subset is all that ships.
 */
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url('/assets/fonts/space-grotesk-latin.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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url('/assets/fonts/space-grotesk-latin-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;
}

/* ---- JetBrains Mono (variable, 100–800) — transcripts, code, tickers --- */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('/assets/fonts/jetbrains-mono-latin.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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('/assets/fonts/jetbrains-mono-latin-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;
}

/* ---- Metric-matched fallbacks -----------------------------------------
 * `font-display: swap` means the fallback paints first and the web font
 * replaces it. If the two occupy different space, that swap IS a layout
 * shift. Numbers below are measured, not guessed —
 * `node tests/browser/font-metrics.mjs` reads them out of the real woff2 in
 * a real browser:
 *
 *   Plus Jakarta Sans 400  ascent 104%  descent 22%  sample advance 5450
 *   Arial / Helvetica / Liberation Sans / generic sans-serif
 *                          ascent  91%  descent 21%  sample advance 5172.7
 *
 * so the fallback is 5.4% narrow and 13% short in the line box.
 * size-adjust scales the whole face including the overrides, so the override
 * values are pre-divided by the size-adjust factor (104 / 1.054 = 98.7).
 *
 *
 * The fallback faces carry the SAME unicode-range as the real subsets. Without
 * that they would also stand in for glyphs the woff2 files do not contain - the
 * "Next -->" arrow (U+2192) is outside Google's latin range, so it was already
 * rendering in Arial, and an un-ranged 105.4% fallback silently drew it 5.4%
 * larger than it used to be. Ranging the fallback keeps such glyphs on the same
 * system font they always used.
 *
 *   JetBrains Mono 400 vs generic monospace: advance ratio 99.7% — inside
 *   rounding, so only the vertical metrics are overridden there.
 */
@font-face {
  font-family: 'Plus Jakarta Fallback';
  src: local('Arial'), local('Helvetica'), local('Liberation Sans'), local('Arimo');
  size-adjust: 105.4%;
  ascent-override: 98.7%;
  descent-override: 20.9%;
  line-gap-override: 0%;
  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, U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, 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: 'JetBrains Fallback';
  src: local('DejaVu Sans Mono'), local('Liberation Mono'), local('Courier New'), local('Menlo');
  size-adjust: 99.7%;
  ascent-override: 102.3%;
  descent-override: 30.1%;
  line-gap-override: 0%;
  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, U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, 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;
}
