/* Algoritmi — Japanese typography layer.
   Loaded after site.css on /ja/ pages only; generated pages get the <link> from
   tools/build-i18n.mjs. Nothing here is locale-agnostic — it exists purely to undo the
   latin-specific tuning in site.css, which is too tight for kana and kanji. */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400..900&display=swap');

:root {
  /* Roboto keeps the latin and the figures, Noto Sans JP takes everything else.
     The generics sit last on purpose: site.css builds --sans on top of the design
     system's --font-sans, which already ends in `sans-serif`, and a generic family
     resolves to a concrete face the browser may treat as the end of the chain — so
     anything listed after it can go unconsulted. Every Japanese face has to come first. */
  --jp: 'Noto Sans JP', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic UI', 'Yu Gothic', Meiryo;
  --sans: 'Roboto', var(--jp), ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: 'Roboto Mono', var(--jp), ui-monospace, monospace;
}

/* ---- Leading -------------------------------------------------------------
   Japanese needs more air between lines than latin at the same size, but display
   sizes still want it tight, so this tracks the size rather than applying one value. */
.h1  { line-height: 1.26; }
.h2  { line-height: 1.34; }
.h3  { line-height: 1.45; }
.h4  { line-height: 1.5; }
.lead, .hero__sub { line-height: 1.8; }
.body, .quote__text { line-height: 1.9; }
.small { line-height: 1.75; }

/* ---- Tracking ------------------------------------------------------------
   Negative tracking is a latin refinement; on kana it collapses the counters and
   makes the line muddy. Zero it out wherever site.css tightens a heading. */
.h1, .h2, .h3, .h4,
.stat__n, .quote__text--lg { letter-spacing: 0; }

/* The wide tracking on mono eyebrows is there to make short uppercase latin read as a
   label. Uppercasing does nothing for kana, and .14em pulls a Japanese eyebrow apart. */
.eyebrow, .eyebrow--sm { letter-spacing: .04em; }

/* ---- Line breaking -------------------------------------------------------
   Japanese breaks between characters, so no hyphenation and no mid-word breaks on the
   latin product names (VCP, Vibe Coding Platform) that run through the copy. */
body { line-break: strict; word-break: normal; overflow-wrap: anywhere; }

/* Numerals and currency stay latin-tracked — these are figures, not prose. */
.stat__n, .tbl td.num, .mono { font-feature-settings: 'palt' 0; }

/* body sets overflow-wrap:anywhere so a long latin run can never overflow its column.
   Inside a data table that is wrong: it breaks an address or a postcode mid-token
   ("七日町1-56-" / "1"). Japanese still wraps between characters here, and latin and
   numeric tokens stay whole. */
.tbl th, .tbl td { overflow-wrap: normal; }

/* ---- Fit -----------------------------------------------------------------
   A Japanese line is typically shorter than its English source at the same measure,
   so the fixed max-widths tuned for English leave the text ragged and narrow. */
.lead { max-width: 34em; }
.hero__sub { max-width: 30em; }
