/* ============================================================
   Vox Mana — Self-hosted Variable Fonts
   @font-face declarations. Falls back gracefully if WOFF2 files
   are not yet in /assets/fonts/.

   See assets/fonts/README.md for download instructions.

   Loading strategy:
   - desktop: font-display: optional (zero CLS, no swap shift)
   - mobile:  font-display: swap (faster LCP, brief swap accepted)

   The mobile-only swap is a single @media override at the bottom.
   ============================================================ */

/* ── FRAUNCES VARIABLE — Display ──
   Axes used: opsz (9–144), wght (100–900), SOFT (0–100).
   Subset: Latin only. */
@font-face {
  font-family: 'Fraunces';
  src: url('/assets/fonts/fraunces-variable.woff2') format('woff2-variations'),
       url('/assets/fonts/fraunces-variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: optional;
  unicode-range: U+0000-024F, U+1E00-1EFF, U+2000-206F, U+2070-209F,
                 U+20A0-20CF, U+2150-218F, U+2190-21FF, U+2200-22FF,
                 U+2C60-2C7F;
  /* Keep the system fallback baseline-matched to avoid CLS even when font swaps. */
  size-adjust: 102%;
  ascent-override: 90%;
  descent-override: 22%;
  line-gap-override: 0%;
}

@font-face {
  font-family: 'Fraunces';
  src: url('/assets/fonts/fraunces-variable-italic.woff2') format('woff2-variations'),
       url('/assets/fonts/fraunces-variable-italic.woff2') format('woff2');
  font-weight: 100 900;
  font-style: italic;
  font-display: optional;
  unicode-range: U+0000-024F, U+1E00-1EFF;
}

/* ── SOURCE SERIF 4 VARIABLE — Body text ──
   Axes used: opsz (8–60), wght (200–900). */
@font-face {
  font-family: 'Source Serif 4';
  src: url('/assets/fonts/source-serif-4-variable.woff2') format('woff2-variations'),
       url('/assets/fonts/source-serif-4-variable.woff2') format('woff2');
  font-weight: 200 900;
  font-style: normal;
  font-display: optional;
  unicode-range: U+0000-024F, U+1E00-1EFF, U+2000-206F, U+2070-209F,
                 U+20A0-20CF, U+2150-218F, U+2190-21FF;
  size-adjust: 100%;
  ascent-override: 92%;
  descent-override: 23%;
  line-gap-override: 0%;
}

@font-face {
  font-family: 'Source Serif 4';
  src: url('/assets/fonts/source-serif-4-variable-italic.woff2') format('woff2-variations'),
       url('/assets/fonts/source-serif-4-variable-italic.woff2') format('woff2');
  font-weight: 200 900;
  font-style: italic;
  font-display: optional;
  unicode-range: U+0000-024F, U+1E00-1EFF;
}

/* ── IBM PLEX MONO — UI labels and taxonomy ──
   Plex Mono isn't variable in the OFL distribution; ship 400 + 500. */
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/assets/fonts/plex-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: optional;
  unicode-range: U+0000-024F, U+1E00-1EFF;
}

@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/assets/fonts/plex-mono-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: optional;
  unicode-range: U+0000-024F, U+1E00-1EFF;
}

/* ── MOBILE OVERRIDE — swap, not optional ──
   Why: mid-range Android over 4G benefits more from text appearing fast
   than from preventing a swap shift. The size-adjust above keeps the
   swap mostly invisible. */
@media (max-width: 640px) {
  @font-face {
    font-family: 'Fraunces';
    src: url('/assets/fonts/fraunces-variable.woff2') format('woff2-variations'),
         url('/assets/fonts/fraunces-variable.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
  }
  @font-face {
    font-family: 'Source Serif 4';
    src: url('/assets/fonts/source-serif-4-variable.woff2') format('woff2-variations'),
         url('/assets/fonts/source-serif-4-variable.woff2') format('woff2');
    font-weight: 200 900;
    font-style: normal;
    font-display: swap;
  }
}
