/* Self-hosted webfonts - Inter (body) and JetBrains Mono (code).
 *
 * IDENTICAL IN ALL FOUR MANUALS. If you edit this file, edit the other
 * three: una, una-guide, arp, connect. The font FILES are shared - one copy
 * at the repo root in assets/fonts/, dropped into each build by
 * hooks/self_host_fonts.py - but MkDocs only links stylesheets that live
 * inside a product's own docs_dir, so this sheet has to be duplicated.
 *
 * These replace the Google Fonts <link> that `theme.font` used to emit.
 * Google serves Inter and JetBrains Mono as VARIABLE fonts, and Skia - the
 * renderer behind headless Chrome's --print-to-pdf - cannot embed a named
 * instance of one. It rasterises every glyph to a Type 3 drawing procedure
 * instead, which is why the old PDFs looked right but could not be
 * selected, searched or copied. The files below are static instances: one
 * real weight each.
 *
 * The URLs are RELATIVE, not root-relative. The PDF is rendered from
 * site/<product>/print_page/index.html over file://, where `/fonts/...`
 * would resolve to the filesystem root and quietly load nothing.
 *
 * font-display: block, not swap. On the web the difference is invisible -
 * these are same-origin files of about 23 KB. In the PDF it is the
 * difference between guaranteed Inter and a race with the fallback stack.
 */

/* ---- Inter ------------------------------------------------------------ */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 300;
  font-display: block;
  src: url("../fonts/inter-latin-300-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: italic;
  font-weight: 300;
  font-display: block;
  src: url("../fonts/inter-latin-300-italic.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("../fonts/inter-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: italic;
  font-weight: 400;
  font-display: block;
  src: url("../fonts/inter-latin-400-italic.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: block;
  src: url("../fonts/inter-latin-700-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: italic;
  font-weight: 700;
  font-display: block;
  src: url("../fonts/inter-latin-700-italic.woff2") format("woff2");
}

/* ---- JetBrains Mono --------------------------------------------------- */

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

@font-face {
  font-family: "JetBrains Mono";
  font-style: italic;
  font-weight: 400;
  font-display: block;
  src: url("../fonts/jetbrains-mono-latin-400-italic.woff2") format("woff2");
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 700;
  font-display: block;
  src: url("../fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2");
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: italic;
  font-weight: 700;
  font-display: block;
  src: url("../fonts/jetbrains-mono-latin-700-italic.woff2") format("woff2");
}

/* ---- Symbols ----------------------------------------------------------
 * Inter's latin subset carries no arrows, no maths operators, no vulgar
 * fractions and no musical symbols. The manual uses all four - the arrow
 * alone appears on 31 pages of the UNA manual - so without this face every
 * one of those characters falls back to whatever the renderer has: Arial on
 * Windows, DejaVu on the CI runner, tofu on a machine with neither. Listed
 * last in both stacks below, so it is only ever reached per-glyph.
 */

@font-face {
  font-family: "Midicake Symbols";
  font-style: normal;
  font-weight: 100 900;
  font-display: block;
  /* Keyboard-key symbols Material draws via ::before. DejaVu has none of
     these three, so this face is listed FIRST with an explicit range: the
     browser picks a face by unicode-range before it looks for the glyph,
     and if the face it picked lacks the glyph it moves to the next FAMILY,
     not the next face. Narrow ranges first is what makes the fallback work. */
  unicode-range: U+2380, U+238B, U+2399;
  src: url("../fonts/midicake-symbols-tech.woff2") format("woff2");
}

@font-face {
  font-family: "Midicake Symbols";
  font-style: normal;
  font-weight: 100 900;
  font-display: block;
  unicode-range: U+2912, U+2913;   /* arrow-to-bar; DejaVu has neither */
  src: url("../fonts/midicake-symbols-arrows.woff2") format("woff2");
}

@font-face {
  font-family: "Midicake Symbols";
  font-style: normal;
  font-weight: 100 900;   /* one static face claimed for every weight, so the
                             browser never synthesises one - a synthesised face
                             is written into the PDF as Type 3. */
  font-display: block;
  src: url("../fonts/midicake-symbols.woff2") format("woff2");
}

/* The page-number footer is an @page margin box. Margin boxes do NOT inherit
 * from body, so without this they render in the initial serif - which is why
 * 'Page 1' came out in Times New Roman on all 197 pages.
 */
@page {
  font-family: "Inter", "Midicake Symbols", sans-serif;
}

/* ---- Hand the families to Material ------------------------------------
 * With `font: false` the theme no longer emits its own
 * :root{--md-text-font:...} rule, so these two lines replace it. Material
 * expands them into --md-text-font-family, so a two-family value here
 * becomes a two-family stack everywhere - which is how the symbol face
 * gets reached without touching a single other selector.
 */

:root {
  --md-text-font: "Inter", "Midicake Symbols";
  --md-code-font: "JetBrains Mono", "Midicake Symbols";
}
