/* ============================================
   NJS THEME — Self-hosted font-face declarations
   NJ Swingsets & Playgrounds — njswingsets-2026

   Barlow Condensed 700 (headings, buttons, nav labels) -- replaced Oswald 500
   2026-09-26 (Jay: "go" after the heading-font mockup). The Oswald file and its
   face stay in the theme so a revert is one --font-heading edit in theme.css.
   Inter 400 (body, long-form content, form fields)

   Self-hosted WOFF2 — no external CDN request.
   See assets/fonts/FONTS.md for exact source/version/license.
   ============================================ */

@font-face {
	font-family: 'Oswald';
	src: url('../fonts/oswald/oswald-v57-latin-500.woff2') format('woff2');
	font-weight: 500;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: 'Barlow Condensed';
	src: url('../fonts/barlow-condensed/barlow-condensed-v13-latin-700.woff2') format('woff2');
	/* One Bold file serves every weight the theme asks of the heading font
	   (500/600/700), so nothing is faux-bolded or faux-thinned. */
	font-weight: 500 700;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: 'Inter';
	src: url('../fonts/inter/inter-v20-latin-400.woff2') format('woff2');
	font-weight: 400;
	font-style: normal;
	font-display: swap;
}

/* Inter 700 (quick 261009-b55, rulings S4): <b>/<strong> asked for 700 and got the
   400 face, so bold rendered light. Provenance in assets/fonts/FONTS.md. */
@font-face {
	font-family: 'Inter';
	src: url('../fonts/inter/inter-v20-latin-700.woff2') format('woff2');
	font-weight: 700;
	font-style: normal;
	font-display: swap;
}

/* ============================================
   FONT-METRIC-OVERRIDE FALLBACKS (13-14 Task 3, PERF-02/D-08 CLS fix)

   The category page measured CLS 0.2114 (bar: <0.1) in 13-14's Lighthouse lab
   run, traced to `font-display: swap` above: the system fallback renders
   first with different box-model metrics than Oswald/Inter, then the real
   webfont swaps in and reflows the hero heading/tagline. `font-display` stays
   `swap` (never `optional` — that would occasionally strand first-time
   visitors on the wrong brand font for the whole page view); instead these
   two local-only @font-face declarations give the FALLBACK render an
   `ascent-override`/`descent-override`/`line-gap-override`/`size-adjust` box
   that matches Oswald/Inter's real metrics, so the swap causes no layout
   shift regardless of how long the download takes.

   Values are NOT estimated -- extracted from the real files' own `head`/
   `hhea`/`OS/2` tables (unitsPerEm, ascent, descent, lineGap, xAvgCharWidth)
   against a real local Arial.ttf, using the standard Chrome DevTools
   "font fallback" formula (https://developer.chrome.com/blog/font-fallbacks):
     size-adjust        = (web xAvgCharWidth/upm) / (fallback xAvgCharWidth/upm)
     ascent-override     = (web ascent/upm)  / size-adjust
     descent-override    = (web |descent|/upm) / size-adjust
     line-gap-override   = (web lineGap/upm) / size-adjust
   Source metrics — Oswald (oswald-v57-latin-500.woff2): upm 1000, ascent
   1193, descent -289, lineGap 0, xAvgCharWidth 452. Inter
   (inter-v20-latin-400.woff2): upm 2048, ascent 1984, descent -494, lineGap
   0, xAvgCharWidth 1250. Fallback (Arial.ttf, macOS
   /System/Library/Fonts/Supplemental/Arial.ttf): upm 2048, ascent 1854,
   descent -434, lineGap 67, xAvgCharWidth 904.

   These faces are appended to --font-heading/--font-body in theme.css
   (`'Oswald', 'Oswald Fallback', sans-serif` / `'Inter', 'Inter Fallback',
   sans-serif`) so the browser paints this metric-matched local face before
   Oswald/Inter arrive, then swaps with (as close to) zero shift.
   ============================================ */

@font-face {
	font-family: 'Oswald Fallback';
	src: local('Arial');
	ascent-override: 116.5%;
	descent-override: 28.22%;
	line-gap-override: 0%;
	size-adjust: 102.4%;
}

/* Barlow Condensed (barlow-condensed-v13-latin-700.woff2): upm 1000, ascent
   1000, descent -200, lineGap 0, xAvgCharWidth 428 (read with fontTools
   2026-09-26), against the same Arial fallback, same formula as above. */
@font-face {
	font-family: 'Barlow Condensed Fallback';
	src: local('Arial');
	ascent-override: 103.13%;
	descent-override: 20.63%;
	line-gap-override: 0%;
	size-adjust: 96.96%;
}

@font-face {
	font-family: 'Inter Fallback';
	src: local('Arial');
	ascent-override: 70.06%;
	descent-override: 17.44%;
	line-gap-override: 0%;
	size-adjust: 138.27%;
}
