/* =============================================================================
   fonts.css — the self-hosted @font-face registry: every family the token layer
   NAMES and this application SERVES, plus the `.ics-legacy-ansi` opt-in class.
   Files live in wwwroot\Fonts and are referenced root-absolute (/Fonts/...), so
   the same declaration resolves from a raw <link> on any shell and from any
   standalone document view. Every shell links this file immediately BEFORE
   tokens.css (it is not one of tokens.css's @imports); the standalone document
   views that render text outside a shell link it themselves.

   THE RULE THIS FILE EXISTS TO ENFORCE: a family named in a token must be
   declared here. A token that names a family this application does not ship
   resolves against whatever happens to be installed on the viewer's machine, so
   the same screen renders differently for different users - and where the local
   match is a symbol face, text becomes dingbats. Naming without shipping is the
   defect; this registry is the fix.

   ZERO CDN: every src below is a path in this application. Never add a
   fonts.googleapis.com or other remote src here.

   ---- THE 8-BIT ANSI BANGLA FACE - READ BEFORE USING IT ---------------------
   SutonnyMJ is an 8-bit font: it maps LATIN codepoints to Bangla glyphs. Text
   stored in that encoding is a stream of ordinary Latin bytes and reads as
   Bangla ONLY while the element is rendered in this exact family. Two
   consequences that are easy to get wrong:
   - It can NEVER work as a fallback at the end of a Latin chain. The browser
     only reaches a later family when the earlier ones lack the glyph, and Arial
     covers every codepoint such text uses - so the earlier font always wins and
     the text renders as Latin nonsense. The family has to be FIRST on the
     element, which is what `.ics-legacy-ansi` below is for.
   - It must never be applied to Unicode Bangla (U+0980..U+09FF); that is what
     Noto Sans Bengali is for. The two encodings are not interchangeable.
   ============================================================================= */

/* ---- Bangla, Unicode ------------------------------------------------------- */
@font-face {
  font-family: "Noto Sans Bengali";
  src: url("/Fonts/NotoSansBengali-VariableFont_wdth,wght.ttf") format("truetype");
  font-weight: 100 900;                          /* variable file: one face covers the range */
  font-style: normal;
  font-display: swap;                            /* text paints immediately in the fallback, never invisible */
}

@font-face {
  font-family: "SolaimanLipi";
  src: url("/Fonts/SolaimanLipi.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Kalpurush";
  src: url("/Fonts/kalpurush.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ---- Bangla, 8-bit ANSI encoding -------------------------------------------
   Declared once here for every shell. The filename carries a space, so the src
   is percent-encoded. */
@font-face {
  font-family: "SutonnyMJ";
  src: url("/Fonts/SutonnyMJ%20Regular.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ---- the opt-in for ANSI-encoded content -----------------------------------
   Put this class on the ELEMENT whose text is ANSI-encoded Bangla - a message
   body, a grid cell, a label. It sets the family ahead of every Latin fallback,
   which is the only position where an 8-bit font can work at all.
   It is deliberately NOT applied by any component automatically: only the code
   that knows a given string's encoding can know this class belongs on it. */
.ics-legacy-ansi,
.ics-legacy-ansi * {
  font-family: var(--ics-font-legacy-ansi), "SutonnyMJ" !important;
}
