.language-switcher {
  position: relative;
  flex: 0 0 auto;
}

.language-switcher summary {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  border: 1px solid oklch(0.78 0.04 82 / 0.82);
  border-radius: 999px;
  padding: 0 12px;
  background: var(--panel);
  color: var(--plum);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  list-style: none;
  white-space: nowrap;
  cursor: pointer;
}

.language-switcher summary::-webkit-details-marker { display: none; }

.language-switcher summary:hover,
.language-switcher summary:focus-visible {
  border-color: var(--rose);
  color: var(--plum);
  outline: none;
}

.language-switcher summary:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rose) 20%, transparent);
}

.language-switcher-chevron {
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

.language-switcher[open] .language-switcher-chevron {
  transform: translateY(2px) rotate(225deg);
}

.language-switcher-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  display: grid;
  width: min(18rem, calc(100vw - 2rem));
  max-height: min(24rem, calc(100vh - 6rem));
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px;
  background: var(--panel);
}

.language-switcher-menu a {
  min-height: 40px;
  border-radius: 7px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.language-switcher-menu a:hover,
.language-switcher-menu a:focus-visible,
.language-switcher-menu a[aria-current="page"] {
  background: var(--panel-soft);
  color: var(--plum);
  outline: none;
}

.language-switcher-menu a[aria-current="page"] { font-weight: 850; }

@media (max-width: 760px) {
  .language-switcher-menu {
    right: -4px;
    width: min(17rem, calc(100vw - 1.25rem));
  }
}

@media (prefers-reduced-motion: reduce) {
  .language-switcher-chevron { transition: none; }
}
