/* Self-hosted Inter variable font (latin subset).
   One file serves all weights 300-800 — eliminates the Google Fonts
   round trip that caused weight flashing during page load. */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 300 800;
    font-display: block;
    src: url('../fonts/inter-var.woff2') format('woff2-variations');
    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;
}

/* ── CJK fallbacks (Chinese / Japanese) ───────────────────────────────────
   Inter carries no CJK glyphs (see its unicode-range above), and neither
   does system-ui on Windows — so without an explicit stack the browser
   picks whatever it likes. For Japanese that often means a *Chinese* font,
   which renders shared characters in the wrong regional forms: visibly
   foreign to a native reader.

   Inter stays first on purpose. Its unicode-range means Latin text —
   Gastronix, LUMA, GL-1500, cmH2O/L/s — keeps the brand typeface, while
   only CJK characters fall through to the regional font below.

   System fonts rather than self-hosted Noto: a full CJK webfont is several
   MB, and PingFang / YaHei / Noto CJK are already present on effectively
   every device. Zero download, correct regional shapes. */
html[lang^="zh"] body,
html[lang^="zh"] button,
html[lang^="zh"] input,
html[lang^="zh"] textarea,
html[lang^="zh"] select {
    font-family: 'Inter', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei',
                 'Noto Sans SC', 'Source Han Sans SC', system-ui, sans-serif;
}

html[lang^="ja"] body,
html[lang^="ja"] button,
html[lang^="ja"] input,
html[lang^="ja"] textarea,
html[lang^="ja"] select {
    font-family: 'Inter', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Meiryo',
                 'Noto Sans JP', 'Source Han Sans JP', system-ui, sans-serif;
}

/* CJK has no spaces between words, so browsers may break mid-term.
   Keep breaking natural and avoid mid-word breaks in headings. */
html[lang^="zh"] h1, html[lang^="zh"] h2, html[lang^="zh"] h3,
html[lang^="ja"] h1, html[lang^="ja"] h2, html[lang^="ja"] h3 {
    line-break: strict;
    overflow-wrap: normal;
}

/* ── CJK tracking fix ─────────────────────────────────────────────────────
   Negative letter-spacing is a Latin display-type convention: it tightens
   proportional glyphs. CJK glyphs are drawn on a fixed em square, so negative
   tracking makes neighbouring characters COLLIDE — their horizontal strokes
   merge into what looks like a strikethrough through the whole line. It is
   worst around characters that are themselves a horizontal bar, e.g. 一.

   The homepage tagline and subtitle set both letter-spacing (-0.04em/-0.02em)
   and font-family INLINE, which also bypassed the CJK stack defined above.
   Inline styles can only be overridden with !important, so that is used here —
   scoped to zh/ja only, leaving Latin typography completely untouched.

   Cleaner long-term fix: move those inline styles in front-page.php into
   utility classes, then this block can drop the !important. */
html[lang^="zh"] h1, html[lang^="zh"] h2, html[lang^="zh"] h3,
html[lang^="zh"] h4, html[lang^="zh"] p,
html[lang^="ja"] h1, html[lang^="ja"] h2, html[lang^="ja"] h3,
html[lang^="ja"] h4, html[lang^="ja"] p {
    letter-spacing: normal !important;
}

html[lang^="zh"] h1, html[lang^="zh"] h2, html[lang^="zh"] h3,
html[lang^="zh"] h4, html[lang^="zh"] p {
    font-family: 'Inter', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei',
                 'Noto Sans SC', 'Source Han Sans SC', system-ui, sans-serif !important;
}

html[lang^="ja"] h1, html[lang^="ja"] h2, html[lang^="ja"] h3,
html[lang^="ja"] h4, html[lang^="ja"] p {
    font-family: 'Inter', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Meiryo',
                 'Noto Sans JP', 'Source Han Sans JP', system-ui, sans-serif !important;
}
