/*
 * Self-hosted fonts. NEVER load fonts from Google's CDN: serving them from
 * fonts.googleapis.com transmits the visitor's IP to Google, which LG München
 * (3 O 17493/20, Jan 2022) held to breach GDPR without consent.
 *
 * Files: public/fonts/, from Fontsource (OFL-1.1; licences alongside).
 * Each face is split into latin and latin-ext subsets by unicode-range, so a
 * Portuguese page downloads only the latin file (ã õ ç á ê í º ª € are all in
 * latin). latin-ext downloads only if such characters actually render.
 *
 * Source Serif 4 ships at 600 only: 700 was dropped to hold the 120 kB font
 * budget (DESIGN.md "Typography").
 *
 * There are NO font preloads. Instead, text paints at once in a local system
 * font whose metrics are overridden to occupy almost exactly the same space
 * (see METRIC-MATCHED FALLBACKS below), so the swap to the real font when it
 * arrives does not shift the layout.
 */

@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/source-serif-4-latin-600-normal.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: 'Source Serif 4';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/source-serif-4-latin-ext-600-normal.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: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/ibm-plex-sans-latin-400-normal.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: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/ibm-plex-sans-latin-ext-400-normal.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: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/ibm-plex-sans-latin-500-normal.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: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/ibm-plex-sans-latin-ext-500-normal.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: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/ibm-plex-sans-latin-600-normal.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: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/ibm-plex-sans-latin-ext-600-normal.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: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/ibm-plex-mono-latin-400-normal.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: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/ibm-plex-mono-latin-ext-400-normal.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
 * Generated by scripts/font-fallbacks.py, with the working shown for each
 * face. Recompute after changing any font file:
 *   uvx --from "fonttools[woff]" python scripts/font-fallbacks.py <android-dir>
 * Desktop/iOS faces resolve to Arial / Times New Roman / Courier New (or the
 * metric-compatible Liberation fonts on Linux). Android has none of those, so
 * a second set matches Roboto and Noto Serif. A local() that is not installed
 * simply fails, and the browser moves to the next family in the stack.
 * ===================================================================== */

/* ---- Desktop and iOS: Arial / Times New Roman / Courier New ---- */

/*
 * Plex Sans Fallback 400: real ibm-plex-sans-latin-400-normal.woff2 vs fallback arial.ttf
 *   real:     UPM 1000, hhea asc 1025 desc -275 gap 0,
 *             win (1120, 275), typo (1025, -275, 0), USE_TYPO_METRICS True,
 *             avg advance over SAMPLE 0.46291 em
 *   fallback: UPM 2048, avg advance over SAMPLE 0.46495 em
 *   size-adjust      = 0.46291 / 0.46495            = 99.56%
 *   ascent-override  = 1025 / 1000 / 0.99561    = 102.95%
 *   descent-override = 275 / 1000 / 0.99561     = 27.62%
 */
@font-face {
  font-family: 'Plex Sans Fallback';
  font-style: normal;
  font-weight: 400;
  src: local('Arial'), local('ArialMT'), local('Liberation Sans');
  size-adjust: 99.56%;
  ascent-override: 102.95%;
  descent-override: 27.62%;
  line-gap-override: 0%;
}

/*
 * Plex Sans Fallback 500: real ibm-plex-sans-latin-500-normal.woff2 vs fallback arial.ttf
 *   real:     UPM 1000, hhea asc 1025 desc -275 gap 0,
 *             win (1120, 275), typo (1025, -275, 0), USE_TYPO_METRICS True,
 *             avg advance over SAMPLE 0.47240 em
 *   fallback: UPM 2048, avg advance over SAMPLE 0.46495 em
 *   size-adjust      = 0.47240 / 0.46495            = 101.60%
 *   ascent-override  = 1025 / 1000 / 1.01604    = 100.88%
 *   descent-override = 275 / 1000 / 1.01604     = 27.07%
 */
@font-face {
  font-family: 'Plex Sans Fallback';
  font-style: normal;
  font-weight: 500;
  src: local('Arial'), local('ArialMT'), local('Liberation Sans');
  size-adjust: 101.6%;
  ascent-override: 100.88%;
  descent-override: 27.07%;
  line-gap-override: 0%;
}

/*
 * Plex Sans Fallback 600: real ibm-plex-sans-latin-600-normal.woff2 vs fallback arialbd.ttf
 *   real:     UPM 1000, hhea asc 1025 desc -275 gap 0,
 *             win (1120, 275), typo (1025, -275, 0), USE_TYPO_METRICS True,
 *             avg advance over SAMPLE 0.47857 em
 *   fallback: UPM 2048, avg advance over SAMPLE 0.49533 em
 *   size-adjust      = 0.47857 / 0.49533            = 96.62%
 *   ascent-override  = 1025 / 1000 / 0.96617    = 106.09%
 *   descent-override = 275 / 1000 / 0.96617     = 28.46%
 */
@font-face {
  font-family: 'Plex Sans Fallback';
  font-style: normal;
  font-weight: 600;
  src: local('Arial Bold'), local('Arial-BoldMT'), local('Liberation Sans Bold');
  size-adjust: 96.62%;
  ascent-override: 106.09%;
  descent-override: 28.46%;
  line-gap-override: 0%;
}

/*
 * Source Serif Fallback 600: real source-serif-4-latin-600-normal.woff2 vs fallback timesbd.ttf
 *   real:     UPM 1000, hhea asc 1036 desc -335 gap 0,
 *             win (1009, 324), typo (1036, -335, 0), USE_TYPO_METRICS True,
 *             avg advance over SAMPLE 0.49476 em
 *   fallback: UPM 2048, avg advance over SAMPLE 0.44223 em
 *   size-adjust      = 0.49476 / 0.44223            = 111.88%
 *   ascent-override  = 1036 / 1000 / 1.11879    = 92.60%
 *   descent-override = 335 / 1000 / 1.11879     = 29.94%
 */
@font-face {
  font-family: 'Source Serif Fallback';
  font-style: normal;
  font-weight: 600;
  src:
    local('Times New Roman Bold'), local('TimesNewRomanPS-BoldMT'), local('Liberation Serif Bold');
  size-adjust: 111.88%;
  ascent-override: 92.6%;
  descent-override: 29.94%;
  line-gap-override: 0%;
}

/*
 * Plex Mono Fallback 400: real ibm-plex-mono-latin-400-normal.woff2 vs fallback cour.ttf
 *   real:     UPM 1000, hhea asc 1025 desc -275 gap 0,
 *             win (1025, 275), typo (1025, -275, 0), USE_TYPO_METRICS True,
 *             avg advance over SAMPLE 0.60000 em
 *   fallback: UPM 2048, avg advance over SAMPLE 0.60010 em
 *   size-adjust      = 0.60000 / 0.60010            = 99.98%
 *   ascent-override  = 1025 / 1000 / 0.99984    = 102.52%
 *   descent-override = 275 / 1000 / 0.99984     = 27.50%
 */
@font-face {
  font-family: 'Plex Mono Fallback';
  font-style: normal;
  font-weight: 400;
  src: local('Courier New'), local('CourierNewPSMT'), local('Liberation Mono');
  size-adjust: 99.98%;
  ascent-override: 102.52%;
  descent-override: 27.5%;
  line-gap-override: 0%;
}

/* ---- Android: Roboto / Noto Serif (no Arial or Times there) ---- */

/*
 * Plex Sans Fallback Android 400: real ibm-plex-sans-latin-400-normal.woff2 vs fallback roboto-latin-400-normal.woff2
 *   real:     UPM 1000, hhea asc 1025 desc -275 gap 0,
 *             win (1120, 275), typo (1025, -275, 0), USE_TYPO_METRICS True,
 *             avg advance over SAMPLE 0.46291 em
 *   fallback: UPM 2048, avg advance over SAMPLE 0.46105 em
 *   size-adjust      = 0.46291 / 0.46105            = 100.40%
 *   ascent-override  = 1025 / 1000 / 1.00403    = 102.09%
 *   descent-override = 275 / 1000 / 1.00403     = 27.39%
 */
@font-face {
  font-family: 'Plex Sans Fallback Android';
  font-style: normal;
  font-weight: 400;
  src: local('Roboto'), local('Roboto-Regular');
  size-adjust: 100.4%;
  ascent-override: 102.09%;
  descent-override: 27.39%;
  line-gap-override: 0%;
}

/*
 * Plex Sans Fallback Android 500: real ibm-plex-sans-latin-500-normal.woff2 vs fallback roboto-latin-500-normal.woff2
 *   real:     UPM 1000, hhea asc 1025 desc -275 gap 0,
 *             win (1120, 275), typo (1025, -275, 0), USE_TYPO_METRICS True,
 *             avg advance over SAMPLE 0.47240 em
 *   fallback: UPM 2048, avg advance over SAMPLE 0.46394 em
 *   size-adjust      = 0.47240 / 0.46394            = 101.82%
 *   ascent-override  = 1025 / 1000 / 1.01824    = 100.66%
 *   descent-override = 275 / 1000 / 1.01824     = 27.01%
 */
@font-face {
  font-family: 'Plex Sans Fallback Android';
  font-style: normal;
  font-weight: 500;
  src: local('Roboto Medium'), local('Roboto-Medium');
  size-adjust: 101.82%;
  ascent-override: 100.66%;
  descent-override: 27.01%;
  line-gap-override: 0%;
}

/*
 * Plex Sans Fallback Android 600: real ibm-plex-sans-latin-600-normal.woff2 vs fallback roboto-latin-700-normal.woff2
 *   real:     UPM 1000, hhea asc 1025 desc -275 gap 0,
 *             win (1120, 275), typo (1025, -275, 0), USE_TYPO_METRICS True,
 *             avg advance over SAMPLE 0.47857 em
 *   fallback: UPM 2048, avg advance over SAMPLE 0.46637 em
 *   size-adjust      = 0.47857 / 0.46637            = 102.61%
 *   ascent-override  = 1025 / 1000 / 1.02615    = 99.89%
 *   descent-override = 275 / 1000 / 1.02615     = 26.80%
 */
@font-face {
  font-family: 'Plex Sans Fallback Android';
  font-style: normal;
  font-weight: 600;
  src: local('Roboto Bold'), local('Roboto-Bold');
  size-adjust: 102.61%;
  ascent-override: 99.89%;
  descent-override: 26.8%;
  line-gap-override: 0%;
}

/*
 * Source Serif Fallback Android 600: real source-serif-4-latin-600-normal.woff2 vs fallback noto-serif-latin-700-normal.woff2
 *   real:     UPM 1000, hhea asc 1036 desc -335 gap 0,
 *             win (1009, 324), typo (1036, -335, 0), USE_TYPO_METRICS True,
 *             avg advance over SAMPLE 0.49476 em
 *   fallback: UPM 1000, avg advance over SAMPLE 0.52065 em
 *   size-adjust      = 0.49476 / 0.52065            = 95.03%
 *   ascent-override  = 1036 / 1000 / 0.95027    = 109.02%
 *   descent-override = 335 / 1000 / 0.95027     = 35.25%
 */
@font-face {
  font-family: 'Source Serif Fallback Android';
  font-style: normal;
  font-weight: 600;
  src: local('Noto Serif Bold'), local('NotoSerif-Bold');
  size-adjust: 95.03%;
  ascent-override: 109.02%;
  descent-override: 35.25%;
  line-gap-override: 0%;
}
