/* ================================================================
   typography.css — ONE FONT, APPLICATION-WIDE
   ----------------------------------------------------------------
   MUST be the LAST stylesheet in <head>. Bootstrap, Kendo and toastr
   are all loaded from CDNs after bridgex.css, and each ships its own
   font-family rules:

       Bootstrap  body { font-family: var(--bs-body-font-family) }
       Kendo      .k-* { font-family: var(--kendo-font-family) }
       toastr     #toast-container * { font-family: ... }

   Bootstrap's `body` rule (specificity 0,0,1) beats reset.css's
   identical rule purely on source order, so before this file existed
   the app's base font was actually Bootstrap's stack, not the theme's.

   ── WHY THE UNIVERSAL SELECTOR IS SAFE ──
   `* { font-family: inherit }` has specificity (0,0,0) — the lowest
   possible. Every icon font binds its family through a CLASS selector
   (0,1,0):

       .fa, .fa-solid, .fa-brands   → Font Awesome 6
       .k-icon, [class^="k-i-"]     → WebComponentsIcons

   so all of them beat this rule and keep their glyphs. Pseudo-elements
   are also untouched: `*` matches elements only, so `.fa-solid::before`
   still inherits Font Awesome from its own element. Do not add
   !important here — that is what would break the icons.
   ================================================================ */

/* Everything inherits, so there is exactly one place the font is set. */
* {
    font-family: inherit;
}

/* The single source. Element selectors (0,0,1) beat the `*` above. */
html,
body {
    font-family: var(--bx-font);
}

/* Form controls do not inherit font by default in any browser. The `*`
   rule already covers them; these are listed explicitly because UA
   stylesheets are the one thing that surprises people here. */
input,
select,
textarea,
button,
optgroup,
option {
    font-family: var(--bx-font);
}

/* ── APP SHELL ────────────────────────────────────────────────────
   Sidebar, header and top nav declare no font of their own and already
   inherit from body. These pins are a GUARANTEE, not a fix: they stop a
   future rule on `nav` / `header` (or a vendor sheet targeting those
   elements) from quietly forking the shell onto a different face.

   Pin the CONTAINERS only. A descendant-universal selector like
   `.ef-sidebar *` would be specificity (0,1,0) — a tie with `.fa-solid`
   — and because this file loads last it would WIN and blank every icon.
   Container pins let inheritance do the work while class-based icon
   fonts still outrank the `*` rule above. */
.ef-sidebar,
.ef-header,
.ef-topnav-bar {
    font-family: var(--bx-font);
}

/* ── BOOTSTRAP ────────────────────────────────────────────────────
   Re-point Bootstrap's own tokens rather than fighting its rules, so
   any component reading them (badges, modals, tooltips) follows too. */
:root {
    --bs-font-sans-serif: var(--bx-font);
    --bs-font-monospace: var(--bx-font);
    --bs-body-font-family: var(--bx-font);
}

/* ── BASE TEXT SIZE ───────────────────────────────────────────────
   Same story as the font family above: Bootstrap's `body` rule
   (specificity 0,0,1) loads after bridgex.css and beats reset.css's
   identical rule on source order, so reset.css's own font-size never
   applied — the app's base size was really Bootstrap's 1rem. Setting
   it here, in the last stylesheet, is what makes the token real.

   ── WHY calc() AND NOT `html { font-size }` ──
   Driving the root would be the one-line version, but `rem` is how
   Bootstrap and Kendo express their PADDING, gaps and control heights
   as well as their text. Moving the root rescales all of that, which
   is a full UI zoom, not a text-size setting. So the root stays at the
   browser's 16px and every size in this codebase is written as a
   multiple of the token instead:

       12px  →  calc(0.75 * var(--bx-font-size))

   The multiplier is the original px ÷ 16, so at the default 16px the
   rendering is pixel-identical to before the token existed, and any
   other value scales the whole type hierarchy proportionally. */

/* The default value. Declared here rather than in variables.css because
   this file is the only stylesheet BOTH _Layout.cshtml and
   _ThemeHead.cshtml load — the standalone Error views never pull in
   variables.css, and an undefined token there would void every calc()
   font-size on the page.

   The Appearance screen overrides this per organisation from _Layout:
   `:root[data-theme]` scores (0,1,1) and beats this `:root` (0,1,0). */
:root {
    --bx-font-size: 16px;
}

body {
    font-size: var(--bx-font-size);
}

/* Vendor scales, re-expressed against the token so third-party text
   follows too. Each multiplier is that vendor's own default ÷ 16, so
   at a 16px token nothing shifts — Kendo's -md really is 0.875rem. */
:root {
    --bs-body-font-size: var(--bx-font-size);
    --kendo-font-size: calc(0.75 * var(--bx-font-size));
    --kendo-font-size-xxs: calc(0.5 * var(--bx-font-size));
    --kendo-font-size-xs: calc(0.625 * var(--bx-font-size));
    --kendo-font-size-sm: calc(0.75 * var(--bx-font-size));
    --kendo-font-size-md: calc(0.875 * var(--bx-font-size));
    --kendo-font-size-lg: var(--bx-font-size);
    --kendo-font-size-xl: calc(1.25 * var(--bx-font-size));
}

/* ── KENDO ────────────────────────────────────────────────────────
   kendo-theme-override.css already maps --kendo-font-family; these
   catch the widgets that hardcode a stack instead of reading it. */
.k-widget,
.k-grid,
.k-grid-header,
.k-grid-content,
.k-toolbar,
.k-input,
.k-input-inner,
.k-button,
.k-list,
.k-list-item,
.k-popup,
.k-window,
.k-dialog,
.k-tooltip,
.k-calendar,
.k-treeview,
.k-tabstrip,
.k-pager,
.k-pager-wrap,
.k-chip,
.k-notification {
    font-family: var(--bx-font);
}

/* ── TOASTR ───────────────────────────────────────────────────── */
#toast-container,
#toast-container > div,
.toast-title,
.toast-message {
    font-family: var(--bx-font);
}

/* ── NUMERIC ALIGNMENT ────────────────────────────────────────────
   Monospace used to do the column-alignment work. With one font that
   job moves to tabular figures, which keep digits on a fixed advance
   width without changing typeface. Applied at the call sites that
   previously used var(--font-mono); this is the safety net for tables
   the sweep did not name individually. */
table td,
table th,
.k-grid td,
.k-grid th {
    font-variant-numeric: tabular-nums;
}

/* Code-ish content keeps its semantics but not a second typeface. */
code,
kbd,
pre,
samp {
    font-family: var(--bx-font);
    font-variant-numeric: tabular-nums;
}
