/*
 * kkbc-fonts-fallback-1.css - fallback faces that remove the shift of the text when a web font arrives (W2, 2026-10-14).
 * Loaded on every page, after css/kkbc-fonts-1.css (inc/kkbc-fonts.php). kkbc-fonts-1.css is not changed.
 * Cause: while Inter or a Noto Sans font loads (font-display: swap), the browser shows the font of the device, which is wider or
 * narrower than the web font and has other line metrics. When the web font arrives, the lines break in other places and the text
 * moves (layout shift up to 0.10 on the Hebrew and Thai blog list and the Thai privacy page).
 * Fix: for each web font a fallback family with the same name plus " Fallback". It is a font of the device (local(), nothing is
 * downloaded) with size-adjust, ascent-override, descent-override and line-gap-override set to the numbers of the web font,
 * and it stands right after the web font in --kkbc-font. A browser without that device font skips the face and uses
 * the next family of the list, as before.
 * Numbers (how they were found is in the body of the pull request):
 *   size-adjust = width of the web font / width of the device font, both measured in Chrome (kerning included) over the lines of text of
 *   the live pages he.kkbc.co.il and kkbcthailand.com (blog, privacy, home and industry pages, 2026-10-14), set in one line at 16 px.
 *   The device font is measured as Liberation Sans 2.1.5, which has the same advance widths as Arial; weight 400 and weight 700 are
 *   measured separately. Held-out check: other pages gave the same ratio within 0.1 point (Inter) and 0.2 point (Hebrew).
 *   ascent / descent / line-gap override = hhea value of the web font (read with Python fontTools from fonts/*.woff2) / unitsPerEm
 *   / size-adjust, because the browser multiplies the override by size-adjust again.
 * The faces are limited by unicode-range to the script of the web font, so that Arial (which has Latin and Hebrew) is used
 * with the right numbers for each script.
 * A later change of this file gets a new file name (kkbc-fonts-fallback-2.css): the CDN keeps a file under its old name.
 */

/* ---- Part 1: fallback faces ---- */
/* Inter, Latin: Arial scaled to the width of Inter. 400 to 599 use Arial, 600 to 900 use Arial Bold. */
@font-face {
  font-family: 'Inter Fallback';
  font-style: normal;
  font-weight: 100 599;
  src: local("Arial"), local("ArialMT"), local("Liberation Sans"), local("Arimo");
  size-adjust: 106.35%;
  ascent-override: 91.09%;
  descent-override: 22.68%;
  line-gap-override: 0.00%;
  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, U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF, U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Inter Fallback';
  font-style: normal;
  font-weight: 600 900;
  src: local("Arial Bold"), local("Arial-BoldMT"), local("Liberation Sans Bold"), local("Arimo Bold");
  size-adjust: 102.42%;
  ascent-override: 94.59%;
  descent-override: 23.55%;
  line-gap-override: 0.00%;
  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, U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF, U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* Noto Sans Hebrew: Arial has Hebrew letters. */
@font-face {
  font-family: 'Noto Sans Hebrew Fallback';
  font-style: normal;
  font-weight: 100 599;
  src: local("Arial"), local("ArialMT"), local("Liberation Sans"), local("Arimo");
  size-adjust: 100.82%;
  ascent-override: 105.93%;
  descent-override: 28.96%;
  line-gap-override: 0.00%;
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: 'Noto Sans Hebrew Fallback';
  font-style: normal;
  font-weight: 600 900;
  src: local("Arial Bold"), local("Arial-BoldMT"), local("Liberation Sans Bold"), local("Arimo Bold");
  size-adjust: 99.32%;
  ascent-override: 107.53%;
  descent-override: 29.40%;
  line-gap-override: 0.00%;
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
/* Noto Sans Thai: the Thai font of the device. Only the vertical numbers are matched (size-adjust 100%): the width of the Thai system fonts was not measured. */
@font-face {
  font-family: 'Noto Sans Thai Fallback';
  font-style: normal;
  font-weight: 100 599;
  src: local("Leelawadee UI"), local("Tahoma"), local("Thonburi"), local("Noto Sans Thai");
  size-adjust: 100.00%;
  ascent-override: 106.10%;
  descent-override: 45.00%;
  line-gap-override: 0.00%;
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: 'Noto Sans Thai Fallback';
  font-style: normal;
  font-weight: 600 900;
  src: local("Leelawadee UI Bold"), local("Tahoma Bold"), local("Thonburi Bold"), local("Noto Sans Thai Bold");
  size-adjust: 100.00%;
  ascent-override: 106.10%;
  descent-override: 45.00%;
  line-gap-override: 0.00%;
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}

/* ---- Part 2: the font list again, with the fallback right after its web font. Same selectors as kkbc-fonts-1.css Part 2; this file loads later, so it wins. ---- */
:root { --kkbc-font: Inter, "Inter Fallback", system-ui, sans-serif; }
:root:lang(ja) { --kkbc-font: Inter, "Inter Fallback", "Noto Sans JP", system-ui, sans-serif; }
:root:lang(ko) { --kkbc-font: Inter, "Inter Fallback", "Noto Sans KR", system-ui, sans-serif; }
:root:lang(zh-Hant), :root:lang(zh-TW) { --kkbc-font: Inter, "Inter Fallback", "Noto Sans TC", system-ui, sans-serif; }
:root:lang(zh-HK) { --kkbc-font: Inter, "Inter Fallback", "Noto Sans HK", system-ui, sans-serif; }
:root:lang(th) { --kkbc-font: Inter, "Inter Fallback", "Noto Sans Thai", "Noto Sans Thai Fallback", system-ui, sans-serif; }
:root:lang(he) { --kkbc-font: Inter, "Inter Fallback", "Noto Sans Hebrew", "Noto Sans Hebrew Fallback", system-ui, sans-serif; }
