/*
 * Self-hosted webfonts — Barlow (body/UI) + Barlow Condensed (headings).
 * WOFF2 latin subsets only (~22 KB each). font-display: swap.
 *
 * Fallback faces are metric-matched so the swap causes no layout shift:
 * size-adjust = Barlow avg-char-width / donor avg-char-width, then
 * ascent/descent overrides are the Barlow metrics divided by size-adjust.
 * Donors: Arial (Barlow), Arial Narrow (Barlow Condensed).
 */

@font-face {
	font-family: "Barlow";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/barlow-400-latin.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: "Barlow";
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url("../fonts/barlow-600-latin.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: "Barlow Condensed";
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url("../fonts/barlow-condensed-700-latin.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;
}

/* Metric-matched fallbacks.
 *
 * size-adjust is measured, not derived: computing it from avg-char-width without
 * normalising the two fonts' differing unitsPerEm scales the donor the wrong way
 * and leaves the fallback materially wider than the real face. The values below
 * come from rendering representative UI strings in each face and comparing
 * advance widths; every fallback/real width ratio measures within 0.4% of 1.000.
 *
 * Fallback width accuracy is load-bearing rather than cosmetic: the benefits
 * sub-nav sits at its flex-wrap threshold, so a fallback even slightly too wide
 * wraps the chip row onto two lines and collapses it back when Barlow arrives,
 * shifting everything below.
 *
 * 400 and 600 need different adjustments (Barlow 600 is proportionally closer to
 * Arial than 400 is), so they get a face each rather than one compromise value —
 * font-weight: 600 text is what the sub-nav and most UI chrome actually use.
 *
 * ascent/descent are the real Barlow metrics (1.00 em / 0.20 em, both families)
 * divided by that face's size-adjust, which is what keeps the line box identical
 * across the swap. Verified: 'Hg' at 100px measures 160px tall in every face,
 * real and fallback alike. Recompute both overrides if size-adjust ever changes.
 * Donors: Arial (Barlow), Arial Narrow (Barlow Condensed).
 */

@font-face {
	font-family: "Barlow-fallback";
	font-weight: 400;
	src: local("Arial");
	size-adjust: 97.4%;
	ascent-override: 102.67%;
	descent-override: 20.53%;
	line-gap-override: 0%;
}

@font-face {
	font-family: "Barlow-fallback";
	font-weight: 600;
	src: local("Arial");
	size-adjust: 99.24%;
	ascent-override: 100.77%;
	descent-override: 20.15%;
	line-gap-override: 0%;
}

@font-face {
	font-family: "Barlow Condensed-fallback";
	font-weight: 700;
	src: local("Arial Narrow");
	size-adjust: 99.92%;
	ascent-override: 100.08%;
	descent-override: 20.02%;
	line-gap-override: 0%;
}
