/* Language switcher — additive stylesheet, does not modify existing header/nav CSS.
   Works for both desktop and mobile (375px) viewports; the RTL mirror is in i18n-rtl.css. */
.lang-switcher { position: relative; order: 2; margin-left: 12px; }
.lang-switcher-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 4px; background: #fff;
  padding: 8px 12px; font: 700 0.82rem inherit; color: var(--ink); cursor: pointer;
}
.lang-switcher-toggle:after { content: "▾"; font-size: 0.7rem; color: var(--muted, #65706a); }
.lang-switcher-menu {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 45;
  min-width: 160px; padding: 6px; background: #fff; border: 1px solid var(--line);
  box-shadow: var(--shadow); border-radius: 4px;
}
.lang-switcher.open .lang-switcher-menu { display: block; }
.lang-switcher-menu a {
  display: block; padding: 9px 10px; border-radius: 3px; text-decoration: none;
  color: var(--ink); font-size: 0.86rem; font-weight: 600;
}
.lang-switcher-menu a:hover, .lang-switcher-menu a:focus-visible { background: var(--cream, #f7f4ed); }
.lang-switcher-menu a.active { color: var(--rust); font-weight: 800; }
@media (max-width: 900px) {
  /* Adding the switcher as a third flex item in .header-row (brand + switcher + menu-toggle,
     gap:24px from the existing phase1.css) was enough to push the row past 375px and cause
     page-level horizontal overflow — tighten the gap on narrow viewports only, for every
     language (this was already tight for English too, just not quite over the edge). */
  .header-row { gap: 8px; }
  .lang-switcher { order: 1; margin-left: 8px; }
  .lang-switcher-toggle { padding: 7px 9px; font-size: 0.78rem; }
}
@media (max-width: 480px) {
  .lang-switcher-toggle .lang-switcher-current { max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 360px) {
  /* 2026-09-27: real 320px-width testing (document.documentElement.clientWidth, not the
     unreliable window.innerWidth) found the header row still overflows by ~56px below 360px --
     .brand keeps its base 1.2rem Georgia width (flex:0 0 auto, white-space:nowrap, never
     declared shrinkable) and .menu-toggle keeps the generic button padding, so brand+menu-
     toggle+switcher no longer fit even after the 900px-breakpoint tightening above. Every value
     below is additive (only active under 360px) and does not touch phase1.css/.brand directly,
     keeping this one stylesheet as the single owner of "header row math" the switcher affected. */
  .header-row { gap: 4px; }
  .brand { font-size: 0.95rem; }
  .menu-toggle { padding: 7px 9px; font-size: 0.8rem; }
  .lang-switcher { margin-left: 4px; }
  .lang-switcher-toggle { padding: 5px 6px; }
  .lang-switcher-toggle .lang-switcher-current { max-width: 34px; }
}
