/**
 * Self-hosted Geist + Geist Mono served from cdn.crossly.net (R2).
 *
 * Original files came from fonts.googleapis.com — Google rotates the
 * v#/ path in their woff2 URLs which broke our pinned preload twice;
 * pulling them once and hosting ourselves lets us pin a stable URL.
 * Files were downloaded on 2026-06-19 from Geist v5 / Geist Mono v6
 * and uploaded to R2 via `scripts/upload-fonts.mjs`. To refresh:
 *   1. curl the live CSS with a current-Chrome UA from
 *      https://fonts.googleapis.com/css2?family=Geist:wght@300..900&family=Geist+Mono:wght@400..600&display=swap
 *   2. Pull each woff2 to scratch
 *   3. Bump the filename (geist-latin-v6.woff2) to bust the immutable
 *      cache, then run upload-fonts.mjs and update the urls here.
 *
 * Only `latin` + `latin-ext` ranges are vendored — the app is
 * English-first, Cyrillic / Vietnamese / etc. fall back to the system
 * stack via `font-family` ordering.
 *
 * CORS NOTE: the R2 bucket needs CORS to allow these cross-origin
 * font requests from crossly.net. See scripts/set-r2-cors.mjs (needs
 * an admin-scope R2 token) or paste the JSON in
 * Cloudflare Dashboard → R2 → bucket → Settings → CORS Policy.
 * Without CORS, the page renders with the system fallback font (no
 * crash; just doesn't get Geist).
 */

/*
 * Metric-matched fallbacks.
 *
 * font-display: swap causes a visible re-flow when Geist arrives if
 * the fallback font has different x-height / cap-height / advance
 * widths. These remap a local() font (Arial for sans, Courier New
 * for mono — both universally preinstalled on Windows / macOS /
 * Android, available via msttcorefonts on Linux) and apply the
 * specific overrides Vercel ships with next/font/google Geist.
 * Calibrated against Geist's head + hhea tables — within 0.05%.
 *
 * Don't add extra local() candidates here. The override numbers are
 * calibrated to Arial / Courier New specifically; on a system that
 * resolves a different local() the metrics no longer match and the
 * swap becomes visible again.
 */
@font-face {
  font-family: 'Geist Fallback';
  src: local('Arial');
  ascent-override: 89.04%;
  descent-override: 22.03%;
  line-gap-override: 0%;
  size-adjust: 102.65%;
}
@font-face {
  font-family: 'Geist Mono Fallback';
  src: local('Courier New');
  ascent-override: 64.46%;
  descent-override: 16.21%;
  line-gap-override: 0%;
  size-adjust: 144.54%;
}

/* Geist — variable weight 300–900 */
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('https://cdn.crossly.net/fonts/geist-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;
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('https://cdn.crossly.net/fonts/geist-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;
}

/* Geist Mono — variable weight 400–600 */
@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('https://cdn.crossly.net/fonts/geist-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;
}
@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('https://cdn.crossly.net/fonts/geist-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;
}
