/*
  Self-hosted so the app has no external font request: it is served from one origin, works
  offline through the service worker, and leaks nothing to a font CDN.

  The three faces and the size-adjusted fallback metrics below are taken from the hamprep
  operator design system, where they were measured rather than guessed. Keeping them means
  the system fallback occupies nearly the same box as the real face, so the page does not
  reflow when the face swaps in.
*/

@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url("/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url("/fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Martian Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("/fonts/martian-mono-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Martian Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url("/fonts/martian-mono-latin-600-normal.woff2") format("woff2");
}

/* Metrics-matched fallbacks, so swapping in the real face does not move the layout. */
@font-face {
  font-family: "Inter Fallback";
  src: local("Arial");
  ascent-override: 90%;
  descent-override: 22.43%;
  line-gap-override: 0%;
  size-adjust: 107.12%;
}

@font-face {
  font-family: "IBM Plex Sans Fallback";
  src: local("Arial");
  font-weight: 700;
  ascent-override: 102.5%;
  descent-override: 27.5%;
  line-gap-override: 0%;
  size-adjust: 99.4%;
}

/*
  Martian Mono's advance width is 0.70em where the common system monos sit at 0.60em, so an
  unadjusted fallback rewraps every prescription line when the real face loads.
  size-adjust = 0.70 / 0.60; the vertical overrides are Martian Mono's hhea metrics divided
  by that same figure.
*/
@font-face {
  font-family: "Martian Mono Fallback";
  src: local("Courier New"), local("Droid Sans Mono"), local("Roboto Mono");
  ascent-override: 85.71%;
  descent-override: 17.14%;
  line-gap-override: 0%;
  size-adjust: 116.67%;
}

:root {
  --font-sans: "Inter Variable", "Inter Fallback", ui-sans-serif, system-ui, sans-serif;
  --font-display:
    "IBM Plex Sans", "IBM Plex Sans Fallback", "Inter Variable", ui-sans-serif, sans-serif;
  --font-mono: "Martian Mono", "Martian Mono Fallback", ui-monospace, "SF Mono", monospace;
}
