/**
 * StreamVerse — Language Switcher (DE/EN)
 *
 * Lives inside the existing header, grouped with the CTA/menu-toggle
 * in a new .header__actions row so all three share the header grid's
 * third column. Nesting the existing .header__cta and
 * .header__menu-toggle inside this new flex wrapper does not change
 * their own rules in header.css: grid-column/justify-self only have an
 * effect on a direct grid item, so once nested inside a flex
 * container those two declarations simply stop applying (harmlessly)
 * — every other rule on those two elements (size, color, background,
 * the existing display:none/flex breakpoint toggle) is unaffected.
 *
 * One switcher instance per page. It reads as "before Get Started" on
 * desktop and "before the menu toggle" on mobile purely from source
 * order plus the SAME 1024px breakpoint header.css already uses to
 * hide the CTA and show the hamburger (and vice versa) — no separate
 * mobile/desktop switcher markup needed.
 */

.header__actions {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.lang-switcher {
  position: relative;
  flex-shrink: 0;
}

.lang-switcher__trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: 36px;
  padding-inline: var(--space-3);
  background: transparent;
  border: 1px solid rgba(248, 250, 252, 0.24);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: var(--text-body-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition:
    border-color var(--duration-micro) var(--ease-standard),
    background-color var(--duration-micro) var(--ease-standard);
}

.lang-switcher__trigger:hover {
  border-color: rgba(248, 250, 252, 0.48);
  background-color: rgba(248, 250, 252, 0.06);
}

.lang-switcher__trigger:focus-visible {
  outline: 2px solid var(--color-accent-hover);
  outline-offset: 2px;
}

.lang-switcher__current {
  line-height: 1;
}

.lang-switcher__chevron {
  width: 14px;
  height: 14px;
  transition: transform var(--duration-micro) var(--ease-standard);
}

.js-lang-switcher.is-open .lang-switcher__chevron {
  transform: rotate(180deg);
}

.lang-switcher__menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  min-width: 168px;
  background-color: var(--color-bg-elevated);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  z-index: 10;
}

.lang-switcher__menu[hidden] {
  display: none;
}

.lang-switcher__option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 40px;
  padding-inline: var(--space-3);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: var(--text-body-sm);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--duration-micro) var(--ease-standard);
}

.lang-switcher__option:hover {
  background-color: var(--color-bg-elevated-hover);
}

.lang-switcher__option:focus-visible {
  outline: 2px solid var(--color-accent-hover);
  outline-offset: -2px;
}

.lang-switcher__option[aria-checked="true"] {
  color: var(--color-accent-hover);
}

/* Inline SVG, not emoji: Windows/Chrome frequently render the flag
   emoji sequence (regional-indicator pairs) as plain "DE"/"GB" letter
   glyphs instead of a merged flag icon, since Windows ships no color
   flag-emoji font by default. An SVG paints identically everywhere. */
.lang-switcher__flag-icon {
  width: 20px;
  height: 14px;
  border-radius: 2px;
  flex-shrink: 0;
  display: block;
}

/* ------------------------------------------------------------------
 * Very narrow phones (<360px isn't in the required test list, but
 * this keeps the trigger from ever crowding the hamburger at the
 * smallest supported width).
 * ------------------------------------------------------------------ */
@media (max-width: 359px) {
  .lang-switcher__trigger {
    padding-inline: var(--space-2);
  }
}
