/*
 * Mixed-language typography — shared by the admin, driver, maintenance, passenger, platform and front
 * layouts, the document previews and every printed document (AdminDocumentPreview.decoratePrintHtml).
 *
 * An element that declares its own lang (text in another language than the page or document around it,
 * e.g. a zh-CN passenger survey inside a ja 運行指示書) paints with that language's CJK family first, so its
 * ideographs take that language's glyph forms and one family covers the whole run instead of a per-glyph
 * mix (Yu Gothic for shared ideographs, Microsoft YaHei for the simplified ones).
 *
 * The rules sit inside :where(), so their specificity is zero: they only replace the family a segment
 * inherits, and any surface that sets its own font-family keeps it. The page root's lang is not a segment.
 * Every stack lists the other CJK families after its own (OS-bundled only) so a missing glyph never falls
 * back to a random system font.
 */
:root {
  --lang-font-ja: "Yu Gothic", "YuGothic", "Meiryo", "Hiragino Sans", "Noto Sans CJK JP", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "Noto Sans SC", "Microsoft JhengHei", "PingFang TC", "Noto Sans CJK TC", "Noto Sans TC", sans-serif;
  --lang-font-zh-cn: "Microsoft YaHei", "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", "Source Han Sans SC", "Noto Sans SC", "Microsoft JhengHei", "PingFang TC", "Noto Sans CJK TC", "Noto Sans TC", "Yu Gothic", "YuGothic", "Hiragino Sans", "Noto Sans CJK JP", "Noto Sans JP", sans-serif;
  --lang-font-zh-tw: "Microsoft JhengHei", "Microsoft JhengHei UI", "PingFang TC", "Noto Sans CJK TC", "Source Han Sans TC", "Noto Sans TC", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "Noto Sans SC", "Yu Gothic", "YuGothic", "Hiragino Sans", "Noto Sans CJK JP", "Noto Sans JP", sans-serif;
  --lang-font-en: "Segoe UI", Arial, "Helvetica Neue", "Yu Gothic", "YuGothic", "Hiragino Sans", "Noto Sans CJK JP", "Noto Sans JP", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "Noto Sans SC", "Microsoft JhengHei", "PingFang TC", "Noto Sans CJK TC", "Noto Sans TC", sans-serif;
}

:where(body [lang]:lang(ja)) {
  font-family: var(--lang-font-ja);
}

:where(body [lang]:lang(zh-CN), body [lang]:lang(zh-Hans), body [lang]:lang(zh-SG)) {
  font-family: var(--lang-font-zh-cn);
}

:where(body [lang]:lang(zh-TW), body [lang]:lang(zh-Hant), body [lang]:lang(zh-HK)) {
  font-family: var(--lang-font-zh-tw);
}

:where(body [lang]:lang(en)) {
  font-family: var(--lang-font-en);
}
