/* Topbar und Header (Entwurf „Startseite Modernisiert“): rote Topbar mit Logo-Parallelogramm,
   darunter fixierte weiße Header-Zeile mit Logo, Hauptmenü und Suche. */

/* Topbar */
.hwx-topbar {
  height: 40px;
  overflow: hidden;
  background: #D11F34;
  color: #fff;
}

.hwx-topbar .hwx-topbar__inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  box-sizing: border-box;
  width: min(1360px, 100%);
  height: 100%;
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2rem);
}

.hwx-topbar .hwx-topbar__mark {
  flex: 0 0 auto;
  width: 250px;
  height: 40px;
  margin-left: -1.25rem;
  background: #fff;
  transform: skewX(-15deg);
}

.hwx-topbar .hwx-topbar__modules {
  display: flex;
  justify-content: flex-end;
  min-width: 0;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}

.hwx-topbar .hwx-topbar__social {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 1.25rem;
}

.hwx-topbar .hwx-topbar__divider {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, .5);
}

.hwx-topbar .hwx-topbar__social a {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 40px;
  color: #fff;
  font-size: 1rem;
  text-decoration: none;
}

.hwx-topbar .hwx-topbar__social a:hover {
  opacity: .8;
}

.hwx-topbar .hwx-topbar__social a:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -4px;
}

/* bisher über .container-header .container-topbar geregelt */
.hwx-topbar .dj-megamenu-modern {
  justify-content: flex-end;
}

.hwx-topbar .dj-megamenu-modern li a.dj-up_a,
.hwx-topbar .dj-megamenu-modern li a.dj-up_a > span {
  height: unset;
}

/* Header-Zeile */
/* app.css setzt .container-header unter 992px auf position: relative !important */
.hwx-header.container-header {
  position: sticky !important;
}

.hwx-header {
  position: sticky;
  top: 0;
  z-index: 1020;
  background: #fff;
  box-shadow: inset 0 5px 5px rgba(0, 0, 0, .03), 0 1px 0 #DBE3E8;
}

.hwx-header .container-nav.hwx-header__bar {
  display: block;
  padding: 0;
}

.hwx-header .hwx-header__inner {
  display: flex;
  align-items: center;
  gap: 2rem;
  box-sizing: border-box;
  width: min(1360px, 100%);
  min-height: 72px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2rem);
}

/* Modul-Chrome „container“ nicht als Bootstrap-Container */
.hwx-header .hwx-header__inner > .module {
  flex: 0 0 auto;
  width: auto;
  max-width: none;
  margin: 0;
  padding: 0;
}

.hwx-header .hwx-header__inner > .module:has(.hwx-navbar) {
  flex: 1 1 auto;
  min-width: 0;
}

/* Logo (mod_custom 182): ohne das bisherige Parallelogramm, 210px breit */
/* Logo-Regeln aus app.css (ab 1465px: a mit bottom:26px; darunter p mit padding-top und img mit width !important) neutralisieren */
.hwx-header #mod-custom182 > p {
  margin: 0;
  padding: 0;
  text-align: left !important;
}

.hwx-header #mod-custom182 a {
  bottom: auto;
  display: flex;
  align-items: center;
  width: 210px;
  height: auto;
  margin: 0;
}

.hwx-header #mod-custom182 a::after {
  content: none;
}

/* Ganz oben ragt das Logo in das weiße Parallelogramm der Topbar; sobald die Topbar aus dem Bild ist
   („is-scrolled“, assets/js/header.js), rutscht es in die Header-Zeile */
.hwx-header #mod-custom182 a {
  position: relative;
  z-index: 1;
  /* -0.8125rem: sichtbares Logo mittig unter dem weißen Parallelogramm (Mitte der Unterkante, wegen skewX) */
  transform: translate(-.8125rem, -1.375rem) scale(1.08);
  transform-origin: left center;
  transition: transform .3s ease;
}

.hwx-header.is-scrolled #mod-custom182 a {
  transform: none;
}

/* Das animierte SVG (viewBox 177×91) hat oben/unten je ~22% Leerraum für die Animation. Statt negativem
   Außenabstand (ragte bei fixiertem Header über den Rand) wird der Leerraum per object-fit im Bild abgeschnitten:
   bei 210px Breite liegt das sichtbare Logo in den Zeilen 23–84 von 108. */
.hwx-header #mod-custom182 img {
  display: block;
  bottom: 0;
  width: 210px !important;
  max-width: none;
  height: 64px;
  margin: 0 !important; /* Inline-Style margin-top im Modulinhalt */
  object-fit: cover;
  object-position: 50% 50%;
}

/* Suche */
.hwx-header .hwx-header__search-toggle {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid #DBE3E8;
  border-radius: 9999px;
  background: #fff;
  color: #0C3247;
  font-size: 1rem;
  text-decoration: none;
  transition: border-color .2s ease, color .2s ease;
}

.hwx-header .hwx-header__search-toggle:hover,
.hwx-header .hwx-header__search-toggle[aria-current="page"] {
  border-color: #D11F34;
  color: #D11F34;
}

.hwx-header .hwx-header__search-toggle:focus-visible {
  outline: 3px solid #D11F34;
  outline-offset: 2px;
}

/* Regionsleiste (html/layouts/hwx/regionfilter.php, nur auf den im Plugin gewählten Menüpunkten).
   Mit JS (header.js, Klasse has-regionbar) hängt sie absolut unter der Header-Zeile und gleitet beim Runterscrollen
   hinter sie (is-regionbar-hidden). Der Header hält ihre Höhe frei, damit beim Ein- und Ausblenden nichts springt. */
.hwx-header .hwx-regionbar {
  border-top: 1px solid #DBE3E8;
  background: #fff;
}

.hwx-header.has-regionbar {
  margin-bottom: var(--hwx-regionbar-height, 0px);
}

/* Header-Zeile vor der Leiste, damit diese beim Wegschieben dahinter verschwindet */
.hwx-header.has-regionbar .container-nav.hwx-header__bar {
  position: relative;
  z-index: 1;
  background: #fff;
}

/* Milchglas: Inhalt scheint weichgezeichnet durch; ohne backdrop-filter fast deckend */
.hwx-header.has-regionbar .hwx-regionbar {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  border-top-color: rgba(219, 227, 232, .7);
  border-bottom: 1px solid rgba(219, 227, 232, .7);
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 .5rem 1rem rgba(12, 50, 71, .06);
  transition: transform .3s ease, visibility 0s linear 0s;
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .hwx-header.has-regionbar .hwx-regionbar {
    background: rgba(255, 255, 255, .72);
    -webkit-backdrop-filter: blur(14px) saturate(1.6);
    backdrop-filter: blur(14px) saturate(1.6);
  }

  .hwx-header.has-regionbar .hwx-regionbar__pill:not(.is-active) {
    background: rgba(255, 255, 255, .6);
  }
}

.hwx-header.has-regionbar.is-regionbar-hidden .hwx-regionbar {
  visibility: hidden;
  transform: translateY(-100%);
  transition: transform .3s ease, visibility 0s linear .3s;
}

.hwx-header .hwx-regionbar__inner {
  display: flex;
  align-items: center;
  gap: .75rem;
  box-sizing: border-box;
  width: min(1360px, 100%);
  margin: 0 auto;
  padding: .625rem clamp(1rem, 3vw, 2rem);
}

.hwx-header .hwx-regionbar__label {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: .375rem;
  color: #6C757D;
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1;
  text-transform: uppercase;
}

.hwx-header .hwx-regionbar__list {
  display: flex;
  gap: .5rem;
  min-width: 0;
  padding: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.hwx-header .hwx-regionbar__list::-webkit-scrollbar {
  display: none;
}

.hwx-header .hwx-regionbar__pill {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  height: 34px;
  padding: 0 .875rem;
  border: 1px solid #DBE3E8;
  border-radius: 9999px;
  background: #fff;
  color: #212529;
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color .2s ease, color .2s ease, background .2s ease;
}

.hwx-header .hwx-regionbar__pill:hover {
  border-color: #D11F34;
  color: #D11F34;
}

.hwx-header .hwx-regionbar__pill.is-active {
  border-color: #D11F34;
  background: #D11F34;
  color: #fff;
  font-weight: 600;
}

.hwx-header .hwx-regionbar__pill:focus-visible {
  outline: 3px solid #D11F34;
  outline-offset: 2px;
}

/* unter 1400px: Logo links, rechts Suche und Menü-Button (Menü als Offcanvas) */
@media (max-width: 1399.98px) {
  .hwx-header .hwx-header__inner {
    gap: .75rem;
  }

  .hwx-header .hwx-header__inner > .module:has(#mod-custom182) {
    margin-right: auto;
  }

  .hwx-header .hwx-header__inner > .module:has(.hwx-navbar) {
    flex: 0 0 auto;
    order: 3;
  }

  .hwx-header .hwx-header__search-toggle {
    order: 2;
  }

  .hwx-header #mod-custom182 a {
    width: min(210px, 45vw);
  }

  .hwx-header #mod-custom182 img {
    width: min(210px, 45vw) !important;
    height: calc(min(210px, 45vw) * .305);
  }
}

/* Mobil: Social-Icons statt der Topbar-Links, Logo bleibt vollständig in der Header-Zeile */
@media (max-width: 767.98px) {
  .hwx-topbar .hwx-topbar__social ~ .hwx-topbar__modules,
  .hwx-topbar .hwx-topbar__modules:has(~ .hwx-topbar__social) {
    display: none;
  }

  .hwx-topbar .hwx-topbar__social {
    margin-left: auto;
  }

  .hwx-topbar .hwx-topbar__divider {
    display: none;
  }

  .hwx-header #mod-custom182 a {
    transform: none;
  }
}

@media (max-width: 575.98px) {
  .hwx-topbar .hwx-topbar__mark {
    width: 160px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hwx-header .hwx-header__search-toggle,
  .hwx-header.has-regionbar .hwx-regionbar,
  .hwx-header .hwx-regionbar__pill,
  .hwx-header #mod-custom182 a {
    transition: none;
  }
}
