/* ============================================================
   Shared header layout guard
   Keeps every desktop navigation label on one line. If the
   available width is too small, the existing compact navigation
   is used instead of squeezing or wrapping individual labels.
   ============================================================ */

@media (min-width: 1280px) {
  .aka-hd,
  .pf-hd {
    gap: clamp(0.7rem, 1.15vw, 1.1rem) !important;
  }

  .aka-hd__brand,
  .pf-hd__brand,
  .aka-hd__cta,
  .pf-hd__cta,
  .aka-hd__portal {
    flex: 0 0 auto;
  }

  .aka-hd__nav,
  .pf-nav {
    min-width: 0;
    flex-wrap: nowrap !important;
    gap: clamp(0.55rem, 0.9vw, 0.85rem) !important;
  }

  .aka-hd__link,
  .pf-nav a,
  .aka-hd__cta a,
  .pf-hd__cta a {
    flex: 0 0 auto;
    white-space: nowrap !important;
  }
}

/* Between tablet and wide desktop, keep the header readable by using the
   already available compact menu rather than allowing a two-line label. */
@media (min-width: 901px) and (max-width: 1279px) {
  .aka-hd__nav,
  .aka-hd__cta {
    display: none !important;
  }

  .aka-hd__portal {
    margin-left: auto !important;
  }

  .aka-hd__burger {
    display: flex !important;
    margin-left: 0 !important;
  }

  .aka-hd__burger,
  .aka-hd__brand {
    position: relative;
    z-index: 60;
  }
}

/* Sub-page header (.pf-hd): mirror the main header behaviour between
   tablet and wide desktop. Below 1280px the compact burger replaces the
   text nav so links are always reachable — previously the .pf-nav simply
   disappeared without any replacement, leaving no way to reach the other
   Leistungen from a sub-page. */
@media (min-width: 901px) and (max-width: 1279px) {
  .pf-nav {
    display: none !important;
  }

  .pf-hd__cta {
    display: none !important;
  }

  .pf-hd__burger {
    display: flex !important;
    margin-left: auto !important;
  }
}

/* -------- .pf-hd__burger — 3-line icon, animates to X when open -------- */
.pf-hd__burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0;
  margin-left: var(--space-2, 8px);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-strong, #16130f);
  transition: background-color 160ms ease;
  position: relative;
  z-index: 60;
}

.pf-hd__burger:hover,
.pf-hd__burger:focus-visible {
  background: rgba(22, 22, 22, 0.06);
  outline: none;
}

.pf-hd__burger span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1),
              opacity 160ms ease;
  transform-origin: center;
}

/* -------- Header elevation while the sheet is open ---------------------
   Der fixed Header (.aka-hd/.pf-hd hat z-index:50, das Sheet z-index:55)
   verschwindet sonst unter dem Overlay — damit der Burger als Close-
   Trigger sichtbar/klickbar bleibt, heben wir den Header über das Sheet. */
body.aka-sheet-open .aka-hd,
body.aka-sheet-open .pf-hd {
  z-index: 60;
}

/* The concept switcher is a separate header implementation. */
.kbar__tabs {
  flex-wrap: nowrap !important;
}

.kbar__tab {
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (min-width: 721px) and (max-width: 1100px) {
  .kbar__tabs {
    display: none !important;
  }
}
