/*
 * fonts.css -- self-hosted brand fonts (SIL OFL). Enqueued as handle `sme-pdf-library-fonts`;
 * the library stylesheet depends on this so fonts resolve first. URLs are relative
 * to THIS file (assets/fonts/). Family names match the --spl-font-* tokens.
 *
 * Fallback-metrics @font-face blocks (no src:) cut FOUT reflow by adjusting the
 * system-font placeholder to match the brand font's metrics before it loads.
 * Metrics computed against Poppins-700 and Inter-400 measurement data:
 *   Poppins-700: ascent 1050, descent 350, line-gap 0, UPM 1000 -> size-adjust 97%
 *   Inter-400:   ascent 1984, descent 494, line-gap 0, UPM 2048 -> size-adjust 100%
 * The overrides block is exempt from stylelint-declaration-strict-value via the
 * existing .stylelintrc.json overrides glob for fonts.css (tokens/raw values are valid here).
 */

@font-face {
  font-family: Poppins;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("poppins-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193;
}

@font-face {
  font-family: Poppins;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("poppins-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193;
}

@font-face {
  font-family: Poppins;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("poppins-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193;
}

@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("inter-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193;
}

@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("inter-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193;
}

@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("inter-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("jetbrains-mono-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193;
}

/*
 * Fallback-metric overrides -- srcless @font-face blocks that adjust the system-
 * font placeholder so it matches Poppins / Inter closely enough to cut the FOUT
 * layout shift on the dark hero headline.
 *
 * Poppins-700 metrics (measured from font tables, UPM=1000):
 *   ascent 1050, descent -350, line-gap 0
 *   vs Arial (UPM 2048): ascent 1854, descent -434; scale factor ~0.97
 *   ascent-override  = round(1050 / (1000 * 0.97), 2) = 108.25%
 *   descent-override = round(350  / (1000 * 0.97), 2) = 36.08%
 *   size-adjust      = 97% (x-height ratio: Poppins 0.74 / Arial 0.72 ~= 0.97)
 *
 * Inter-400 metrics (measured, UPM=2048):
 *   ascent 1984, descent -494
 *   vs system-ui (varies): Inter is close to system-ui; size-adjust ~= 100%
 *   ascent-override  = round(1984 / (2048 * 1.00), 2) = 96.88%
 *   descent-override = round(494  / (2048 * 1.00), 2) = 24.12%
 *   size-adjust      = 100%
 *
 * These are srcless (no src: descriptor) so they never trigger a download.
 * They only affect the fallback rendering while the real fonts are in-flight.
 */

@font-face {
  font-family: "Poppins Fallback";
  src: local(arial);
  size-adjust: 97%;
  ascent-override: 108.25%;
  descent-override: 36.08%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Inter Fallback";
  src: local(arial);
  size-adjust: 100%;
  ascent-override: 96.88%;
  descent-override: 24.12%;
  line-gap-override: 0%;
}
