/* Self-hosted web fonts (static/fonts/README.md; SIL Open Font License 1.1). One variable
   woff2 per family and subset covers the whole weight range; the browser downloads a file only
   when the page uses a character in its unicode-range. Loaded first by base.html, before
   tokens.css names the families; base.html preloads inter-ui.woff2, which every page needs.

   Faces: Inter (all UI and prose), Source Serif 4 (h1–h3, big titles, big figures),
   Sora (the logo only). Geist, Geist Mono and Bricolage Grotesque left on 2026-10-22. */

/* ---- Inter -------------------------------------------------------------------------------
   Two files. inter-ui carries Latin-1 PLUS everything Romanian needs (ă â î ș ț and the
   cedilla ş ţ), the Greek letters of the lessons and the common symbols — so a Romanian page
   needs exactly one font file, the preloaded one. inter-ui-ext holds the rest of latin-ext and
   loads only when a page actually uses such a character.
   ⚠️ ext is declared FIRST on purpose: where two faces' ranges overlap (ă, ș, ț, ≤, −…), the
   LAST declared face wins, and that must be inter-ui, the file already in hand. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/inter-ui-ext.woff2") format("woff2");
  unicode-range: U+0100-024F, U+1E00-1EFF, U+2070-209C, U+2100-218F, U+2202-2298, U+2C7C, U+2C7F, U+A7FF;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/inter-ui.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0102-0103, U+0131, U+0152-0153, U+015E-0163, U+0218-021B, U+02C6, U+02DA, U+02DC, U+0391-03A1, U+03A3-03A9, U+03B1-03C9, U+2000-200B, U+2010-2027, U+202F-2055, U+2057, U+205F, U+20AC, U+2116, U+2122, U+2190-2193, U+2212, U+2248, U+2260, U+2264-2265, U+FEFF;
}

/* ---- Source Serif 4 (opsz 8–60: Text and Display cuts by size, font-optical-sizing auto) -- */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("../fonts/source-serif-4-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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("../fonts/source-serif-4-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;
}

/* ---- Sora (logo) ---------------------------------------------------------------------- */
@font-face {
  font-family: 'Sora';
  font-style: normal;
  font-weight: 700 800;
  font-display: swap;
  src: url("../fonts/sora-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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Sora';
  font-style: normal;
  font-weight: 700 800;
  font-display: swap;
  src: url("../fonts/sora-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 fallbacks (no layout shift when the web font swaps in) -------------------
   A local font scaled so its text runs as wide as the web font's, with the web font's vertical
   metrics, so the line boxes keep their height. Named second in --font-body / --font-serif.
   How the numbers were computed (fontTools, 2026-10-22): the average advance width of each face,
   weighted by character frequency over 40 real lesson .md files (Romanian, diacritics
   included); size-adjust = web average / local average; ascent- and descent-override = the web
   font's OS/2 typo ascender and descender (Inter 1984/494 of 2048, Source Serif 4 1036/335 of
   1000) divided by size-adjust. One face per weight band, because bold Arial/Georgia are much
   wider than regular. ascent-override is ignored by Safari (size-adjust alone still holds the
   width); there is no Arial on Android, so the face simply does not load and system-ui is used. */
@font-face {
  font-family: 'Inter Fallback';
  font-weight: 400 500;
  src: local("Arial"), local("ArialMT");
  size-adjust: 106.54%;           /* Inter 400 0.4551em / Arial 0.4272em */
  ascent-override: 90.93%;
  descent-override: 22.64%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Inter Fallback';
  font-weight: 600 800;
  src: local("Arial Bold"), local("Arial-BoldMT");
  size-adjust: 101.05%;           /* Inter 600 0.4643em / Arial Bold 0.4595em */
  ascent-override: 95.87%;
  descent-override: 23.87%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Source Serif Fallback';
  font-weight: 400 500;
  src: local("Georgia");
  size-adjust: 101.6%;            /* Source Serif 4 500 (opsz 20) 0.4337em / Georgia 0.4269em */
  ascent-override: 101.96%;
  descent-override: 32.97%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Source Serif Fallback';
  font-weight: 600 800;
  src: local("Georgia Bold"), local("Georgia-Bold");
  size-adjust: 86.24%;            /* Source Serif 4 600 (opsz 28) 0.4290em / Georgia Bold 0.4974em */
  ascent-override: 120.13%;
  descent-override: 38.84%;
  line-gap-override: 0%;
}
