/* LanguageSwitcher, LanguageMenu and LanguageMenuItem ("Landing Page" Figma, Local components,
   3 Nov 2026). Top bar of the landing page, Sign up, Log in and the admin site.
   Needs /assets/tokens/sapawoo.css and the .icon mask class from /assets/auth/auth.css. */

.lang-switch { position: relative; display: inline-flex; flex: none; }

.lang-switch__trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
  height: 44px;
  padding: var(--space-8) var(--space-12);
  border: 0;
  border-radius: var(--radius-button);
  background: transparent;
  color: var(--content-primary);
  font: var(--text-label-md);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s, box-shadow .15s;
}
.lang-switch__trigger:hover,
.lang-switch__trigger[aria-expanded="true"] { background: var(--surface-muted); }
.lang-switch__trigger:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.lang-switch__chevron { color: var(--content-secondary); transition: transform .15s; }
.lang-switch__trigger[aria-expanded="true"] .lang-switch__chevron { transform: rotate(180deg); }

/* LanguageMenu: right-aligned, 8 px below the trigger. */
.lang-switch__menu {
  position: absolute;
  top: calc(100% + var(--space-8));
  right: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  width: 220px;
  margin: 0;
  padding: var(--space-8);
  list-style: none;
  background: var(--surface-panel);
  border: var(--stroke-default) solid var(--border-subtle);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-md);
}
.lang-switch__menu[hidden] { display: none; }
.lang-switch__menu:focus { outline: none; }
/* In the mobile menu the switcher sits on the left, so its menu opens to the right. */
.lang-switch--start .lang-switch__menu { right: auto; left: 0; }

/* LanguageMenuItem: the selected one has the check and surface/accent-subtle. */
.lang-switch__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
  height: 44px;
  padding: var(--space-8) var(--space-12);
  border-radius: var(--radius-control);
  color: var(--content-primary);
  font: var(--text-body-md);
  white-space: nowrap;
  cursor: pointer;
}
.lang-switch__option:hover,
.lang-switch__option.is-active { background: var(--surface-muted); }
.lang-switch__option[aria-selected="true"] { background: var(--surface-accent-subtle); }
.lang-switch__menu:focus-visible .lang-switch__option.is-active { box-shadow: inset 0 0 0 2px var(--border-focus); }
.lang-switch__check { visibility: hidden; color: var(--content-primary); }
.lang-switch__option[aria-selected="true"] .lang-switch__check { visibility: visible; }

/* Phones: the Sign up and Log in top bar has no room for the language name, so the trigger is
   the globe alone (its aria-label still says the language). The menu lines up with the top bar's
   right edge, so it stays on screen. */
@media (max-width: 640px) {
  .topbar__right:has(> .lang-switch) { position: relative; gap: var(--space-4); }
  .topbar .lang-switch { position: static; }
  .topbar .lang-switch__label,
  .topbar .lang-switch__chevron { display: none; }
  .topbar .lang-switch__trigger { justify-content: center; width: 44px; padding: 0; }
}
@media (max-width: 374px) {
  .topbar:has(.lang-switch) { gap: var(--space-8); padding: 0 var(--space-12); }
  .topbar:has(.lang-switch) .topbar__brand img { width: 108.93px; height: 18px; }
  .topbar__right:has(> .lang-switch) .btn--ghost { padding: 0 var(--space-8); }
}
