.lang-switcher {
  position: relative;
  z-index: 1000;
  flex-shrink: 0;
  margin-right: 0;
}

.lang-switcher__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 2.5rem;
  padding: 0 0.85rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  background: #fff;
  color: #111827;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.lang-switcher__btn:hover,
.lang-switcher__btn[aria-expanded="true"] {
  background: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
}

.lang-switcher__chevron {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.lang-switcher__btn[aria-expanded="true"] .lang-switcher__chevron {
  transform: rotate(180deg);
}

header .lang-switcher__list,
.lang-switcher__list {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  left: auto;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.15rem;
  width: max-content;
  min-width: 11.5rem;
  max-width: min(16rem, calc(100vw - 1.5rem));
  max-height: min(70vh, 22rem);
  overflow-x: hidden;
  overflow-y: auto;
  margin: 0;
  padding: 0.4rem;
  list-style: none;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  background: #fff;
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.12);
}

header .lang-switcher__list[hidden],
.lang-switcher__list[hidden] {
  display: none !important;
}

header .lang-switcher__list li,
.lang-switcher__list li {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  line-height: normal;
  list-style: none;
}

header .lang-switcher__list a,
.lang-switcher__link {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.75rem;
  border-radius: 0.375rem;
  color: #111827;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
  text-align: left;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

header .lang-switcher__list a:hover,
.lang-switcher__link:hover {
  background: #eff6ff;
  color: #2563eb;
}

header .lang-switcher__list a.lang-switcher__item--active,
.lang-switcher__item--active {
  background: #dbeafe;
  color: #2563eb;
  font-weight: 600;
  pointer-events: none;
}

.lang-switcher--mobile {
  margin: 0 0 1rem;
  display: none;
}

.lang-switcher-mobile-item {
  display: none !important;
  list-style: none !important;
  width: 100%;
  margin: 0;
  padding: 0;
}

.lang-switcher--mobile .lang-switcher__btn {
  width: 100%;
  justify-content: space-between;
}

header .lang-switcher--mobile .lang-switcher__list,
.lang-switcher--mobile .lang-switcher__list {
  position: static;
  margin-top: 0.5rem;
  max-width: none;
  width: 100%;
  box-shadow: none;
}

.lang-switcher--legal {
  position: relative;
  top: auto;
  right: auto;
  left: auto;
  margin: 0;
  z-index: 40;
  flex: 0 0 auto;
}

.lang-switcher--legal .lang-switcher__list {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}

.breadcrumbs {
  position: relative;
  z-index: 1;
}

.breadcrumbs:has(.lang-switcher) {
  z-index: 40;
}

.breadcrumbs .container {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1rem;
}

.breadcrumbs .breadcrumb-list {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 767px) {
  .breadcrumbs .container {
    flex-direction: column;
  }
}

header {
  overflow: visible;
}

@media (max-width: 1023px) {
  header .lang-switcher:not(.lang-switcher--mobile) {
    display: block;
    order: -1;
    margin-right: 0.15rem;
  }

  /* Trigger sits next to the logo; open the list to the right so it stays on-screen */
  header .lang-switcher:not(.lang-switcher--mobile) .lang-switcher__list {
    left: 0;
    right: auto;
    min-width: 10.5rem;
    max-width: min(16rem, calc(100vw - 2rem));
  }

  .lang-switcher__btn {
    height: 2.25rem;
    padding: 0 0.65rem;
    font-size: 0.8125rem;
  }

  .lang-switcher--mobile {
    display: block;
  }

  .lang-switcher-mobile-item {
    display: block !important;
    margin: 0 0 0.75rem;
  }
}

@media (max-width: 639px) {
  header .lang-switcher:not(.lang-switcher--mobile) .lang-switcher__current {
    font-size: 0;
    line-height: 0;
  }

  header .lang-switcher:not(.lang-switcher--mobile) .lang-switcher__current::before {
    font-size: 0.8125rem;
    line-height: 1;
    font-weight: 600;
  }

  html:lang(en) header .lang-switcher:not(.lang-switcher--mobile) .lang-switcher__current::before {
    content: "EN";
  }

  html:lang(da) header .lang-switcher:not(.lang-switcher--mobile) .lang-switcher__current::before {
    content: "DA";
  }

  html:lang(nl) header .lang-switcher:not(.lang-switcher--mobile) .lang-switcher__current::before {
    content: "NL";
  }
}
