/* Japanese (JA) language layer. Additive: every rule is scoped to html[lang=ja] or to [lang=ja] content,
   so EN/RU/ES rendering is unchanged (apart from the 4-segment switcher sizing). */
html:not([lang=ja]) [lang=ja]{display:none!important}
html[lang=ja] [lang=en],html[lang=ja] [lang=ru],html[lang=ja] [lang=es]{display:none!important}
html[lang=ja] [data-es-hide]{display:none!important}
/* system CJK font stack: Latin stays on the page font, kana/kanji fall to the platform Japanese face */
html[lang=ja]{--sans:-apple-system,BlinkMacSystemFont,"SF Pro Text","Inter","Segoe UI",Roboto,"Hiragino Sans","Hiragino Kaku Gothic ProN","Noto Sans JP","Noto Sans CJK JP","Yu Gothic UI","Yu Gothic",Meiryo,system-ui,sans-serif}
html[lang=ja] body{font-family:var(--sans);line-break:strict;overflow-wrap:break-word}
html[lang=ja] [lang=ja]{font-family:var(--sans)}
html[lang=ja] h1,html[lang=ja] h2,html[lang=ja] h3,html[lang=ja] h4{font-family:var(--sans);letter-spacing:0;font-style:normal}
html[lang=ja] em,html[lang=ja] i{font-style:normal;font-weight:600}
html[lang=ja] p,html[lang=ja] li{line-height:1.75}
html[lang=ja] code,html[lang=ja] pre,html[lang=ja] kbd,html[lang=ja] samp{font-family:ui-monospace,"SF Mono",Menlo,Consolas,"Noto Sans Mono CJK JP","Hiragino Sans",monospace}
/* switcher: four segments, >=40px tap targets on phones */
.lang button{letter-spacing:.04em}
@media (max-width:520px){
  html header.top .lang{gap:0;padding:2px}
  html header.top .lang button{min-width:40px;min-height:40px;padding:0 .2rem;font-size:.72rem;letter-spacing:.02em}
  .sb-hdr-ctl{gap:.3rem}
}
@media (max-width:380px){
  html header.top .lang button{min-width:40px;min-height:40px;padding:0 .15rem;font-size:.7rem}
  header.top .theme-toggle,header.top .sb-burger{width:40px;height:40px;min-width:40px}
  .sb-hdr-ctl{gap:.2rem;margin-left:0}
  header.top .wrap{gap:.2rem}
}
/* Japanese copy is shorter but wider per glyph: keep the shared footer on one row on desktop */
@media (min-width:900px){
  html[lang=ja] .sb-shared .sb-shared-inner{gap:1.25rem 1.25rem;flex-wrap:nowrap}
  html[lang=ja] .sb-shared-tag{max-width:15rem}
  html[lang=ja] .sb-shared-brand{min-width:0}
  html[lang=ja] .sb-shared-links{gap:.15rem .85rem;justify-content:center}
}
/* JA line breaking: keep short emphasised phrases / pills whole, break long copy on any character */
html[lang=ja] .eyebrow,html[lang=ja] .btn,html[lang=ja] .k-tag,html[lang=ja] .k-lang{word-break:keep-all;overflow-wrap:anywhere}
html[lang=ja] h1,html[lang=ja] h2,html[lang=ja] h3{text-wrap:balance}
html[lang=ja] [lang=ja],html[lang=ja] [lang=ja] *{font-style:normal}
/* /2/ (grandparent page) has its own large-type switcher (1rem is large there): four buttons must stay on screen on phones, tap targets stay >=44px */
@media (max-width:520px){
  .e-lang button{min-width:44px;min-height:44px;margin-left:3px;padding:0 4px;font-size:.8rem}
  .e-top .theme-toggle{width:44px;height:44px}
  .e-top .hdr-ctl{gap:6px}
}
html[lang=ja] :is(h1,h2,h3,h4){word-break:auto-phrase;text-wrap:balance}
