/* 日本語 (ja) overrides.
 *
 * Loaded by header.php only when the page is in this language, so no other visitor
 * downloads it. Everything is scoped to html[lang="ja"] and cannot leak.
 *
 * Japanese. Inter has no Japanese, so it falls through to the system face.
 * Measured against the English: the median string is 53% of the English length,
 * so nothing overflows; the rules below are typographic.
 */

/* Latin stays in the site's own Inter; this script falls through to the system face named
   here. Setting the theme's two font variables reaches everything styled with them. */
html[lang="ja"] {
    --primary-font: "Inter", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "Meiryo", "Noto Sans JP", sans-serif;
    --alt-font: "Inter", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "Meiryo", "Noto Sans JP", sans-serif;
}
html[lang="ja"] :is(body, input, textarea, select, button, .btn) {
    font-family: var(--primary-font);
}

/* Marks above and below the line need more room than the Latin line height gives. */
html[lang="ja"] :is(body, p, li) { line-height: 1.85; }
/* Small headings set with a size utility (an h3 at fs-20) keep the theme's 50px line: it is what
   spaces them. main.js tightens them only when they wrap. */
html[lang="ja"] :is(h1, h2, h3, h4, h5, h6):not(.fs-12, .fs-13, .fs-14, .fs-15, .fs-16, .fs-17, .fs-18, .fs-19, .fs-20, .fs-22, .fs-24, .fs-26, .fs-2, .fs-3, .fs-4, .fs-5, .fs-6) { line-height: 1.45; }

/* Tracking and synthetic italics were chosen for Latin. On this script tracking pulls
   apart clusters that belong together, and there is no true italic -- the browser only
   slants the glyphs. Icon fonts rely on <i> and are exempt. */
html[lang="ja"] :is(h1, h2, h3, h4, h5, h6, .ls-minus-1px, .ls-minus-2px, .btn, .pot-lang-toggle, .pot-lang-soon) {
    letter-spacing: 0;
}
html[lang="ja"] :is(em, i:not([class*="icon"]):not([class*="fa-"]):not([class*="bi-"]):not([class*="feather"])) {
    font-style: normal;
    font-weight: 600;
}

/* Japanese line breaking: strict keeps small kana and closing punctuation off the start of
   a line. Long Latin tokens (URLs, spec strings) may still break rather than overflow. */
html[lang="ja"] { line-break: strict; }
html[lang="ja"] :is(td, th, .pot-lang-name, .nav-link) { overflow-wrap: anywhere; }

/* Buttons whose English label is one word and whose translation is two or three. */
html[lang="ja"] :is(.btn.btn-switch-text.btn-small, .btn.btn-switch-text.btn-very-small, .btn.btn-medium) > span {
    white-space: normal;
    line-height: 1.3;
}

/* Plan cards keep each feature on one line; translated feature names need a second
   line rather than an ellipsis. */
html[lang="ja"] :is(#vps-features-list li, .pot-plan-feature) {
    white-space: normal;
    line-height: 1.5;
}

/* Break headings between phrases (bunsetsu) rather than after any character, so a heading
   does not end on a lone kana ("サービ" / "ス"). Browsers without auto-phrase ignore it. */
html[lang="ja"] :is(h1, h2, h3, h4, h5, h6, .accordion-title) { word-break: auto-phrase; }
