/*
 * The portal's two faces, served from this machine.
 *
 * Inter for everything, DM Sans for the headings. Neither is installed on a
 * Windows desktop, so naming them in a font stack is wishful thinking unless
 * the files are actually sent -- which is what this file does. Before it
 * existed, `--font-body` already said "Inter" and every screen in the office
 * was quietly rendering Segoe UI.
 *
 * Self-hosted rather than linked from Google on purpose. A <link> to
 * fonts.googleapis.com means widening style-src and font-src for the whole
 * portal, and the global CSP list is only as tight as its loosest member. It
 * would also put a third party in front of every page load, which on a day
 * when the office's line is slow is a blank screen somebody reports as "portal
 * nahi chal raha".
 *
 * Variable fonts: one file carries every weight from 100 to 900, so the four
 * weights the portal uses cost one download instead of four. Two subsets each:
 * `latin` is what nearly every page needs, and `latin-ext` carries the rupee
 * sign, which Fleet prints -- the browser fetches it only on a page that has
 * one.
 *
 * font-display: swap -- text appears immediately in the fallback and reflows
 * when the font lands. The alternative is a few hundred milliseconds of
 * invisible text on a cold cache, and a list of vehicle numbers that is not
 * there yet is worse than one in the wrong face for a moment.
 *
 * The files are from Google Fonts (Inter v20, DM Sans v17) and both are under
 * the SIL Open Font License 1.1; the licences sit beside them in
 * public/fonts/. Replacing a file means replacing the licence with it.
 */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/static/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/static/fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url('/static/fonts/dmsans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url('/static/fonts/dmsans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/*
 * The three stacks, in one place rather than redefined in six stylesheets.
 *
 * Every stylesheet that wants them says `font-family: var(--font-body)` and
 * this file decides what that is. The tool stylesheets each used to carry
 * their own copy of the same three lines, which is how `--font-display` came
 * to mean Georgia in four tools and nothing at all in the portal.
 *
 * --font-mono names no downloaded face on purpose. It is used in three places
 * -- a user id, a division code, an item code -- and a monospace stack the
 * machine already has is indistinguishable there from one worth 40 KB. It used
 * to name 'IBM Plex Mono', which has never been installed on any machine in
 * the office and was therefore never once used.
 */
:root {
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-display: 'DM Sans', 'Inter', -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
}
