/* Language switcher in the fixed header + per-language font fallbacks (see i18n.js) */
.i18n-wait body { visibility: hidden; }

/* Fonts: Cinzel has no Cyrillic, so the pages' --serif falls back to Cormorant SC (same small-caps feel;
   loaded only in 600/700, so Cinzel's 400 maps to the heavier 600). Chinese: Noto SC, loaded on demand. */
/* Chinese: system fonts (a web font for Chinese is several MB) — Songti/SimSun for titles, PingFang/YaHei for text */
html:lang(zh) { --serif: 'Cinzel', 'Noto Serif SC', 'Songti SC', 'STSong', 'SimSun', serif; --sans: 'Manrope', 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif; }
html:lang(zh) body { letter-spacing: .02em; }

.nav .lang {
  position: relative; flex-shrink: 0;
  margin: 28px 0 0 32px;           /* centred on the logo, like .nav__links */
  transition: margin-top .4s cubic-bezier(.2,.8,.2,1);
  font-family: 'Manrope', sans-serif;
}
.nav.is-compact .lang { margin-top: 12px; }
.nav .nav__links { margin-left: auto; }

.lang__btn {
  display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 14px 0 12px;
  border: 1px solid rgba(255,255,255,.24); border-radius: 999px;
  background: rgba(255,255,255,.06);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  color: var(--white, #F3E5D1); font: 500 15px/1 'Manrope', sans-serif; letter-spacing: .06em;
  cursor: pointer; transition: background .2s, border-color .2s;
}
.lang__btn:hover, .lang.is-open .lang__btn { background: rgba(255,255,255,.14); border-color: rgba(243,229,209,.4); }
.lang__btn:focus-visible, .lang__menu button:focus-visible { outline: 2px solid #d97736; outline-offset: 2px; }
.lang__btn svg { width: 18px; height: 18px; fill: currentColor; }
.lang__btn .lang__globe { fill: none; stroke: currentColor; stroke-width: 1.2; }
.lang__btn .lang__chev { width: 12px; height: 12px; stroke-width: 1.5; transition: transform .25s; }
.lang.is-open .lang__chev { transform: rotate(180deg); }

.lang__menu {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 2;
  min-width: 200px; margin: 0; padding: 8px; list-style: none;
  /* same glass as the mobile menu panel (assets/nav.css); tint per page/theme via --menu-glass / --menu-line */
  background: var(--menu-glass, rgba(28,28,28,.55));
  -webkit-backdrop-filter: blur(24px) saturate(1.4); backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--menu-line, rgba(243,229,209,.14)); border-radius: 16px;
  box-shadow: 0 24px 48px rgba(0,0,0,.28);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .2s, transform .2s, visibility 0s .2s;
}
.lang.is-open .lang__menu { opacity: 1; visibility: visible; transform: none; transition: opacity .2s, transform .2s; }
.lang__menu button {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 12px; border: 0; border-radius: 10px; background: none;
  color: var(--w72, rgba(243,229,209,.72)); font: 400 16px/20px 'Manrope', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif; text-align: left;
  cursor: pointer; transition: background .15s, color .15s;
}
.lang__menu button b { font-weight: 500; font-size: 12px; letter-spacing: .08em; opacity: .5; }
.lang__menu button:hover { background: var(--menu-line, rgba(255,255,255,.08)); color: var(--white, #F3E5D1); }
.lang__menu button[aria-selected="true"] { color: var(--white, #F3E5D1); }
.lang__menu button[aria-selected="true"] b { color: var(--accent, #d97736); opacity: 1; }

/* Russian: the Cyrillic fallback (Cormorant SC) reads smaller than Cinzel — menu links a step larger */
html:lang(ru) .nav__links a { font-size: 1.12em; }

/* desktop: menu links centred on the screen in every language (not between logo and buttons,
   whose widths change with the translation) */
@media (min-width: 1201px) {
  header.nav .nav__links { position: absolute; left: 50%; transform: translateX(-50%); margin: 0; }
  header.nav .lang { margin-left: auto; }
}
@media (max-width: 1200px) { .nav .lang { margin-left: 24px; } }
@media (max-width: 900px) {
  .nav .lang { margin-top: 28px; }
  .nav.is-compact .lang { margin-top: 5px; }
  .lang__btn { height: 40px; padding: 0 12px 0 10px; font-size: 14px; }
}

/* longer translations: titles never break inside a word — i18n.js shrinks a title whose longest word
   is wider than its box; uppercase pills may wrap on phones */
@media (max-width: 600px) {
  html:not(:lang(en)) .pill { white-space: normal; max-width: 100%; text-align: center; }
}
