/* ───────────────────────────────────────────────────────────────
 * The translations (de/, ja/, ru/, zh/), on top of style.css.
 *
 * The themes' display faces carry only Latin: Instrument Serif and
 * Newsreader have no Cyrillic, and no web face here has Japanese or
 * Chinese. Each language names the faces for its script. Russian
 * loads two Cyrillic serifs from Google Fonts; Japanese and Chinese
 * use the system's own (Hiragino, Yu, PingFang, Noto CJK), which every
 * platform has and which would weigh megabytes as web fonts.
 *
 * `:root:lang(xx)` outranks the themes' `[data-theme]` blocks, so a
 * value that differs per theme is set again with the theme in it.
 * ─────────────────────────────────────────────────────────────── */

/* ───── Russian ───── */

/* Inter and JetBrains Mono have Cyrillic: only Clay's and Paper's display serifs change. */
:root:lang(ru) {
    --font-display: "Playfair Display", "Instrument Serif", Georgia, serif;
}
:root[data-theme="paper"]:lang(ru) {
    --font-display: "Literata", "Newsreader", Georgia, serif;
}
:root[data-theme="mono"]:lang(ru) {
    --font-display: "JetBrains Mono", ui-monospace, monospace;
}

/* ───── Japanese, Chinese ───── */

:root:lang(ja) {
    --cjk-serif: "Hiragino Mincho ProN", "Yu Mincho", YuMincho, "Noto Serif CJK JP", "Noto Serif JP";
    --cjk-sans:  "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", YuGothic, Meiryo,
                 "Noto Sans CJK JP", "Noto Sans JP";
}
:root:lang(zh) {
    --cjk-serif: "Songti SC", STSong, "Noto Serif CJK SC", "Noto Serif SC", SimSun;
    --cjk-sans:  "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC",
                 "Noto Sans SC";
}

/* The theme's face first, so Latin ("Time Meter", "iOS", "CSV") keeps its look. */
:root:is(:lang(ja), :lang(zh)) {
    --font-display: "Instrument Serif", var(--cjk-serif), serif;
    --font-ui:      "Inter", var(--cjk-sans), system-ui, sans-serif;
    --h-tracking:   0;
}
:root[data-theme="paper"]:is(:lang(ja), :lang(zh)) {
    --font-display: "Newsreader", var(--cjk-serif), serif;
}
:root[data-theme="mono"]:is(:lang(ja), :lang(zh)) {
    --font-display: "JetBrains Mono", var(--cjk-sans), monospace;
    --font-ui:      "JetBrains Mono", var(--cjk-sans), monospace;
}

/* A CJK character is a full em wide and tall: smaller headlines, more air between lines. */
:root:is(:lang(ja), :lang(zh)) body { line-height: 1.75; }
:root:is(:lang(ja), :lang(zh)) :is(h1, h2, h3) { line-height: 1.3; }
:root:is(:lang(ja), :lang(zh)) h1 { font-size: clamp(2rem, 3vw + 1rem, 3.3rem); }
:root:is(:lang(ja), :lang(zh)) h2 { font-size: clamp(1.5rem, 2vw + 0.8rem, 2.3rem); }
:root:is(:lang(ja), :lang(zh)) .eyebrow { letter-spacing: 0.08em; }

/* Japanese headlines break between phrases, not inside a word (Chrome 119+). */
:root:lang(ja) :is(h1, h2, h3) { word-break: auto-phrase; }
