/* Language menu — DE · EN · ES · FR · PT (desktop) / globe dropdown (mobile) */
.am-lang-menu {
  --am-brand: #712177;
  --am-muted: #6b7280;
  --am-text: #0d116e;
  position: relative;
  z-index: 10060;
  font-family: Lato, "Istok Web", Arial, sans-serif;
  font-size: 15px; /* was 12px — a bit larger */
  line-height: 1.3;
  letter-spacing: 0.03em;
  color: var(--am-muted);
  pointer-events: auto;
}

.am-lang-menu * {
  box-sizing: border-box;
}

.am-lang-desktop {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}

.am-lang-desktop > li {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0;
}

.am-lang-desktop a,
.am-lang-desktop .am-lang-active {
  display: inline-block;
  padding: 6px 7px; /* was 4px 5px */
  text-decoration: none;
  font-weight: 400;
  color: var(--am-muted);
  border-radius: 3px;
}

.am-lang-desktop a:hover,
.am-lang-desktop a:focus-visible {
  color: var(--am-brand);
  outline: none;
}

.am-lang-desktop a:focus-visible {
  box-shadow: 0 0 0 2px rgba(113, 33, 119, 0.35);
}

.am-lang-desktop .am-lang-active {
  font-weight: 700;
  color: var(--am-brand);
  cursor: default;
}

.am-lang-desktop .am-lang-sep {
  display: inline-block;
  padding: 0 1px;
  color: #b0b7c3;
  font-weight: 400;
  user-select: none;
}

.am-lang-mobile {
  display: none;
  position: relative;
}

.am-lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 9px 12px; /* was 7px 10px */
  border: 1px solid #cddee8;
  border-radius: 6px;
  background: #fff;
  color: var(--am-text);
  font: inherit;
  font-weight: 700;
  font-size: 15px; /* was 13px */
  letter-spacing: 0.04em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.am-lang-btn:hover,
.am-lang-btn:focus-visible {
  border-color: var(--am-brand);
  color: var(--am-brand);
  outline: none;
}

.am-lang-btn:focus-visible {
  box-shadow: 0 0 0 2px rgba(113, 33, 119, 0.35);
}

.am-lang-btn[aria-expanded="true"] {
  border-color: var(--am-brand);
  color: var(--am-brand);
}

.am-lang-globe {
  width: 18px; /* was 16px */
  height: 18px;
  flex: 0 0 auto;
  display: block;
}

.am-lang-caret {
  font-size: 10px;
  line-height: 1;
  opacity: 0.75;
}

.am-lang-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 168px;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  background: #fff;
  border: 1px solid #cddee8;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(13, 17, 110, 0.12);
  z-index: 10070;
}

.am-lang-dropdown[hidden] {
  display: none !important;
}

.am-lang-dropdown li {
  margin: 0;
  padding: 0;
}

.am-lang-dropdown a,
.am-lang-dropdown .am-lang-active {
  display: block;
  padding: 10px 14px;
  text-decoration: none;
  font-size: 16px; /* was 14px */
  font-weight: 400;
  letter-spacing: normal;
  color: var(--am-text);
}

.am-lang-dropdown a:hover,
.am-lang-dropdown a:focus-visible {
  background: #f6eef7;
  color: var(--am-brand);
  outline: none;
}

.am-lang-dropdown .am-lang-active {
  font-weight: 700;
  color: var(--am-brand);
  background: #f6eef7;
  cursor: default;
}

/* Hide legacy Sparkle / old switcher when new menu is present */
body:has(.am-lang-menu) ul.menu-dropdown-1,
body:has(.am-lang-menu) .am-lang-switch,
body:has(.am-lang-menu) .mobile-lang-toggle {
  display: none !important;
}

@media (max-width: 767px) {
  .am-lang-menu .am-lang-desktop {
    display: none !important;
  }

  .am-lang-menu .am-lang-mobile {
    display: block;
  }

  /*
   * Fixed in the header band, horizontally centered („etwas mehr mittig”).
   * Clears logo (left) and hamburger (.mobile-toolbar top-right: 12px / 44px).
   */
  .am-lang-menu {
    position: fixed;
    top: 10px; /* was 0 — sit in header row with toolbar */
    left: 50%; /* was right: 12px — nudge toward center */
    right: auto;
    transform: translateX(-50%);
    z-index: 10080;
  }

  body:has(.am-lang-menu) .mobile-toolbar .mobile-lang-toggle {
    display: none !important;
  }
}

@media (min-width: 768px) {
  .am-lang-menu .am-lang-mobile {
    display: none !important;
  }

  .am-lang-menu .am-lang-desktop {
    display: flex;
  }

  /*
   * All pages (incl. Home): standalone slot after logo — same geometry so
   * menu + purple Querbalken do not jump when switching pages/languages.
   * (Home no longer uses Sparkle ps6 / margin-top:-82px overlap.)
   */
  .am-lang-slot--standalone {
    display: inline-block !important;
    vertical-align: top;
    position: relative;
    z-index: 50;
    margin-left: 420px; /* toward right of header beside logo */
    margin-top: 0;
    min-width: 220px;
    pointer-events: auto;
  }

  .am-lang-slot--standalone .am-lang-menu {
    transform: translateY(8px);
  }

  /* Fallback if a menu is still a direct body child */
  body > .am-lang-menu {
    position: fixed;
    top: 18px;
    right: 24px;
    z-index: 10080;
    background: rgba(255, 255, 255, 0.92);
    padding: 4px 8px;
    border-radius: 6px;
  }
}
