/* The one typeface declaration, for every shell.
 *
 * WHY THIS FILE EXISTS, measured on the running stack before it was written.
 *
 * The two `@font-face` rules used to live in `input.css` and therefore only in
 * `css/output.css`, which `base_app` and `base_public` load and
 * `prototype_base` does not. So on the entire migrated operator surface:
 *
 *     faces: (NONE DECLARED)
 *     html:  Times
 *     body:  Inter, -apple-system, system-ui, sans-serif
 *     e.g. button.btn, button.qa -> Arial
 *
 * Three separate defects in one line of output. The shell preloaded
 * `InterVariable.woff2`, the browser fetched it with a 200 on every page
 * load, and nothing could use it, because no face was declared. `body` asked
 * for `Inter`, which is not the declared family name (`Inter Variable`), so
 * even with a face present it would have missed. `html` had no family at all
 * and fell through to the browser default serif. And every `<button>` fell to
 * the UA default, Arial, because buttons do not inherit `font-family`.
 *
 * A declaration that lives inside one shell's build output is a declaration
 * the other shells cannot have. This file is loaded by all of them, so there
 * is one face, one name, and one place to change it.
 *
 * The files themselves are BUILD ARTIFACTS, gitignored and generated by
 * `npm run build:icons` from `@fontsource-variable/inter`
 * (scripts/build_icon_sprite.mjs). A checkout that has not run `npm ci &&
 * npm run build` has no font to serve, which is the same contract as
 * `static/icons/lucide.svg` and is why both are asserted in CI rather than
 * trusted.
 */

@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-weight: 100 900;
  /* `swap`, not `block`: a sign-in form that renders nothing for 100ms is
     worse than one that reflows once. */
  font-display: swap;
  src: url("/static/fonts/InterVariable.260c81a4759b.woff2") format("woff2-variations"),
       url("/static/fonts/InterVariable.260c81a4759b.woff2") format("woff2");
}

@font-face {
  font-family: "Inter Variable";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/InterVariable-Italic.0a81fe197e0d.woff2") format("woff2-variations"),
       url("/static/fonts/InterVariable-Italic.0a81fe197e0d.woff2") format("woff2");
}

/* The two stacks, as tokens, so a shell aliases rather than restates them.
 * Declared on `:root` and never per theme: a typeface is not a colour and has
 * no light and dark variant.
 *
 * `Inter` stays in the stack after `Inter Variable` so a machine with the
 * static Inter installed still gets Inter rather than falling to system-ui.
 * It is a fallback, never the name a rule should ask for.
 *
 * MONO IS FOR SYSTEM METADATA ONLY: identifiers, timestamps, hostnames, event
 * refs. It is not a voice for labels, buttons or body copy. */
:root {
  --font-ui: "Inter Variable", Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

/* The decision, applied. Here rather than once per shell, because "every
 * shell sets the family" is a claim four files have to keep true and one
 * file can simply BE true. The operator shell had no such rule and computed
 * `Times` on <html>; the other two inherited theirs from a Tailwind base
 * layer that the operator shell does not load, which is the same fragility
 * one level up.
 *
 * Controls are listed because `font-family` is not inherited by form
 * elements: a bare <button> takes the UA default whatever <html> says, and
 * on the operator surface that measured `Arial` next to Inter text. */
html {
  font-family: var(--font-ui);
}

button,
input,
select,
textarea,
optgroup {
  font-family: inherit;
}

/* THE TOUCH FLOOR. Nothing an operator types into may compute below 16px.
 *
 * This is not a type-scale preference, it is a platform rule with a visible
 * failure. Mobile Safari ZOOMS THE PAGE when a focused control's computed
 * font-size is under 16px, and it does not zoom back out on blur. Reported
 * from a real phone as "sometimes I cannot even see what I am typing": the
 * operator taps a field, the layout jumps to roughly 1.3x, the page is now
 * wider than the window, and the caret is off-screen behind the keyboard.
 *
 * Measured before this rule was written, at 390px on a fresh tenant: every
 * surface but one failed, fourteen distinct control shapes between 11.5px
 * and 14.5px, including both canonical composers and the sign-in form.
 *
 * THE FIX IS NOT `maximum-scale=1` OR `user-scalable=no` on the viewport
 * meta. That removes the zoom by removing the operator's ability to pinch,
 * which fails WCAG 1.4.4 and makes every small thing on the page permanently
 * unreadable. None of the three shells carries those, and none should.
 *
 * Here rather than once per design system, for the reason the typeface is
 * here: all three shells load this file, so one rule can simply BE true
 * instead of four files having to keep it true.
 *
 * `!important` is deliberate and is the point of the rule. A floor that a
 * page-local `font-size:12.5px` can undo is not a floor, and the controls
 * this corrects were undersized by exactly such one-off rules. It also makes
 * the rule independent of load order, which is what lets one file reach a
 * Tailwind utility (`text-[13px]` on the sign-in inputs) and a proto class
 * (`.calm-field`) with the same declaration.
 *
 * `pointer: coarse` OR a narrow viewport, not width alone: the zoom is a
 * property of the input device, not of the window. A tablet at 1024px zooms
 * and a desktop window dragged to 390px does not, so width on its own is
 * wrong in both directions. The width clause is kept because it is what a
 * desktop browser emulating a phone can match, and a slightly larger control
 * in a narrow desktop window is not a defect.
 *
 * Checkboxes, radios, ranges and colour swatches are excluded: they render
 * no text, they are sized in px by their own rules, and they never trigger
 * the zoom. */
@media (pointer: coarse), (max-width: 640px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
  select,
  textarea {
    font-size: 16px !important;
  }
}
