/* ============================================================
   KELD — Language switcher
   v1.0

   Defined once and loaded by both the public site and the app,
   which run different CSS frameworks — so this file depends on
   nothing but its own tokens, with a light-mode default and a
   [data-bs-theme="dark"] / .keld-dark override.

   Structure:
     .keld-lang               positioning context
       .keld-lang-trigger     the pill — the ENTIRE area is the button
       .keld-lang-menu        the popup list
         .keld-lang-option    flag + name + tick
   ============================================================ */

.keld-lang {
  position: relative;
  display: inline-block;
  font-family: inherit;
}

/* ---------- trigger: whole pill is clickable ---------- */
.keld-lang-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px 0 11px;
  margin: 0;
  border-radius: 999px;
  background: rgba(25, 184, 148, 0.08);
  border: 1px solid rgba(25, 184, 148, 0.32);
  /* #5A4BD4 on this pale tint is only 2.3:1 — use a darker shade of the
     same hue for AA (5.99:1). Dark mode restores full phosphor below. */
  color: #0F6B54;
  font-family: inherit;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .06em;
  line-height: 1;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.keld-lang-trigger:hover {
  background: rgba(25, 184, 148, 0.14);
  border-color: #5A4BD4;
  color: #0B4C3C;
}
.keld-lang-trigger:focus-visible {
  outline: none;
  border-color: #5A4BD4;
  box-shadow: 0 0 0 3px rgba(25, 184, 148, 0.2);
}

.keld-lang-flag {
  width: 18px;
  height: 13px;
  border-radius: 2.5px;
  display: block;
  flex: 0 0 auto;
  object-fit: cover;
}
.keld-lang-flag-none {
  width: 18px; height: 13px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 2.5px;
  background: rgba(127, 127, 127, .25);
  font-size: 7px; font-weight: 700; letter-spacing: 0;
}
.keld-lang-globe { font-size: 13px; }
.keld-lang-code { line-height: 1; }
.keld-lang-caret {
  font-size: 9px;
  opacity: .7;
  margin-left: 1px;
  transition: transform .18s ease;
}
.keld-lang.is-open .keld-lang-caret { transform: rotate(180deg); }

/* ---------- menu ---------- */
.keld-lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1080;
  min-width: 190px;
  margin: 0;
  padding: 6px;
  list-style: none;
  border-radius: 14px;
  background: #FFFFFF;
  border: 1px solid rgba(0, 0, 0, .1);
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .28);

  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s;
}
.keld-lang.is-open .keld-lang-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* no-JS fallback: hover/focus reveals the list, links still navigate */
.keld-lang:not([data-keld-lang-ready]):hover .keld-lang-menu,
.keld-lang:not([data-keld-lang-ready]):focus-within .keld-lang-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.keld-lang-menu li { margin: 0; padding: 0; list-style: none; }

.keld-lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 9px;
  color: #111827;
  font-size: .88rem;
  font-weight: 500;
  letter-spacing: normal;
  text-decoration: none;
  transition: background .14s ease, color .14s ease;
}
.keld-lang-option:hover,
.keld-lang-option:focus-visible {
  outline: none;
  background: rgba(25, 184, 148, 0.1);
  color: #0B4C3C;
}
.keld-lang-option.is-current { font-weight: 700; color: #0F6B54; }
.keld-lang-name { flex: 1 1 auto; }
.keld-lang-check { font-size: 10px; color: #5A4BD4; }

/* ---------- compact variant (dashboard bar) ---------- */
.keld-lang.sm .keld-lang-trigger { height: 34px; font-size: .78rem; padding: 0 10px; }
.keld-lang.sm .keld-lang-flag { width: 17px; height: 12px; }

/* ---------- dark ---------- */
[data-bs-theme="dark"] .keld-lang-trigger,
.keld-dark .keld-lang-trigger {
  background: rgba(108, 92, 231, 0.08);
  border-color: rgba(108, 92, 231, 0.32);
  color: #6C5CE7;
}
[data-bs-theme="dark"] .keld-lang-trigger:hover,
.keld-dark .keld-lang-trigger:hover {
  background: rgba(108, 92, 231, 0.14);
  border-color: #6C5CE7;
  color: #A29BFE;
  box-shadow: 0 0 18px -4px rgba(108, 92, 231, 0.4);
}
[data-bs-theme="dark"] .keld-lang-trigger:focus-visible,
.keld-dark .keld-lang-trigger:focus-visible {
  border-color: #6C5CE7;
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.2);
}
[data-bs-theme="dark"] .keld-lang-menu,
.keld-dark .keld-lang-menu {
  background: #12161A;
  border-color: rgba(255, 255, 255, .1);
  box-shadow: 0 20px 44px -14px rgba(0, 0, 0, .75);
}
[data-bs-theme="dark"] .keld-lang-option,
.keld-dark .keld-lang-option { color: #FFFFFF; }
[data-bs-theme="dark"] .keld-lang-option:hover,
[data-bs-theme="dark"] .keld-lang-option:focus-visible,
.keld-dark .keld-lang-option:hover,
.keld-dark .keld-lang-option:focus-visible {
  background: rgba(108, 92, 231, 0.12);
  color: #A29BFE;
}
[data-bs-theme="dark"] .keld-lang-option.is-current,
.keld-dark .keld-lang-option.is-current { color: #6C5CE7; }
[data-bs-theme="dark"] .keld-lang-check,
.keld-dark .keld-lang-check { color: #6C5CE7; }

/* ---------- mobile: pill goes full width inside the collapsed nav ---------- */
@media (max-width: 991px) {
  .header-auth .keld-lang { width: 100%; }
  .header-auth .keld-lang-trigger { width: 100%; height: 44px; justify-content: center; }
  .header-auth .keld-lang-menu { left: 0; right: 0; min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .keld-lang-trigger,
  .keld-lang-menu,
  .keld-lang-caret,
  .keld-lang-option { transition: none; }
}
