/* ============================================================
   Sarabun — self-hosted (PageSpeed 3c, 2569-08-27)
   Files are Google Fonts' own already-subset woff2 output (fetched with a
   Chrome UA to get woff2 instead of ttf), thai + latin ranges only —
   latin-ext/vietnamese dropped, this is a Thai-content site. unicode-range
   values copied verbatim from Google's CSS so the browser still skips
   downloading the Thai file for a Latin-only run and vice versa.
   License: SIL OFL 1.1 — see public/assets/fonts/OFL.txt (required by license,
   not just courtesy).
   weight 300 dropped (2569-08-28, PageSpeed render-blocking investigation): grepped every .css/.html
   site-wide, only one use existed (styles.css .footer__bottom, 13.5px low-contrast line) — switched
   that to 400 and removed both 300 woff2 files, cutting 2 of the 10 font requests fonts.css triggers.
   ============================================================ */

@font-face {
  font-family: 'Sarabun';
  font-style: normal;
  font-weight: 400;
  /* optional (not swap): this weight is preloaded on index.html's hero/body text — if it
     doesn't arrive in the ~100ms block window we'd rather keep the fallback for this paint
     than swap in later and reflow (CLS regression found 2569-08-27, right after self-hosting) */
  font-display: optional;
  src: url(/assets/fonts/sarabun-thai-400.woff2) format('woff2');
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: 'Sarabun';
  font-style: normal;
  font-weight: 400;
  font-display: optional;
  src: url(/assets/fonts/sarabun-latin-400.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: 'Sarabun';
  font-style: normal;
  font-weight: 500;
  font-display: optional; /* CLS fix 2569-09-03 — weight 500/600/700 was the last of the 5 Sarabun weights still on swap; 400/800 already switched to optional 2569-08-27 for the exact same reason (root-caused via Opus 5 consult: non-preloaded swap weights racing first paint on throttled mobile, reflowing .vsub/.vtag/.vstats/.gcard line-wraps) */
  src: url(/assets/fonts/sarabun-thai-500.woff2) format('woff2');
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: 'Sarabun';
  font-style: normal;
  font-weight: 500;
  font-display: optional; /* CLS fix 2569-09-03 — weight 500/600/700 was the last of the 5 Sarabun weights still on swap; 400/800 already switched to optional 2569-08-27 for the exact same reason (root-caused via Opus 5 consult: non-preloaded swap weights racing first paint on throttled mobile, reflowing .vsub/.vtag/.vstats/.gcard line-wraps) */
  src: url(/assets/fonts/sarabun-latin-500.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: 'Sarabun';
  font-style: normal;
  font-weight: 600;
  font-display: optional; /* CLS fix 2569-09-03 — weight 500/600/700 was the last of the 5 Sarabun weights still on swap; 400/800 already switched to optional 2569-08-27 for the exact same reason (root-caused via Opus 5 consult: non-preloaded swap weights racing first paint on throttled mobile, reflowing .vsub/.vtag/.vstats/.gcard line-wraps) */
  src: url(/assets/fonts/sarabun-thai-600.woff2) format('woff2');
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: 'Sarabun';
  font-style: normal;
  font-weight: 600;
  font-display: optional; /* CLS fix 2569-09-03 — weight 500/600/700 was the last of the 5 Sarabun weights still on swap; 400/800 already switched to optional 2569-08-27 for the exact same reason (root-caused via Opus 5 consult: non-preloaded swap weights racing first paint on throttled mobile, reflowing .vsub/.vtag/.vstats/.gcard line-wraps) */
  src: url(/assets/fonts/sarabun-latin-600.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: 'Sarabun';
  font-style: normal;
  font-weight: 700;
  font-display: optional; /* CLS fix 2569-09-03 — weight 500/600/700 was the last of the 5 Sarabun weights still on swap; 400/800 already switched to optional 2569-08-27 for the exact same reason (root-caused via Opus 5 consult: non-preloaded swap weights racing first paint on throttled mobile, reflowing .vsub/.vtag/.vstats/.gcard line-wraps) */
  src: url(/assets/fonts/sarabun-thai-700.woff2) format('woff2');
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: 'Sarabun';
  font-style: normal;
  font-weight: 700;
  font-display: optional; /* CLS fix 2569-09-03 — weight 500/600/700 was the last of the 5 Sarabun weights still on swap; 400/800 already switched to optional 2569-08-27 for the exact same reason (root-caused via Opus 5 consult: non-preloaded swap weights racing first paint on throttled mobile, reflowing .vsub/.vtag/.vstats/.gcard line-wraps) */
  src: url(/assets/fonts/sarabun-latin-700.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: 'Sarabun';
  font-style: normal;
  font-weight: 800;
  font-display: optional; /* see weight 400 comment above — same reasoning, hero H1 uses this weight */
  src: url(/assets/fonts/sarabun-thai-800.woff2) format('woff2');
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: 'Sarabun';
  font-style: normal;
  font-weight: 800;
  font-display: optional;
  src: url(/assets/fonts/sarabun-latin-800.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;
}

/* ============================================================
   "Sarabun Fallback" — metric-matched proxy face (2569-09-03, PageSpeed CLS=0.18
   investigation, root-caused via 5 fresh PSI API runs to <aside class="gcard"> —
   the admission card — reflowing when weight 600/700/800 arrive after first
   paint under font-display:swap).

   IMPORTANT: these overrides are NOT applied to the real 'Sarabun' @font-face
   above (that would just scale the loaded webfont itself — real Sarabun 600-800
   text would render larger than 400/500, a visible regression). Instead this is
   a separate family that only ever gets *selected* as a fallback — see
   styles.h-*.css body font-family, "Sarabun Fallback" sits right after "Sarabun"
   in the stack. Sarabun itself is untouched.

   local() chain tries, in order: Leelawadee UI (Windows' Thai UI font since
   Win8, has full Latin too), Noto Sans Thai (Android/ChromeOS — this is what
   PSI's mobile Lighthouse runs actually resolve to), Thonburi (macOS Thai),
   Arial (final metric-only fallback — no Thai glyphs, but at least keeps
   Latin/digit metrics sane on a platform with none of the above).

   Deliberately NO size-adjust: Chromium multiplies size-adjust into the
   overridden ascent/descent (effective ascent = ascent-override × size-adjust
   × font-size), so a size-adjust tuned for one local font's xAvgCharWidth
   silently reintroduces a vertical-metrics error on any *other* font the
   local() chain actually resolves to at runtime — measured concretely: sizing
   against Leelawadee UI Regular (xAvg 1103/2048) is ~9% off Leelawadee UI
   BOLD (xAvg 1208/2048, the one Chromium actually picks for weight 600-800),
   and both are off again from Noto Sans Thai (Android — instanced its
   variable font at wght=700: xAvg 606/1000, completely different ratio), and
   Thonburi's metrics aren't verifiable at all here (no local file to measure).
   ascent-override/descent-override/line-gap-override don't have this problem
   — they're flat percentages of the em applied identically no matter which
   local face resolves or which static instance (Regular/Bold) it picks — so
   this rule leans on those alone for the vertical box-height match that
   actually kills the aside.gcard reflow, and accepts default (100%, i.e. the
   local font's own) horizontal glyph width. That's a smaller/rarer residual
   CLS/reflow risk (only matters if it shifts a line-wrap point) than the
   vertical box-height mismatch this whole investigation is about.

   Metrics: Sarabun OS/2.sTypoAscender=1068/upm=1000 (fsSelection
   USE_TYPO_METRICS bit set, so typo metrics are the spec-correct source) →
   ascent-override 106.8%, descent-override 23.2%, line-gap-override 0% — same
   across all weights, Sarabun is a static family sharing one vertical design.
   font-weight: 400 800 (a range, one rule) since these three values don't
   depend on which weight/static-instance local() resolves to. */
@font-face {
  font-family: 'Sarabun Fallback';
  font-style: normal;
  font-weight: 400 800;
  src: local('Leelawadee UI'), local('Noto Sans Thai'), local('Thonburi'), local('Arial');
  font-display: swap;
  ascent-override: 106.8%;
  descent-override: 23.2%;
  line-gap-override: 0%;
}
