/* Language switcher (site/js/lang.js) on every website page: a cream pill with a globe and the language code in the
   game's thin clay ring, opening a cream list with the same ring; the current language has a terracotta ring and dot.
   Shared by the landing page (site.css) and the legal pages (legal.css), so it brings its own ring and colours. */
.lang, .lang-hint { --lang-ink: #2F5D62; --lang-terra: #B4572F; --lang-k: 6.2; }
.lang { position: relative; flex: none;
  font-family: "Baloo 2", "Fredoka", system-ui, -apple-system, "Segoe UI", sans-serif; }
.lang-btn, .lang-panel, .lang-hint {
  border: 0; background: none;
  border-image: url("../img/ui/ring.webp") 161 168 160 168 fill /
    calc(161px / var(--lang-k)) calc(168px / var(--lang-k)) calc(160px / var(--lang-k)) calc(168px / var(--lang-k));
  box-shadow: 0 2px 6px rgba(33, 58, 61, 0.15);
}
.lang-btn {
  display: inline-flex; align-items: center; gap: 5px; min-height: 46px; margin: 0; padding: 0 12px 0 13px;
  border-radius: 999px; color: var(--lang-ink); font-family: inherit; font-size: 1rem; font-weight: 700; line-height: 1; letter-spacing: .02em;
  cursor: pointer; box-shadow: 0 2px 6px rgba(33, 58, 61, 0.15); -webkit-tap-highlight-color: transparent;
  transition: transform .25s cubic-bezier(.34, 1.56, .64, 1);
}
.lang-btn:hover { background: none; transform: translateY(-1px); }
.lang-btn:focus-visible, .lang-list a:focus-visible, .lang-hint a:focus-visible, .lang-hint-close:focus-visible {
  outline: 3px solid var(--lang-ink); outline-offset: 3px;
}
.lang-btn svg { flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lang-globe { width: 20px; height: 20px; }
.lang-code { padding-top: 2px; }
.lang-caret { width: 16px; height: 16px; transition: transform .2s ease; }
.lang.is-open .lang-caret { transform: rotate(180deg); }

.lang-panel {
  position: absolute; z-index: 30; right: 0; top: calc(100% + 8px);
  width: max-content; min-width: 214px; max-width: calc(100vw - 32px); padding: 10px;
  border-radius: 26px; box-shadow: 0 2px 6px rgba(33, 58, 61, 0.15), 0 18px 34px -18px rgba(110, 60, 20, 0.5);
}
.lang-panel[hidden] { display: none; }
.lang-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.lang-list a {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 44px; padding: 2px 14px 0 16px;
  border: 2px solid transparent; border-radius: 999px;
  color: var(--lang-ink); font-family: inherit; font-size: 1.05rem; font-weight: 600; line-height: 1.1; text-decoration: none;
}
.lang-list a:hover { background: #EBD9C2; color: var(--lang-ink); }
.lang-list a[aria-current] { border-color: var(--lang-terra); color: #8A3F22; background: #FFF8F1; }
.lang-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.lang-list a[aria-current] .lang-dot { background: var(--lang-terra); }

/* Hint on the English start page when the browser prefers another language (no redirect, nothing stored) */
.lang-hint {
  position: absolute; z-index: 25; right: var(--gutter, 16px); top: calc(100% - 4px);
  width: max-content; max-width: min(340px, calc(100vw - 32px)); padding: 12px 48px 13px 18px; border-radius: 22px;
  color: var(--lang-ink); font: 500 0.98rem/1.4 "Outfit", system-ui, sans-serif;
  box-shadow: 0 2px 6px rgba(33, 58, 61, 0.15), 0 14px 30px -16px rgba(110, 60, 20, 0.5);
}
.lang-hint p { margin: 0; }
.lang-hint a { color: #0E6570; font-weight: 700; white-space: nowrap; }
.lang-hint-close {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; margin: 0; padding: 0;
  border: 0; border-radius: 50%; background: none; box-shadow: none; color: var(--lang-ink); cursor: pointer;
}
.lang-hint-close::before, .lang-hint-close::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 16px; height: 2.5px; border-radius: 2px; background: currentColor;
  transform: translate(-50%, -50%) rotate(45deg);
}
.lang-hint-close::after { transform: translate(-50%, -50%) rotate(-45deg); }
.lang-hint-close:hover { background: #EBD9C2; }

/* Legal pages: switcher at the top right of the header, the note about English texts under the logo */
.site-head { position: relative; max-width: 680px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.site-head .lang { position: absolute; right: 16px; top: 16px; }
.legal-lang-note { margin: 14px 0 0; text-align: center; font-size: 0.95rem; color: #5E554D; }
@media (max-width: 420px) {
  .site-head .site-logo { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { .lang-btn, .lang-caret { transition: none; } }
