/* Language switcher + Korean/Malay typography. Loaded on every page, EN, KO and MS. */

.lang-switch{
  font-family: var(--mono); font-size: 12.5px; line-height: 1;
  padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--ink-dim); background: transparent;
  margin-right: 10px; white-space: nowrap;
  transition: color .2s ease, border-color .2s ease;
}
.lang-switch:hover, .lang-switch:focus-visible{ color: var(--ink); border-color: var(--link); }
@media (max-width: 1040px){
  .lang-switch{ margin-left: auto; }
  .lang-switch + .lang-switch{ margin-left: 0; }
}
.lang-switch + .lang-switch{ margin-left: -4px; }
@media (max-width: 480px){
  .lang-switch{ padding: 8px 9px; margin-right: 6px; }
}

/* ---- Korean ---------------------------------------------------------------
   Latin keeps Space Grotesk / Inter / Plex Mono; Hangul falls through to
   Pretendard (loaded only on /ko/ pages). keep-all stops words breaking
   mid-syllable-block, which is how Korean line-wrapping should behave. */
html:lang(ko){
  --body:    'Inter', 'Pretendard Variable', Pretendard, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --display: 'Space Grotesk', 'Pretendard Variable', Pretendard, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --mono:    'IBM Plex Mono', 'Pretendard Variable', Pretendard, monospace;
  --b: var(--body);
  --d: var(--display);
}
:lang(ko) body{ word-break: keep-all; overflow-wrap: break-word; }
:lang(ko) h1, :lang(ko) h2, :lang(ko) h3{ line-height: 1.3; letter-spacing: -0.01em; }
:lang(ko) p, :lang(ko) li{ line-height: 1.75; }
:lang(ko) .kinetic-h1{ line-height: 1.2; }

.lang-note{
  margin-top: 12px; font-size: 14px; color: var(--ink-faint);
  border-left: 2px solid var(--progress); padding-left: 12px;
}

/* ---- Malay ----------------------------------------------------------------
   Latin script, so the existing fonts cover it. Malay runs ~20-30% longer than
   English and has long compound words, so let headings wrap cleanly. */
:lang(ms) h1, :lang(ms) h2, :lang(ms) h3{ overflow-wrap: break-word; hyphens: auto; }
:lang(ms) .nav-cta, :lang(ms) .nav-links a, :lang(ms) .brand-text strong{ white-space: nowrap; }
@media (min-width: 1041px){
  :lang(ms) .nav-links a{ padding-left: 5px; padding-right: 5px; }
  :lang(ms) .nav-links{ gap: 0; }
  :lang(ms) .lang-switch{ margin-right: 6px; }
}
