/* ======================================================================
   Fixmart · Japanese pages only (/ja/). Loaded after home.css; Spanish and English pages never load it,
   so they never download Japanese fonts. Same visual system as variant F: only Japanese typesetting.
   Font: subset of IBM Plex Sans JP (SIL OFL 1.1, © IBM Corp.), renamed «Fixmart JP Sans» as the licence
   requires for modified versions; it holds only the glyphs used on these pages (tools/ja-fuente.cjs).
   Latin text keeps IBM Plex Sans; kana/kanji fall back to the JP subset, then to the system's Japanese fonts.
   ====================================================================== */
/* font-display: optional (measured 25-nov-2026, CPU ×4 + slow 4G): with «swap» the late font change moved the layout
   (CLS up to 0.09 on /ja/); with a preload, LCP rose to 2.5–3.6 s. «optional» gives CLS 0: a first visit on a slow
   connection keeps the system Japanese font (Yu Gothic / Hiragino) and the subset, already cached, is used from then on.
   The PDF generator (tools/pdf-comercial.cjs) switches it to «block» so printed material always embeds this font. */
@font-face { font-family: "Fixmart JP Sans"; src: url("/fonts/fixmart-jp-sans-400.woff2") format("woff2"); font-weight: 100 500; font-style: normal; font-display: optional; }
@font-face { font-family: "Fixmart JP Sans"; src: url("/fonts/fixmart-jp-sans-600.woff2") format("woff2"); font-weight: 600 900; font-style: normal; font-display: optional; }

:root:lang(ja) {
  --font: "IBM Plex Sans", "Fixmart JP Sans", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, "Noto Sans JP", "Plex Sans Fallback", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "Fixmart JP Sans", "Hiragino Sans", "Yu Gothic UI", Meiryo, "Plex Mono Fallback", ui-monospace, monospace;
}

/* Japanese body text: more leading, strict kinsoku (line-break rules), no word hyphenation. */
:lang(ja) body { line-height: 1.85; line-break: strict; word-break: normal; overflow-wrap: anywhere; }
:lang(ja) :is(p, li, dd, td, th, figcaption, summary, .lede, .body) { line-break: strict; }

/* Headings: Latin tracking does not suit kana/kanji. Neutral tracking, proportional kana (palt),
   natural phrase breaks (auto-phrase, progressive enhancement), and a little more leading. */
:lang(ja) :is(h1, h2, h3, h4, .display, .h-xl, .h-lg, .h-md) {
  letter-spacing: 0.01em; line-height: 1.32; font-feature-settings: "palt" 1; word-break: auto-phrase;
}
:lang(ja) .hero h1.display { line-height: 1.25; }
:lang(ja) .lede { line-height: 1.75; letter-spacing: 0.01em; }

/* Labels written in Japanese: no uppercase tracking (kana/kanji are not capitalised). Latin data keeps mono. */
:lang(ja) :is(.meta, .sec-head .lab, .kicker, .figcap, .pair-k, .crumbs, .proof .proof-tag, .tl-step .tl-k, .footer-col h2, .case-facts dt) { letter-spacing: 0.06em; }
:lang(ja) .textlink { letter-spacing: 0.04em; }

/* Buttons and short UI: Japanese labels can be longer; allow natural wrapping without breaking words badly. */
:lang(ja) .btn { line-height: 1.4; text-align: center; }
:lang(ja) .nav-link, :lang(ja) .nav-solid, :lang(ja) .nav-ghost { letter-spacing: 0.02em; }

/* Language switch: the Japanese label is a word, not a code. */
.lang [lang="ja"] { letter-spacing: 0; }

/* Mobile: the header CTA keeps the same height as in Spanish (Japanese body leading would make it taller),
   and long Japanese hero headlines get a slightly smaller size so phrases do not leave a lone 「で。」 line. */
:lang(ja) .nav-cta-m { line-height: 1.2; }
@media (max-width: 600px) { :lang(ja) .hero h1.display, :lang(ja) .landing-hero h1 { font-size: 2.1rem; line-height: 1.3; } }

/* Generic «monospace» in a Japanese page resolves to MS Gothic on Windows: code samples (privacy notice) use Plex Mono. */
:lang(ja) code { font-family: var(--mono); }
/* Diagram labels (inline SVG) name «IBM Plex Mono, monospace» as an attribute; CSS overrides it so kana use the subset. */
:lang(ja) svg text { font-family: var(--mono); }

/* Printed monthly page: the print header names the mono family directly; in Japanese it must reach the JP subset. */
@media print { :lang(ja) .page-mensual .print-head { font-family: var(--mono); } }
