/* =============================================================================
 * SOOM — type
 * -----------------------------------------------------------------------------
 * Three families, all self-hosted, all OFL. No CDN: if a font host is slow,
 * blocked or down it must not be able to change how this site reads, so nothing
 * here reaches off the origin. Licences sit beside the files in assets/fonts/.
 *
 *   Pretendard Variable   Korean + Latin body, UI, product copy.
 *     Hangul drawn for screen at small sizes — open counters, a tall x-height,
 *     even colour — so 400 at 16px stays solid on a dark field where a lighter
 *     weight silvers out. One variable file covers 400 through 600.
 *
 *   Instrument Sans       English display lines only.
 *     A humanist grotesque with a hand in it: single-storey g, angled y, flared
 *     R. It gives 'Recovery has many languages.' warmth without ornament, which
 *     is the register the brand needs and the one a neutral grotesque (Inter,
 *     Helvetica) cannot reach.
 *
 *   IBM Plex Mono         System readouts only — 95°C, 3 min, Scene 02.
 *     Two weights, Latin only. It never sets a word a person wrote.
 *
 * ---- On the Pretendard file -------------------------------------------------
 * Pretendard ships a 92-chunk dynamic subset, which is the right build for a
 * site whose Korean is unknown until a visitor arrives. This site's is known:
 * every character it can display lives in index.html, js/data.js and js/app.js.
 * Measured, the dynamic build pulled 17 chunks and 428KB on a first visit,
 * because SOOM's Korean is spread thinly across the syllable block. Cutting one
 * file to the 503 characters actually used is 1 request and 90KB.
 *
 * tools/build-fonts.py regenerates it. Run that after any copy change. A
 * character that is missing from the subset falls through to the metric-matched
 * 'Pretendard Fallback' below rather than breaking anything.
 * ========================================================================== */

/* ---- Pretendard Variable — subset to this site's glyph set --------------- */
/* Copyright (c) 2021 Kil Hyung-jin, Reserved Font Name Pretendard. SIL OFL 1.1. */
@font-face {
  font-family: 'Pretendard Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 400 600;
  src: url('../assets/fonts/pretendard/PretendardVariable.soom.woff2') format('woff2');
}

/* ---- Instrument Sans (Latin, variable weight) --------------------------- */
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  src: url('../assets/fonts/instrument/InstrumentSans-Latin-wght.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+2074, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---- IBM Plex Mono (Latin, 400/500) --------------------------------------
   Used for system readouts alone, so it needs no Hangul and no display size. */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url('../assets/fonts/plex-mono/IBMPlexMono-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url('../assets/fonts/plex-mono/IBMPlexMono-500.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215;
}

/* ---- Metric-matched fallbacks --------------------------------------------
   These stand in while the real faces stream, and permanently for any glyph the
   subset does not carry. The overrides are measured against Pretendard, so the
   line count and the box height do not change when the real face arrives:
   measured CLS contribution with fonts blocked entirely is 0. */
@font-face {
  font-family: 'Pretendard Fallback';
  src: local('Apple SD Gothic Neo'), local('Malgun Gothic'), local('Segoe UI'),
    local('Roboto'), local('Helvetica Neue'), local('Arial');
  size-adjust: 100.5%;
  ascent-override: 92%;
  descent-override: 22%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Instrument Fallback';
  src: local('Segoe UI'), local('Helvetica Neue'), local('Arial');
  size-adjust: 97%;
  ascent-override: 94%;
  descent-override: 24%;
  line-gap-override: 0%;
}
