/* ===========================================================================
   FONT FACES - AttuneEHR Design System

   SELF-HOSTED, NEVER FROM A FONT CDN, and that is a requirement rather
   than a preference. Before this file existed the app linked Inter (and,
   on the auth pages, DM Sans) from fonts.googleapis.com -- and every one
   of those requests FAILED in the environments this runs in. The app has
   never actually rendered a webfont: it declared Inter and drew the
   operating system's sans. Vendoring is not hardening here, it is the
   only thing that makes the type direction real.

   It is also the right call for an EHR independently of that: a font
   link on a login screen is a request to a third party from a page a
   clinician reaches while signed out, carrying their IP and referrer.

   THE FILES are the `latin` subsets from @fontsource/newsreader and
   @fontsource-variable/inter, both under the SIL Open Font License 1.1 --
   see LICENSE-newsreader.txt and LICENSE-inter.txt sitting beside the
   .woff2 files in app/assets/fonts. Redistribution inside an application
   is exactly what the OFL permits.

   INTER IS THE VARIABLE CUT: one 48KB file covering the whole 100-900
   weight axis, instead of four static weights. Newsreader ships as
   static cuts here because only four of its weights are wanted and the
   variable file carries an optical-size axis this design does not use.

   THE "../" IN EVERY url() IS LOAD-BEARING. Propshaft globs app/assets/*
   as load-path roots, so app/assets/fonts/x.woff2 has the LOGICAL PATH
   "x.woff2" -- no "fonts/" prefix, because the fonts directory is itself
   a root. This stylesheet's own logical path is "design_system/fonts.css",
   and Propshaft resolves a url() relative to the stylesheet's logical
   DIRECTORY. So a bare url("x.woff2") is looked up as
   "design_system/x.woff2", finds nothing, and is left in the output
   verbatim -- which then 404s against the digested asset route and every
   @font-face fails silently. Measured that exact failure before fixing
   it: FontFace status "error", stack still reporting Inter.

   "../x.woff2" normalises to "x.woff2" and resolves, and Propshaft
   rewrites it to the digested URL when it serves this file.

   font-display: swap everywhere. A trauma-informed product should not
   show a signed-out person a blank screen while a face downloads; text
   in the fallback for a moment is strictly better than no text.
   =========================================================================== */

/* --- Inter: body, labels, inputs, buttons, all UI text ------------------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  /* The full variable range, declared as a range so the browser knows one
     file answers every font-weight the app asks for. */
  font-weight: 100 900;
  font-display: swap;
  /* Plain format("woff2"), NOT the older format("woff2-variations"):
     that value is deprecated and current Chrome rejects the whole rule,
     which showed up as a FontFace with status "error" while the stack
     still read Inter -- i.e. exactly the silent fallback this change
     exists to end. A variable woff2 is served as woff2. */
  src: url("/assets/inter-latin-wght-normal-1f021a24.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/inter-latin-wght-italic-7c529059.woff2") format("woff2");
}

/* --- Newsreader: display and headings ONLY ------------------------------
   Deliberately not loaded at more weights than the type scale uses. Each
   extra cut is another ~24KB on a first paint that a clinician is waiting
   through. See typography.css for why this face never reaches body text. */
@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/newsreader-latin-400-normal-a1bd2648.woff2") format("woff2");
}

@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/newsreader-latin-500-normal-9ca2106a.woff2") format("woff2");
}

@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/newsreader-latin-600-normal-b16b95ed.woff2") format("woff2");
}

/* 700 is carried because plenty of existing headings already say
   font-bold, and a missing 700 would leave the browser to synthesise one
   -- smeared, uneven, and worse than the real cut. */
@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/newsreader-latin-700-normal-81085973.woff2") format("woff2");
}

@font-face {
  font-family: "Newsreader";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/newsreader-latin-400-italic-0b0e0d9c.woff2") format("woff2");
}
