/*
 * Self-hosted typefaces.
 *
 * The fonts used to come from fonts.googleapis.com. The service worker never
 * caches third-party requests, so an offline PWA silently fell back to a
 * system font and cards/tables rendered with a different width and weight.
 * Serving the files from our own origin lets the service worker precache them
 * and guarantees the same rendering with or without network.
 *
 * Only latin + latin-ext are shipped (fr/en/es/pt). Arabic glyphs are not in
 * these families and always used the system Arabic font, online or offline.
 */

/* Noto Sans - variable font. The weight range intentionally stops at 600 to
   reproduce exactly what the previous Google Fonts request served (400;600):
   heavier declarations keep resolving to the 600 master. */
@font-face {
  font-family: 'Noto Sans';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/src/shared/fonts/noto-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;
}
@font-face {
  font-family: 'Noto Sans';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/src/shared/fonts/noto-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: 'Archivo Black';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/src/shared/fonts/archivo-black-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: 'Archivo Black';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/src/shared/fonts/archivo-black-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: 'Audiowide';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/src/shared/fonts/audiowide-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: 'Audiowide';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/src/shared/fonts/audiowide-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;
}

/*
 * Metric-matched fallback aliases.
 *
 * Used for the few milliseconds before a webfont is decoded (or if a cache is
 * ever evicted). Local system fonts are rescaled with size-adjust and the
 * ascent/descent overrides so the fallback occupies the same advance width
 * and line box as the real font: no reflow, no card/table resize on swap.
 * Values were computed from the shipped font files against Arial metrics
 * (Helvetica/Roboto/Liberation Sans are metric-compatible enough).
 */
@font-face {
  font-family: 'Noto Sans Fallback';
  font-style: normal;
  font-weight: 400 600;
  src: local('Arial'), local('ArialMT'), local('Helvetica'), local('Roboto'), local('Liberation Sans');
  size-adjust: 108.51%;
  ascent-override: 98.51%;
  descent-override: 27%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Noto Sans Fallback';
  font-style: normal;
  font-weight: 700 900;
  src: local('Arial Bold'), local('Arial-BoldMT'), local('Helvetica Bold'), local('Roboto Bold'), local('Liberation Sans Bold');
  size-adjust: 103.8%;
  ascent-override: 102.99%;
  descent-override: 28.23%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Archivo Black Fallback';
  font-style: normal;
  font-weight: 100 900;
  src: local('Arial Black'), local('Arial-Black'), local('Arial Bold'), local('Arial-BoldMT'), local('Helvetica Bold'), local('Roboto Black'), local('Liberation Sans Bold');
  size-adjust: 116.4%;
  ascent-override: 75.43%;
  descent-override: 18.04%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Audiowide Fallback';
  font-style: normal;
  font-weight: 100 900;
  src: local('Arial'), local('ArialMT'), local('Helvetica'), local('Roboto'), local('Liberation Sans');
  size-adjust: 129.51%;
  ascent-override: 76.42%;
  descent-override: 22.02%;
  line-gap-override: 0%;
}

/* Shared stacks for new code. Existing rules reference the families directly
   and have been updated to include the fallback aliases above. */
:root {
  --font-sans: 'Noto Sans', 'Noto Sans Fallback', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-display: 'Archivo Black', 'Archivo Black Fallback', 'Audiowide', 'Noto Sans', 'Noto Sans Fallback', Arial, sans-serif;
  --font-tech: 'Audiowide', 'Audiowide Fallback', 'Noto Sans', 'Noto Sans Fallback', Arial, sans-serif;
}
