/* ============================================================================
   marketing-font-metrics.css: metric-matched fallback faces, to stop the web-font swap moving text.

   WHY (kit lanes/CLS-MAIN/REPORT.md causes 2 and 3). Hanken Grotesk and Inter ship with font-display:block and
   NO size-adjust / ascent-override; the Noto Indic faces swap in with font-display:swap and no overrides. Each swap
   re-lays-out the text because the face shown before it has different advance widths and a different line box.
   Measured there: Latin swap 0.002-0.04 CLS, Indic swap 0.10 at bn 390 (the .cms-chip row rewraps, +50px) and +28px
   on hi (TOC and h2).

   THE METHOD. Each web face gets a SIBLING family, declared here, whose local() source is a font the visitor
   already has, scaled with size-adjust / ascent-override / descent-override / line-gap-override so its metrics land on
   the web font's. The sibling is placed RIGHT AFTER the web font in the stack, so once the web font loads nothing
   changes and nothing is downloaded. Declared in this sheet only: the design-system sheet and the pinned vendored
   marketing sheet are never edited. Costs zero bytes on any page.

   WHERE THE NUMBERS COME FROM (all recomputed by scripts/font-metrics.mjs from the vendored woff2, and re-checked by
   fontMetricFallback.test.ts to within 0.3 points):
     override = web-font metric (hhea, in em) / size-adjust
     size-adjust = web-font weighted average advance (em) / Arial weighted average advance (em)
     weighting = English letter frequency plus space, over the glyphs the cmap maps (the capsize / Next.js method).
   Hanken Grotesk 800 latin: upm 1000, hhea ascent 1000, descent -303, lineGap 0, weighted avg 448 -> 101.49%.
   Inter 400 latin:          upm 2048, hhea ascent 1984, descent -494, lineGap 0, weighted avg 970 -> 107.31%.
   Arial (not vendored, cannot be read here): upm 2048, weighted avg 904 (capsize / Next.js published value).
   Noto Sans Devanagari: upm 1000, hhea ascent 896, descent -408 -> 89.6% / 40.8%. Noto Sans Bengali: ascent 917
   -> 91.7% / 40.8%. Indic faces use size-adjust 100%: the visitor's own Indic system font is the fallback and its
   advance widths are unknowable here, so only the LINE BOX (the part that moved whole sections) is matched.

   ⚠ HONEST LIMITS. Bold: Arial Regular stands in for every Hanken weight (the browser synthesizes bold), so a
   heading can still differ by a few percent in width at swap. Windows and Android without Arial skip the local()
   source and fall through to sans-serif (no regression, just no gain). Real-browser CLS proof (Chromium + WebKit at
   320/390/768/1280) is an EC2 job, not done on the Mac.

   WHAT ELSE IT DOES NOT DO. No colour, size, spacing or layout rule. The stacks below add only the sibling family.
   ============================================================================ */

/* ---- Latin ---- */
@font-face {
  font-family: 'Hanken Grotesk Fallback';
  font-style: normal;
  font-weight: 400 800;
  src: local('Arial'), local('ArialMT'), local('Helvetica'), local('Liberation Sans');
  size-adjust: 101.49%;
  ascent-override: 98.53%;
  descent-override: 29.86%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Inter Fallback';
  font-style: normal;
  font-weight: 400 800;
  src: local('Arial'), local('ArialMT'), local('Helvetica'), local('Liberation Sans');
  size-adjust: 107.31%;
  ascent-override: 90.27%;
  descent-override: 22.48%;
  line-gap-override: 0%;
}

/* ---- Indic. The unicode-range is the SAME as the Noto faces in marketing-indic.css: without it these local() faces
   would also claim Latin characters on a Hindi page and Latin would stop resolving to Inter. ---- */
@font-face {
  font-family: 'Noto Sans Devanagari Fallback';
  font-style: normal;
  font-weight: 100 900;
  src: local('Noto Sans Devanagari'), local('Kohinoor Devanagari'), local('Devanagari Sangam MN'), local('Nirmala UI'), local('Mukta');
  size-adjust: 100%;
  ascent-override: 89.6%;
  descent-override: 40.8%;
  line-gap-override: 0%;
  unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20A8, U+20B9, U+20F0, U+25CC, U+A830-A839, U+A8E0-A8FF, U+11B00-11B09;
}
@font-face {
  font-family: 'Noto Sans Bengali Fallback';
  font-style: normal;
  font-weight: 100 900;
  src: local('Noto Sans Bengali'), local('Bangla Sangam MN'), local('Kohinoor Bangla'), local('Nirmala UI');
  size-adjust: 100%;
  ascent-override: 91.7%;
  descent-override: 40.8%;
  line-gap-override: 0%;
  unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+1CD0, U+1CD2, U+1CD5-1CD6, U+1CD8, U+1CE1, U+1CEA, U+1CED, U+1CF2, U+1CF5-1CF7, U+200C-200D, U+20B9, U+25CC, U+A8F1;
}

/* ---- Stacks. The two design tokens keep their web font first and their generic last; only the sibling is inserted. ---- */
.page {
  --font-head: 'Hanken Grotesk', 'Hanken Grotesk Fallback', sans-serif;
  --font-body: 'Inter', 'Inter Fallback', sans-serif;
}
body {
  font-family: 'Inter', 'Inter Fallback', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ---- Indic stacks: the same selectors and specificity as marketing-indic.css (generated from it; the test fails if a
   selector there is missing here), this sheet linked right after it so equal specificity resolves to this one. ---- */
html[lang|='hi'],
html[lang|='hi'] body,
html[lang|='mr'],
html[lang|='mr'] body {
  font-family: 'Noto Sans Devanagari', 'Noto Sans Devanagari Fallback', 'Inter', 'Inter Fallback', 'Hanken Grotesk', 'Hanken Grotesk Fallback', system-ui, sans-serif;
}

html[lang|='bn'],
html[lang|='bn'] body {
  font-family: 'Noto Sans Bengali', 'Noto Sans Bengali Fallback', 'Inter', 'Inter Fallback', 'Hanken Grotesk', 'Hanken Grotesk Fallback', system-ui, sans-serif;
}

html[lang|='bn'] .page .p-hero h1,
html[lang|='bn'] .page .mkt-hcopy h1 {
  font-family: 'Noto Sans Bengali', 'Noto Sans Bengali Fallback', var(--font-head);
}

html[lang|='hi'] .page .p-hero h1,
html[lang|='hi'] .page .mkt-hcopy h1,
html[lang|='mr'] .page .p-hero h1,
html[lang|='mr'] .page .mkt-hcopy h1 {
  font-family: 'Noto Sans Devanagari', 'Noto Sans Devanagari Fallback', var(--font-head);
}

html[lang|='bn'] body,
html[lang|='bn'] .page,
html[lang|='bn'] .page h1,
html[lang|='bn'] .page h2,
html[lang|='bn'] .page h3,
html[lang|='bn'] .page h4 {
  font-family: 'Noto Sans Bengali', 'Noto Sans Bengali Fallback', 'Inter', 'Inter Fallback', 'Hanken Grotesk', 'Hanken Grotesk Fallback', system-ui, sans-serif;
}

html[lang|='hi'] body,
html[lang|='hi'] .page,
html[lang|='hi'] .page h1,
html[lang|='hi'] .page h2,
html[lang|='hi'] .page h3,
html[lang|='hi'] .page h4,
html[lang|='mr'] body,
html[lang|='mr'] .page,
html[lang|='mr'] .page h1,
html[lang|='mr'] .page h2,
html[lang|='mr'] .page h3,
html[lang|='mr'] .page h4 {
  font-family: 'Noto Sans Devanagari', 'Noto Sans Devanagari Fallback', 'Inter', 'Inter Fallback', 'Hanken Grotesk', 'Hanken Grotesk Fallback', system-ui, sans-serif;
}

html[lang|='bn'] .page.page h1,
html[lang|='bn'] .page.page [data-mock-h1],
html[lang|='bn'] .page.page h2,
html[lang|='bn'] .page.page h3,
html[lang|='bn'] .page.page h4 {
  font-family: 'Noto Sans Bengali', 'Noto Sans Bengali Fallback', 'Inter', 'Inter Fallback', 'Hanken Grotesk', 'Hanken Grotesk Fallback', system-ui, sans-serif;
}

html[lang|='hi'] .page.page h1,
html[lang|='hi'] .page.page [data-mock-h1],
html[lang|='hi'] .page.page h2,
html[lang|='hi'] .page.page h3,
html[lang|='hi'] .page.page h4,
html[lang|='mr'] .page.page h1,
html[lang|='mr'] .page.page [data-mock-h1],
html[lang|='mr'] .page.page h2,
html[lang|='mr'] .page.page h3,
html[lang|='mr'] .page.page h4 {
  font-family: 'Noto Sans Devanagari', 'Noto Sans Devanagari Fallback', 'Inter', 'Inter Fallback', 'Hanken Grotesk', 'Hanken Grotesk Fallback', system-ui, sans-serif;
}

html[lang|='bn'] .page.page.home .matchcard h2 {
  font-family: 'Noto Sans Bengali', 'Noto Sans Bengali Fallback', 'Inter', 'Inter Fallback', 'Hanken Grotesk', 'Hanken Grotesk Fallback', system-ui, sans-serif;
}

html[lang|='hi'] .page.page.home .matchcard h2,
html[lang|='mr'] .page.page.home .matchcard h2 {
  font-family: 'Noto Sans Devanagari', 'Noto Sans Devanagari Fallback', 'Inter', 'Inter Fallback', 'Hanken Grotesk', 'Hanken Grotesk Fallback', system-ui, sans-serif;
}
