/**
 * Self-hosted Public Sans (replaces fonts.googleapis.com).
 *
 * Loaded BEFORE everything else so layout-affecting metrics are known
 * before paint. font-display: swap to avoid invisible-text flash.
 *
 * The "Public Sans Fallback" stub uses Arial-derived metric overrides taken
 * from Next.js's font/local optimisation for Public Sans — keeps CLS at 0
 * by making the system fallback occupy the same character box as the real
 * font during the brief swap window.
 */

@font-face {
	font-family: 'Public Sans';
	font-style: normal;
	font-weight: 300;
	font-display: swap;
	src: url('../fonts/public-sans/public-sans-v21-latin_latin-ext-300.woff2') format('woff2');
}
@font-face {
	font-family: 'Public Sans';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url('../fonts/public-sans/public-sans-v21-latin_latin-ext-regular.woff2') format('woff2');
}
@font-face {
	font-family: 'Public Sans';
	font-style: normal;
	font-weight: 500;
	font-display: swap;
	src: url('../fonts/public-sans/public-sans-v21-latin_latin-ext-500.woff2') format('woff2');
}
@font-face {
	font-family: 'Public Sans';
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url('../fonts/public-sans/public-sans-v21-latin_latin-ext-600.woff2') format('woff2');
}
@font-face {
	font-family: 'Public Sans';
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url('../fonts/public-sans/public-sans-v21-latin_latin-ext-700.woff2') format('woff2');
}
@font-face {
	font-family: 'Public Sans';
	font-style: normal;
	font-weight: 900;
	font-display: swap;
	src: url('../fonts/public-sans/public-sans-v21-latin_latin-ext-900.woff2') format('woff2');
}

/* Metric-matched fallback — keeps CLS = 0 during the swap window.
 * size-adjust + ascent/descent values from Next.js font-local generator. */
@font-face {
	font-family: 'Public Sans Fallback';
	src: local('Arial');
	size-adjust: 100.05%;
	ascent-override: 95%;
	descent-override: 25%;
	line-gap-override: 0%;
}

/* Ensure body + headings actually use the family — Tailwind config in header.php
 * already sets `font-display: ['Public Sans', 'sans-serif']`, but we make the
 * fallback chain explicit so the metric-matched stub kicks in. */
body, .font-display {
	font-family: 'Public Sans', 'Public Sans Fallback', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
