/* =========================================================================
   FansMeta — Japanese typography layer
   Scoped to html[lang="ja"]. Loaded LAST on every /ja/ page.

   Why this exists:
   - Sora / Hanken Grotesk / Space Mono carry NO CJK glyphs, so Japanese text
     fell back to whatever font each visitor's OS happened to ship. This layer
     appends 'Zen Kaku Gothic New' (geometric JP gothic, sibling to Sora) as the
     CJK fallback on every family — Latin glyphs still render in the Latin face
     via per-glyph fallback; only CJK glyphs use Zen Kaku.
   - The base type was tuned for Latin (negative tracking, 0.98 leading, 64px
     hero). Full-width CJK reads ~2x larger and denser, so headlines looked
     enormous and tracking crushed the glyphs. Here we neutralize the negative
     tracking, loosen leading, enable kinsoku line-breaking, and scale headlines
     down. EN pages are never touched.

   Selector sets below are the exhaustive list of Sora / Space Mono rules that
   render on JA pages (signal.css + signal-home-v2.css + signal-pages.css),
   derived by grep. signal-home.css is still linked by ja/index.html but its
   classes (.hero/.stat/.feat/.orbit/.node/.float-card …) appear nowhere in the
   JA markup — dead weight, no live JP text — so its selectors are omitted.
   ========================================================================= */

/* ---- 1) Default (Hanken) text: append JP fallback, drop Latin tracking.
   All unstyled <p>/.lead/nav/footer text inherits this. ---- */
html[lang="ja"] body{
  font-family:'Hanken Grotesk','Zen Kaku Gothic New',sans-serif;
  letter-spacing:0;
}
html[lang="ja"] input,
html[lang="ja"] textarea,
html[lang="ja"] select{
  font-family:'Hanken Grotesk','Zen Kaku Gothic New',sans-serif;
}

/* ---- 2) Sora group: append JP fallback + neutralize negative tracking ---- */
html[lang="ja"] .display,
html[lang="ja"] h1, html[lang="ja"] h2, html[lang="ja"] h3, html[lang="ja"] h4,
html[lang="ja"] .btn, html[lang="ja"] .arrow-link,
html[lang="ja"] .brand, html[lang="ja"] .brand-mark,
html[lang="ja"] .drawer a, html[lang="ja"] .office h5,
/* signal-home-v2 (index) */
html[lang="ja"] .sp-pill, html[lang="ja"] .diff,
html[lang="ja"] .step h4, html[lang="ja"] .cap h4, html[lang="ja"] .engine h4,
html[lang="ja"] .metric b, html[lang="ja"] .widget-head b,
html[lang="ja"] .widget-actions span, html[lang="ja"] .lead-float b,
html[lang="ja"] .update-float b, html[lang="ja"] .kbp-inner b,
html[lang="ja"] .gen-btn, html[lang="ja"] .rail b, html[lang="ja"] .geo b,
/* signal-pages (about / services / get-started) */
html[lang="ja"] .svc-sub, html[lang="ja"] .mk-stat .v, html[lang="ja"] .mk-btn,
html[lang="ja"] .mk-prow b, html[lang="ja"] .compare thead th,
html[lang="ja"] .why-list h4, html[lang="ja"] .loc-card .loc-code,
html[lang="ja"] .loc-card .loc-role, html[lang="ja"] .contact-points h4{
  font-family:'Sora','Zen Kaku Gothic New',sans-serif;
  letter-spacing:normal;
}

/* ---- 3) Space Mono group: append JP fallback ---- */
html[lang="ja"] .eyebrow, html[lang="ja"] .chip,
html[lang="ja"] .lang-toggle, html[lang="ja"] .foot-col h4,
html[lang="ja"] .office .flag,
/* signal-home-v2 (index) */
html[lang="ja"] .p-idx, html[lang="ja"] .s-num, html[lang="ja"] .step code,
html[lang="ja"] .mock-url, html[lang="ja"] .src-chip,
html[lang="ja"] .lead-float span, html[lang="ja"] .file-tag,
html[lang="ja"] .v-meta, html[lang="ja"] .update-float span,
html[lang="ja"] .engine h4 small, html[lang="ja"] .logo-ph,
html[lang="ja"] .try-label, html[lang="ja"] .try-note,
html[lang="ja"] .kbp-inner span, html[lang="ja"] .cc-tag,
html[lang="ja"] .results-note, html[lang="ja"] .geo span,
/* signal-pages (about / services / get-started) */
html[lang="ja"] .crumb, html[lang="ja"] .svc-tag, html[lang="ja"] .mock-name,
html[lang="ja"] .mock-pill, html[lang="ja"] .mk-stat .k,
html[lang="ja"] .mk-line .tag, html[lang="ja"] .mk-suggest .s-k,
html[lang="ja"] .mk-clip .c-dur, html[lang="ja"] .mk-clip .c-lang,
html[lang="ja"] .compare thead th:first-child, html[lang="ja"] .compare tbody th,
html[lang="ja"] .compare .rate, html[lang="ja"] .step .snum,
html[lang="ja"] .loc-card .loc-flag, html[lang="ja"] .field label,
html[lang="ja"] .field .err{
  font-family:'Space Mono','Zen Kaku Gothic New',monospace;
}

/* Soften the wide Latin tracking on prominent JP section labels (too airy on
   kana/kanji). Decorative English mock micro-labels keep their tracking. */
html[lang="ja"] .eyebrow, html[lang="ja"] .chip,
html[lang="ja"] .svc-tag, html[lang="ja"] .crumb, html[lang="ja"] .cc-tag,
html[lang="ja"] .try-label, html[lang="ja"] .results-note,
html[lang="ja"] .field label,
html[lang="ja"] .compare tbody th, html[lang="ja"] .compare thead th:first-child{
  letter-spacing:.1em;
}

/* ---- 4) CJK heading metrics: loosen leading + kinsoku line-breaking ---- */
html[lang="ja"] .display,
html[lang="ja"] h1, html[lang="ja"] h2, html[lang="ja"] h3, html[lang="ja"] h4,
html[lang="ja"] .diff{
  line-height:1.34;
  line-break:strict;
  text-wrap:balance;
}

/* ---- 5) Headline sizes: full-width CJK reads larger — scale down ~20-25%,
   preserving hierarchy hero ≈ page-title > section. ---- */
html[lang="ja"] .h-hero2{ font-size:clamp(30px,3.6vw,48px); }
html[lang="ja"] .h1{ font-size:clamp(30px,3.8vw,52px); }
html[lang="ja"] .h2{ font-size:clamp(24px,3vw,38px); }

/* ---- 6) Prose leading. Mock chat bubbles (.msg) are <div>, not <p>, so they
   keep their tight leading and don't overflow their fixed frames.
   (.btn tracking is already reset in the Sora group above.) ---- */
html[lang="ja"] p,
html[lang="ja"] .lead{ line-height:1.8; }
