/* Languages: the switcher in every page's header, and the type for Chinese and Japanese (tools/build_i18n.py). */

/* ---------- switcher: EN 简 繁 ES 日, the same look as the slide tool's on the home page (slides.css) ---------- */
.nav-lang { display: flex; align-items: center; flex-shrink: 0; }
.nav .lang-bar { display: flex; gap: 0; border: 1px solid var(--cocoa); border-radius: calc(2 * var(--u)); overflow: hidden; }
.nav .lb { font-family: var(--mono); font-size: calc(11.5 * var(--u)); letter-spacing: .04em; line-height: 1; color: var(--taupe); background: transparent; border: none;
  padding: calc(8 * var(--u)) calc(10 * var(--u)) calc(7 * var(--u)); cursor: pointer; transition: color .15s, background-color .15s; white-space: nowrap; text-decoration: none; }
.nav .lb:not(:last-child) { border-right: 1px solid var(--cocoa); }
.nav .lb:hover { color: var(--cream); }
.nav .lb.on { color: var(--charcoal); background: var(--amber); }
.nav .lang-sel { display: none; font-family: var(--mono); font-size: calc(12 * var(--u)); line-height: 1.2; color: var(--stone); background-color: var(--charcoal);
  border: 1px solid var(--cocoa); border-radius: calc(2 * var(--u)); padding: calc(7 * var(--u)) calc(26 * var(--u)) calc(6 * var(--u)) calc(10 * var(--u)); cursor: pointer; -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23C0B8AB' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right calc(9 * var(--u)) center; background-size: calc(10 * var(--u)); }
.nav.on-light .lang-bar, .nav.on-light .lb:not(:last-child) { border-color: var(--taupe); }
.nav.on-light .lb { color: var(--cocoa); }
.nav.on-light .lb:hover { color: var(--charcoal); }
.nav.on-light .lb.on { color: var(--cream); background: var(--charcoal); }
.nav.on-light .lang-sel { color: var(--cocoa); background-color: var(--cream); border-color: var(--taupe);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2353453C' fill='none' stroke-width='1.5'/%3E%3C/svg%3E"); }
/* it sits with the button and Menu on the right; once the page name hides (≤ 860 px) it is what pushes them there */
.nav-lang ~ .nav-menu { margin-left: 0; }
@media (max-width: 860px) { .nav-lang { margin-left: auto; } }
@media (max-width: 760px) { .nav .lang-bar { display: none; } .nav .lang-sel { display: block; } }

/* ---------- Chinese and Japanese ----------
   ML Sans and PT Mono have no CJK letters, so each language names its own system face right after them: PingFang
   (Simplified / Traditional) and Hiragino Sans on Apple devices, Noto Sans CJK / Source Han Sans, then Microsoft's.
   Japanese never borrows a Chinese face (the kanji are drawn differently). Latin, digits and the brand stay ML Sans / PT Mono. */
:root:lang(zh-Hans) { --cjk: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif; }
:root:lang(zh-Hant) { --cjk: "PingFang TC", "Noto Sans TC", "Noto Sans CJK TC", "Source Han Sans TC", "Microsoft JhengHei", sans-serif; }
:root:lang(ja) { --cjk: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Noto Sans CJK JP", "Source Han Sans JP", "Yu Gothic", "Meiryo", sans-serif; }
:root:is(:lang(zh), :lang(ja)) {
  --sans: "ML Sans", var(--cjk);
  --mono: "ML Mono", "PT Mono", var(--cjk);
}
:lang(ja) { line-break: strict; }
/* Japanese headings break between phrases (Chrome); wrapping is otherwise the English pages' own */
:lang(ja) :is(h1, h2, h3, h4, .lede, .panel-points b, .features b, .jing-cards b, .steps b, .pull p, .tests span, .mech-facts dd, .kv dd) { word-break: auto-phrase; }
/* no line ends on a lone character (Chrome, Safari 17.4+) */
:is(:lang(zh), :lang(ja)) :is(p, dd, li, label span) { text-wrap: pretty; }
/* measured headline lines (main.js splitLines): a word never breaks inside itself */
:is(:lang(zh), :lang(ja)) [data-split] .w { white-space: nowrap; }
/* each line clips its own rise (site.css .split-line); CJK faces stand taller than the headlines' tight line height,
   so the clip reaches a little higher there (Marcus, 2026-10-29: the top of 能力憲章 was cut off) */
:is(:lang(zh), :lang(ja)) .split-line { padding-top: .16em; margin-top: -.16em; }
/* phrases set as one piece in the translations */
:is(:lang(zh), :lang(ja)) .nb { display: inline-block; }

/* ---------- longer words ----------
   Phone, home page: the tool's own row (Pricing, Privacy, language, Log in) is one line; in Spanish it runs ~10 px
   over a 390 px screen, so its gaps and the Log in button's tracking tighten a little there. */
@media (max-width: 420px) {
  html:lang(es) .home .nav .nav-r { gap: calc(8 * var(--u)); }
  html:lang(es) .home .nav .nav-r .nav-links { gap: calc(11 * var(--u)); letter-spacing: .05em; }
  html:lang(es) .home .nav .lang-sel { padding: calc(7 * var(--u)) calc(20 * var(--u)) calc(6 * var(--u)) calc(8 * var(--u)); background-position: right calc(7 * var(--u)) center; }
  html:lang(es) .home .nav #nav-login { letter-spacing: 0; padding-inline: calc(9 * var(--u)) !important; }
}
@media (max-width: 370px) {
  html:lang(es) .home .nav .nav-r .nav-links, html:lang(es) .home .nav #nav-login { font-size: calc(10.5 * var(--u)) !important; letter-spacing: 0; }
}
