/*
 * Self-hosted editorial fonts, subset for Romanian.
 * Source Sans 3 + Source Serif 4, plus IBM Plex Sans and Libre Franklin
 * as selectable site typefaces — SIL Open Font License 1.1.
 *
 * One file per family, built by bin/build-fonts.py from the upstream variable
 * masters. The four generic Google subsets this replaces cost 304.7 KB over the
 * wire, of which 161 KB was the `latin-ext` pair — needed only for ă Ă ș Ș ț Ț,
 * because â î Â Î already live in `latin`. The Romanian characters are now inside
 * the latin file, so `latin-ext` is not a second request, and the weight axis is
 * clipped to the 400–700 that `font-weight` below actually exposes.
 *
 * unicode-range is generated from the code points each file really contains, not
 * from the range that was requested: a range that claims more than the file holds
 * renders tofu where it should fall back to the next family in the stack, and the
 * two families do not cover exactly the same punctuation. Do not edit these lists
 * by hand — rerun bin/build-fonts.py, and bin/verify-fonts.php will tell you if the
 * declaration and the file have drifted apart.
 *
 * Characters outside the ranges (Cyrillic, Hungarian ő ű, Turkish ğ, Polish ł)
 * fall back per character to Georgia / the system sans. That is deliberate: this
 * is a Romanian-language network, and carrying Latin Extended-A for the rare
 * foreign surname would put back a fifth of the bytes that were just removed.
 */

@font-face {
	font-display: optional;
	font-family: "Source Sans 3";
	font-style: normal;
	font-weight: 400 700;
	src: url("../fonts/source-sans-3-latin-ro.woff2") format("woff2");
	unicode-range: U+0020-007E, U+00A0-00FF, U+0102-0103, U+0131, U+0152-0153, U+015E-015F, U+0162-0163, U+0218-021B, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2007, U+2009-200B, U+2010-201E, U+2020-2023, U+2026, U+202F-2033, U+2035, U+2039-203A, U+203C-203F, U+2044, U+2047-204A, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF;
}

@font-face {
	font-display: swap;
	font-family: "Source Serif 4";
	font-style: normal;
	font-weight: 400 700;
	src: url("../fonts/source-serif-4-latin-ro.woff2") format("woff2");
	unicode-range: U+0020-007E, U+00A0-00FF, U+0102-0103, U+0131, U+0152-0153, U+015E-015F, U+0162-0163, U+0218-021B, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2002-2007, U+2009-200B, U+2010, U+2012-2015, U+2018-201A, U+201C-201E, U+2020-2022, U+2025-2026, U+202F-2030, U+2032-2033, U+2039-203A, U+203C, U+2044, U+2047-2049, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215;
}

@font-face {
	font-display: optional;
	font-family: "IBM Plex Sans";
	font-style: normal;
	font-weight: 400 700;
	src: url("../fonts/ibm-plex-sans-latin-ro.woff2") format("woff2");
	unicode-range: U+0020-007E, U+00A0-00FF, U+0102-0103, U+0131, U+0152-0153, U+015E-015F, U+0162-0163, U+0218-021B, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+2000-200D, U+2010-2015, U+2018-201A, U+201C-201E, U+2020-2022, U+2026, U+2028-2029, U+202F-2030, U+2032-2033, U+2039-203A, U+2044, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-display: optional;
	font-family: "Libre Franklin";
	font-style: normal;
	font-weight: 400 700;
	src: url("../fonts/libre-franklin-latin-ro.woff2") format("woff2");
	unicode-range: U+0020-007E, U+00A0-00AC, U+00AE-00FF, U+0102-0103, U+0131, U+0152-0153, U+015E-015F, U+0162-0163, U+0218-021B, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+2007-200B, U+2010, U+2012-2015, U+2018-201A, U+201C-201E, U+2020-2022, U+2026, U+2030, U+2032-2033, U+2039-203A, U+2044, U+2052, U+20AC, U+2122, U+2212, U+2215;
}

/*
 * ---------------------------------------------------------------------------------
 * Metric-compatible fallbacks.
 *
 * `font-display: swap` above means the reader sees a system font first and the webfont
 * a moment later. The two do not measure the same, so the article reflows under the
 * reader's eye when the swap happens: on a live article this was 101px of the body copy
 * moving at 1440px and 90px at 390px, with individual paragraphs gaining or losing a
 * whole line. Each face below re-measures one system font so the substitution occupies
 * the same space, and the swap becomes invisible.
 *
 * HOW THE NUMBERS WERE OBTAINED, which matters more than the numbers.
 *
 * They are computed from font metric tables -- unitsPerEm, hhea ascent/descent/lineGap
 * and the per-glyph advances in hmtx -- and never from rendering. Rendering was not an
 * option: this server has no Georgia, no Segoe UI, no Roboto and no SF, and asking it to
 * render `Georgia` silently produces something else. It is not a hypothetical. Measured
 * with the webfonts blocked, the page here falls back to Liberation Serif and Liberation
 * Sans, so anything "measured on Georgia" on this machine would have described the
 * metrics of Times New Roman, which is 12 percentage points away.
 *
 * For the fonts with no binary to read, the binary used is the metric-compatible clone
 * that exists for exactly this purpose -- Gelasio for Georgia, Liberation Serif for Times
 * New Roman, Liberation Sans for Arial. Each clone was checked against the published
 * average advance of the font it stands in for and agreed to within 1.42% (Liberation
 * Serif to 0.02%), which is what licenses the substitution. Segoe UI has no clone
 * available and keeps the published figure alone; it is the one line here with no second
 * source, and the cross-checks put its likely error near 1.5%.
 *
 * The advances are weighted by the character frequency of this site's own copy -- all 96
 * published posts and pages, 683,570 characters -- rather than by the English table these
 * calculations usually borrow. The two languages do not share a shape: English gives `h`
 * 6.09% against 0.28% here, and 5.1% of the characters on this site are ă ț ș î â, which
 * English does not have at all. Segoe UI is the exception and is computed on the English
 * weighting on both sides of its ratio, because that is the weighting its published figure
 * used and a ratio taken across two languages is not a ratio.
 *
 * The method was then validated against the exact answer, the summed advance of a real
 * Romanian paragraph glyph by glyph: it predicted that to within 0.20 percentage points
 * on average and 0.51 at worst.
 *
 * TWO TRAPS, recorded because both produce numbers that look right.
 *
 * Source Sans 3's default variable instance is ExtraLight 200, not Regular 400. Reading
 * its advances straight out of the file therefore measures a weight the site hardly uses
 * -- 0.38032/em against 0.40014/em at Regular. That 5% error lands in the divisor of
 * every sans ratio below, and nothing about the result looks wrong. The axis has to be
 * pinned to 400 before measuring.
 *
 * Source Serif 4 carries an optical size axis and the browser tracks it with the font
 * size, so the webfont's own advances change with context: 0.48694/em at opsz 8, 0.43050
 * at 20, 0.39055 at 60. A fallback has no such axis, so one value has to serve the whole
 * page -- and the body copy is not one size either, running 16.32px on mobile against
 * 19.2px on desktop. Times New Roman needs 116.63% at the mobile size and 112.12% at
 * opsz 20; no single number is right twice.
 *
 * So the basis was measured rather than argued. Four candidates were run against the full
 * page matrix, counting blocks whose height moves at the swap: opsz 16.32 left 39 of 1184
 * moving, opsz 18 left 27, opsz 19.2 left 33, opsz 20 left 50. The serif faces below are
 * derived at opsz 18, which is not a size the theme uses anywhere -- it is simply where
 * the worst case is smallest, because a line either flips or it does not and there is no
 * credit for being close. Re-run bin/derive-font-fallbacks.py's sweep before moving it.
 *
 * The headline is knowingly left wide in the fallback for the same reason; it stayed on
 * two lines in both fonts at every width measured, so it was not worth trading away.
 *
 * size-adjust matches advance widths rather than x-heights, because the goal is to stop
 * the text moving. Georgia has a large x-height, so during the swap it looks a touch
 * bigger than the webfont it stands in for; that is the accepted side of the trade.
 *
 * Each face declares only Regular. Bold text uses it with a synthetic weight during the
 * swap, which is what happens today. A per-weight face was considered and dropped: the
 * ratio does move with weight (Georgia's bold is 11.6 points off its regular), but there
 * is no second source to check a bold clone against, and shipping an unverifiable
 * adjustment is the mistake this comment exists to prevent.
 *
 * Regenerate with bin/derive-font-fallbacks.py, which prints the cross-checks too.
 * ---------------------------------------------------------------------------------
 */

/* Windows, macOS, iOS. Georgia is the closest of the set, 3.82% narrow at this basis. */
@font-face {
	ascent-override: 99.64%;
	descent-override: 32.22%;
	font-family: "ARC Serif fallback Georgia";
	line-gap-override: 0%;
	size-adjust: 103.97%;
	src: local("Georgia");
}

/* Android, the larger audience, where the untouched fallback runs 4.72% wide. */
@font-face {
	ascent-override: 108.49%;
	descent-override: 35.08%;
	font-family: "ARC Serif fallback Noto Serif";
	line-gap-override: 0%;
	size-adjust: 95.5%;
	src: local("Noto Serif");
}

/*
 * Windows or macOS with Georgia removed, plus Linux and ChromeOS. The widest gap of the
 * serif set at 12.73% narrow, and the face that made the paragraphs on this server lose
 * a line each.
 *
 * Three names for one face, because local() does not follow a fontconfig alias. This
 * server has no Times New Roman; fontconfig substitutes Liberation Serif for it, and a
 * plain `font-family: "Times New Roman"` gets that substitute -- but local("Times New
 * Roman") matches nothing, so the first version of this face silently did not engage and
 * the measured reflow did not budge. Liberation Serif and Tinos are metric clones of
 * Times New Roman, which is what makes listing them here correct rather than convenient:
 * identical advances take the identical adjustment. It is also what makes the Linux and
 * ChromeOS readers, and this server's own audits, land on an adjusted face at all.
 */
@font-face {
	ascent-override: 90.42%;
	descent-override: 29.24%;
	font-family: "ARC Serif fallback Times New Roman";
	line-gap-override: 0%;
	size-adjust: 114.58%;
	src: local("Times New Roman"), local("Liberation Serif"), local("Tinos");
}

/* Linux where DejaVu wins over Liberation, 12.27% wide untouched. */
@font-face {
	ascent-override: 116.31%;
	descent-override: 37.61%;
	font-family: "ARC Serif fallback DejaVu Serif";
	line-gap-override: 0%;
	size-adjust: 89.07%;
	src: local("DejaVu Serif");
}

/* Windows. The one entry below resting on a single source; see the note above. */
@font-face {
	ascent-override: 106.84%;
	descent-override: 41.74%;
	font-family: "ARC Sans fallback Segoe UI";
	line-gap-override: 0%;
	size-adjust: 95.84%;
	src: local("Segoe UI");
}

/* Android. */
@font-face {
	ascent-override: 107.98%;
	descent-override: 42.18%;
	font-family: "ARC Sans fallback Roboto";
	line-gap-override: 0%;
	size-adjust: 94.84%;
	src: local("Roboto");
}

/* Linux, and Android releases before Roboto. The widest sans gap, 13.07%. */
@font-face {
	ascent-override: 115.42%;
	descent-override: 45.09%;
	font-family: "ARC Sans fallback Noto Sans";
	line-gap-override: 0%;
	size-adjust: 88.72%;
	src: local("Noto Sans");
}

/*
 * The last net, and the one that catches this server. Arimo and Liberation Sans are
 * metric clones of Arial, so they share its adjustment exactly; see the Times New Roman
 * face above for why naming them is necessary rather than tidy.
 */
@font-face {
	ascent-override: 108.46%;
	descent-override: 42.37%;
	font-family: "ARC Sans fallback Arial";
	line-gap-override: 0%;
	size-adjust: 94.41%;
	src: local("Arial"), local("Liberation Sans"), local("Arimo");
}

/* Linux where DejaVu wins. The widest gap in the whole set, 21.08%. */
@font-face {
	ascent-override: 124.59%;
	descent-override: 48.67%;
	font-family: "ARC Sans fallback DejaVu Sans";
	line-gap-override: 0%;
	size-adjust: 82.19%;
	src: local("DejaVu Sans");
}

/*
 * ---------------------------------------------------------------------------------
 * The same four families again, for the title only.
 *
 * The faces above are derived at optical size 18, which is body copy, and the note
 * with them said the headline was knowingly left wide because it "stayed on two lines
 * in both fonts at every width measured". That stopped being true. Source Serif 4
 * narrows as it grows -- at 63px it sets 9.6% tighter per em than at 19px -- so at
 * desktop title sizes the body-tuned fallback overshoots by more than a line's worth
 * of text, and the title reflows when the webfont lands. Measured on the live site
 * with a cold cache on slow 4G, desktop 1440: /articole-seo-iasi/ title 205px in the
 * fallback against 137px in the webfont, page CLS 0.2209; /advertoriale-seo-iasi/
 * 0.2153; /comunicate-de-presa-iasi/ 0.1314. Mobile was already clean, because a 23px
 * title is close enough to the body basis.
 *
 * Basis chosen the way the body basis was: candidates swept over 48 titles (7 pages x
 * 8 viewports from 390 to 1920), counting the ones that change line count when the
 * webfont replaces the fallback. Measured in a browser, on the Times New Roman face,
 * because that is the one that resolves on a Linux container -- ours and, by the look
 * of its font list, PageSpeed's:
 *
 *     opsz 18 (shipped, body)     11 of 48 titles flip
 *     opsz 30                      4
 *     opsz 40                      0
 *     opsz 45                      2
 *     opsz 50                      4
 *     opsz 60                      5
 *
 * 40 wins at both ends: tighter bases start flipping small titles the other way, wider
 * ones keep flipping large titles. Because it holds from 390px to 1920px there is no
 * media query here -- one face serves every title size.
 *
 * These are the bold weight in use, which the arithmetic does not model: the fallback
 * families all ship a real Bold, so no synthesis happens, and Source Serif 4's own bold
 * is 3.5% wider than its regular. On the two families a browser here can resolve, the
 * regular-based derivation lands within 2.3 points of the measured bold requirement
 * (Liberation Serif needs 102.52% at 63px against 101.72% derived, DejaVu Serif 81.39%
 * against 79.07%), so the derivation is used as-is rather than fitted per weight.
 *
 * Regenerate with: bin/derive-font-fallbacks.py --opsz 40 --name display --css
 * Applied in premium.css, on the post title alone.
 * ---------------------------------------------------------------------------------
 */

/* Windows, macOS, iOS: rezerva neajustata deviaza +2.99%. */
@font-face {
	ascent-override: 106.7%;
	descent-override: 34.5%;
	font-family: "ARC Serif display Georgia";
	line-gap-override: 0%;
	size-adjust: 97.1%;
	src: local("Georgia");
}

/* Android: rezerva neajustata deviaza +12.13%. */
@font-face {
	ascent-override: 116.17%;
	descent-override: 37.56%;
	font-family: "ARC Serif display Noto Serif";
	line-gap-override: 0%;
	size-adjust: 89.18%;
	src: local("Noto Serif");
}

/* Windows/macOS fara Georgia, Linux, ChromeOS: rezerva neajustata deviaza -6.55%. */
@font-face {
	ascent-override: 96.82%;
	descent-override: 31.31%;
	font-family: "ARC Serif display Times New Roman";
	line-gap-override: 0%;
	size-adjust: 107.01%;
	src: local("Times New Roman"), local("Liberation Serif"), local("Tinos");
}

/* Linux: rezerva neajustata deviaza +20.22%. */
@font-face {
	ascent-override: 124.55%;
	descent-override: 40.27%;
	font-family: "ARC Serif display DejaVu Serif";
	line-gap-override: 0%;
	size-adjust: 83.18%;
	src: local("DejaVu Serif");
}

/*
 * And once more for the article body on wide screens.
 *
 * The body basis above is a compromise between two sizes -- 16.32px on a phone and
 * 19.2px on a desktop -- because one face had to serve both. It does not: below
 * 1280px the article body is set in Source Sans 3, and only from 1280px up does it
 * switch to the serif, at 18.88-22px. So the serif body fallback can be derived at
 * the size it is actually used at, and applied behind the same breakpoint, without
 * touching what a phone gets.
 *
 * Basis picked by the same flip count, one level down from the title: 1528 blocks of
 * text -- every paragraph, list item and subheading over 40 characters on 6 pages x 4
 * widths from 1280 to 1920 -- counting the ones whose height changes when the webfont
 * replaces the fallback.
 *
 *     opsz 18 (shipped compromise)   51 of 1528 blocks move
 *     opsz 19.2                      29
 *     opsz 21 .. opsz 30             23   (flat: 111.20%, 111.12%, 110.58%, 109.55%)
 *     opsz 34                        28
 *
 * The minimum is a plateau rather than a point, so the basis taken is its middle, 26,
 * which is the value least likely to fall off either edge when an article is written
 * that none of these six anticipated. The remaining 23 are single lines in paragraphs
 * where the two fonts land either side of a break; no static metric removes those.
 *
 * Regenerate with: bin/derive-font-fallbacks.py --opsz 26 --name text --css
 */

/* Windows, macOS, iOS: rezerva neajustata deviaza -0.34%. */
@font-face {
	ascent-override: 103.25%;
	descent-override: 33.39%;
	font-family: "ARC Serif text Georgia";
	line-gap-override: 0%;
	size-adjust: 100.34%;
	src: local("Georgia");
}

/* Android: rezerva neajustata deviaza +8.50%. */
@font-face {
	ascent-override: 112.41%;
	descent-override: 36.35%;
	font-family: "ARC Serif text Noto Serif";
	line-gap-override: 0%;
	size-adjust: 92.16%;
	src: local("Noto Serif");
}

/* Windows/macOS fara Georgia, Linux, ChromeOS: rezerva neajustata deviaza -9.57%. */
@font-face {
	ascent-override: 93.69%;
	descent-override: 30.29%;
	font-family: "ARC Serif text Times New Roman";
	line-gap-override: 0%;
	size-adjust: 110.58%;
	src: local("Times New Roman"), local("Liberation Serif"), local("Tinos");
}

/* Linux: rezerva neajustata deviaza +16.33%. */
@font-face {
	ascent-override: 120.52%;
	descent-override: 38.97%;
	font-family: "ARC Serif text DejaVu Serif";
	line-gap-override: 0%;
	size-adjust: 85.96%;
	src: local("DejaVu Serif");
}

/*
 * IBM Plex Sans fallbacks. Same system faces as Source Sans, re-measured against
 * the Plex subset. Regenerated with:
 *   python3 bin/derive-font-fallbacks.py --sans assets/fonts/ibm-plex-sans-latin-ro.woff2 --name plex --group sans --css
 */

/* Windows: rezerva neajustata deviaza -2.67%. */
@font-face {
	ascent-override: 99.77%;
	descent-override: 26.77%;
	font-family: "ARC Sans plex Segoe UI";
	line-gap-override: 0%;
	size-adjust: 102.74%;
	src: local("Segoe UI");
}

/* Android: rezerva neajustata deviaza -1.82%. */
@font-face {
	ascent-override: 100.64%;
	descent-override: 27%;
	font-family: "ARC Sans plex Roboto";
	line-gap-override: 0%;
	size-adjust: 101.85%;
	src: local("Roboto");
}

/* Linux, Android vechi: rezerva neajustata deviaza +4.95%. */
@font-face {
	ascent-override: 107.58%;
	descent-override: 28.86%;
	font-family: "ARC Sans plex Noto Sans";
	line-gap-override: 0%;
	size-adjust: 95.28%;
	src: local("Noto Sans");
}

/* ultima plasa, Linux, ChromeOS: rezerva neajustata deviaza -1.38%. */
@font-face {
	ascent-override: 101.09%;
	descent-override: 27.12%;
	font-family: "ARC Sans plex Arial";
	line-gap-override: 0%;
	size-adjust: 101.4%;
	src: local("Arial"), local("Liberation Sans"), local("Arimo");
}

/* Linux: rezerva neajustata deviaza +13.29%. */
@font-face {
	ascent-override: 116.12%;
	descent-override: 31.16%;
	font-family: "ARC Sans plex DejaVu Sans";
	line-gap-override: 0%;
	size-adjust: 88.27%;
	src: local("DejaVu Sans");
}

/*
 * Libre Franklin fallbacks. Regenerated with:
 *   python3 bin/derive-font-fallbacks.py --sans assets/fonts/libre-franklin-latin-ro.woff2 --name franklin --group sans --css
 */

/* Windows: rezerva neajustata deviaza -5.95%. */
@font-face {
	ascent-override: 90.86%;
	descent-override: 23.14%;
	font-family: "ARC Sans franklin Segoe UI";
	line-gap-override: 0%;
	size-adjust: 106.32%;
	src: local("Segoe UI");
}

/* Android: rezerva neajustata deviaza -4.22%. */
@font-face {
	ascent-override: 92.52%;
	descent-override: 23.56%;
	font-family: "ARC Sans franklin Roboto";
	line-gap-override: 0%;
	size-adjust: 104.4%;
	src: local("Roboto");
}

/* Linux, Android vechi: rezerva neajustata deviaza +2.39%. */
@font-face {
	ascent-override: 98.91%;
	descent-override: 25.19%;
	font-family: "ARC Sans franklin Noto Sans";
	line-gap-override: 0%;
	size-adjust: 97.67%;
	src: local("Noto Sans");
}

/* ultima plasa, Linux, ChromeOS: rezerva neajustata deviaza -3.79%. */
@font-face {
	ascent-override: 92.94%;
	descent-override: 23.67%;
	font-family: "ARC Sans franklin Arial";
	line-gap-override: 0%;
	size-adjust: 103.94%;
	src: local("Arial"), local("Liberation Sans"), local("Arimo");
}

/* Linux: rezerva neajustata deviaza +10.52%. */
@font-face {
	ascent-override: 106.76%;
	descent-override: 27.19%;
	font-family: "ARC Sans franklin DejaVu Sans";
	line-gap-override: 0%;
	size-adjust: 90.48%;
	src: local("DejaVu Sans");
}
