/* ==========================================================================
   Fonts: the font stack of the site and its fallbacks per language.
   Shared by every page of the site.

   The Inter files are split by script (fonts/<group>/) and connected by
   one file per group. A page links fonts.css and the groups its language
   needs, fonts-latin.css always and always last (where two groups share a
   character, the face declared later wins):

     en, es, fr, de, pt, it, nl  fonts-latin.css
     zh, ja, ko, ar, fa          fonts-latin.css (Inter has no Han, Kana,
                                 Hangul or Arabic: system fonts, see below)
     pl, cs, sk, tr, ro, hu, hr  fonts-latin-ext.css, fonts-latin.css
     ru, uk, be, bg, sr, mk      fonts-cyrillic.css, fonts-latin.css
     kk, tt, ba                  fonts-cyrillic-ext.css, fonts-cyrillic.css,
                                 fonts-latin.css
     el                          fonts-greek.css, fonts-latin.css
     vi                          fonts-vietnamese.css, fonts-latin-ext.css,
                                 fonts-latin.css

   Preload the regular (400) and semibold (600) files of the same groups:
   they set the text and headings of the first screen. Details and sizes:
   fonts/README.md.
   ========================================================================== */

/* Glyphs Inter does not have (CJK, Arabic, Hebrew, Thai, Devanagari…), and
   scripts whose group file is not linked on the page, are taken character
   by character from the system fonts listed after it. */
:root {
  --font-main: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Noto Sans", "Helvetica Neue", Arial,
    "Hiragino Sans", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC",
    "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR",
    "Geeza Pro", "Noto Sans Arabic", Tahoma,
    sans-serif;
}

/* Han characters look different in Japanese, Chinese and Korean,
   so each language gets its own fonts first. */
:lang(ja) {
  --font-main: "Inter", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic",
    YuGothic, Meiryo, "Noto Sans JP", "Noto Sans CJK JP", sans-serif;
}

:lang(zh) {
  --font-main: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans SC", "Noto Sans CJK SC", sans-serif;
}

:lang(zh-TW),
:lang(zh-HK),
:lang(zh-Hant) {
  --font-main: "Inter", "PingFang TC", "Microsoft JhengHei", "Noto Sans TC",
    "Noto Sans CJK TC", sans-serif;
}

:lang(ko) {
  --font-main: "Inter", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR",
    "Noto Sans CJK KR", sans-serif;
}

:lang(ar),
:lang(fa) {
  --font-main: "Inter", "Geeza Pro", "Segoe UI", Tahoma, "Noto Sans Arabic",
    sans-serif;
}

body,
[lang] {
  font-family: var(--font-main);
}
