/* Japanese and Chinese (Ekosystem docs/strona/i18n-workflow.md section 5): the system's own CJK
   fonts behind the site's Latin fonts, nothing downloaded. Linked by Base.astro on the pages of
   ja and zh only, with the faces of its language (cjk-ja.css, cjk-zh.css), since
   an @font-face cannot be scoped to a language and the same ideograph is drawn differently in
   Japanese and Chinese fonts.

   Each Latin family of the site gets extra faces that cover only the CJK ranges and point to
   local fonts (local(), never a download), so Latin words, numbers and labels keep the site's
   look and every CJK character takes the system font of its language at the right weight. A
   system without any of them falls back to the browser's own font for the language. */

/* no italics in CJK text: the Lora italic of <em> becomes weight (Lora has no CJK either) */
:where(html:is([lang="ja"], [lang="zh-Hans"])) em {
  font-family: inherit !important;
  font-style: normal !important;
  font-weight: 700;
}

/* the site's negative letter-spacing (-0.02 to -0.03em) packs ideographs into each other;
   !important because the headings carry it in many section rules of higher specificity */
html:is([lang="ja"], [lang="zh-Hans"]) :is(h1, h2, h3, h4, .brand-name, .f-name, .s-price) {
  letter-spacing: 0 !important;
}

/* taller lines for the denser script, and the strict line-break rules of Japanese and Chinese
   (no small kana or closing punctuation at the start of a line) */
html:is([lang="ja"], [lang="zh-Hans"]) body { line-height: 1.75; line-break: strict; }
html:is([lang="ja"], [lang="zh-Hans"]) :is(p, li, dd) { line-height: 1.75; }

/* Japanese headings break between phrases, not inside a word (Chrome 119+, Japanese only;
   other browsers keep the default); not the h3 of narrow cards, where a phrase is wider than the card */
html[lang="ja"] :is(h1, h2) { word-break: auto-phrase; }
