/*
 * Typefaces — DESIGN.md §4.
 *
 * Self-hosted, not loaded from Google. A tournament is run from a laptop at a
 * football ground where the internet is unreliable or absent; a stylesheet that
 * waits on fonts.googleapis.com would leave the operator staring at unstyled
 * text at exactly the wrong moment. 164 KB total, served from the same origin
 * as everything else.
 *
 * Both files are VARIABLE fonts: one file covers every weight from 100 to 900,
 * which is why there is a single @font-face per subset rather than one per
 * weight. Google serves the same file for each weight URL — downloading four
 * copies of it would have quadrupled the payload for nothing.
 *
 *   Inter           Latin. Neutral grotesque, designed for screen UI, with
 *                   tabular figures that keep dashboard numbers from shifting.
 *   Noto Sans Thai  Thai. Pairs with Inter: same neutral tone, matching
 *                   x-height, and correct rendering of stacked vowels and tone
 *                   marks that system fallbacks often clip.
 *
 * unicode-range lets the browser pick per character, so Latin text uses Inter
 * and Thai text uses Noto Sans Thai inside the same sentence — automatically,
 * with only the needed file downloaded.
 */

/* --- Inter: Latin ------------------------------------------------------- */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../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('../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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --- Noto Sans Thai ----------------------------------------------------- */

@font-face {
  font-family: 'Noto Sans Thai';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/noto-sans-thai.woff2') format('woff2');
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}

/*
 * Thai has no capitals and no descender-free baseline, so the same nominal
 * size reads smaller than Latin. A slight size-adjust brings the two into
 * balance in mixed text, and the extra line-height gives tone marks and
 * stacked vowels room instead of letting them collide with the line above.
 */
:lang(th),
[lang="th"] {
  line-height: 1.7;
}

/*
 * Dashboard figures use lining tabular numerals so a column of numbers stays
 * aligned and a changing value does not make the row jump.
 */
.tabular,
.num,
.metric-value,
.data-table .num,
input[type="number"] {
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: 'tnum' 1, 'lnum' 1;
}

/*
 * Inter's optical sizing and contextual alternates are what make it look
 * deliberate rather than default at UI sizes.
 */
html {
  font-optical-sizing: auto;
  font-feature-settings: 'cv05' 1, 'cv11' 1; /* single-storey l, straight-tail y */
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
