/* BS24 Super Menu — Frontend
 * Namespaced unter .bs24sm / bs24sm-* . Nutzt KEINE Theme-Menü-Klassen.
 * Marken: CTA/Link-Hover #0d6efd, Titel navy, Akzent rot #990000. Kein All-Caps.
 */

.bs24sm {
  --bs24sm-cta: #0d6efd;
  --bs24sm-cta-hover: #052c65;
  --bs24sm-cta-text: #fff;
  --bs24sm-accent: #990000;
  --bs24sm-link: #2b2f38;
  --bs24sm-link-hover: #0d6efd;
  --bs24sm-title: #1b2f4e;
  --bs24sm-muted: #5a6a85;
  --bs24sm-bg: #fff;
  --bs24sm-line: rgba(16, 24, 40, .10);
  --bs24sm-burger: #1b2f4e;

  --bs24sm-bar-max: 1280px;
  --bs24sm-gutter: 24px;
  --bs24sm-cols: 3;
  --bs24sm-feat: 0; /* 1 = Panel hat Featured-Tile (zählt als eigene Breiten-Einheit) */

  --bs24sm-anim: 180ms;
  --bs24sm-ease: cubic-bezier(.2, .7, .2, 1);

  --bs24sm-z-panel: 95;
  --bs24sm-z-scrim: 80;
  --bs24sm-z-mobile: 100000;

  font-family: inherit;
}

/* ============================ DESKTOP BAR ============================ */
.bs24sm-desktop {
  display: flex;
  align-items: center;
}

.bs24sm-menu {
  display: flex;
  flex-wrap: nowrap;          /* nie umbrechen */
  white-space: nowrap;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bs24sm-item {
  position: relative;
  margin: 0;
  list-style: none;
}

.bs24sm-toggle,
.bs24sm-link--top {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  color: var(--bs24sm-link);
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  border-radius: 8px;
  cursor: pointer;
}

.bs24sm-toggle:hover,
.bs24sm-toggle:focus-visible,
.bs24sm-link--top:hover,
.bs24sm-link--top:focus-visible,
.bs24sm-item.is-open .bs24sm-toggle {
  color: var(--bs24sm-link-hover);
}

.bs24sm-toggle__chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform var(--bs24sm-anim) var(--bs24sm-ease);
}
.bs24sm-item.is-open .bs24sm-toggle__chevron {
  transform: rotate(-135deg) translate(-1px, -1px);
}

/* Fokus-Ring. Das Theme setzt `a:focus{outline:none!important}` (global) und
   `.header-right button:focus{outline:none}` — daher hier !important + klassen-
   basierte Spezifität, damit Tastatur-Fokus sichtbar bleibt. :focus-visible greift
   nur bei Tastatur/Programm, nicht bei Maus. */
.bs24sm-toggle:focus-visible,
.bs24sm-link--top:focus-visible,
.bs24sm-burger:focus-visible,
.bs24sm-link:focus-visible,
.bs24sm-mobile__close:focus-visible,
.bs24sm-acc__header:focus-visible,
.bs24sm-acc__link:focus-visible,
.bs24sm-acc__group a:focus-visible,
.bs24sm-mobile__phone a:focus-visible,
.bs24sm-cta:focus-visible {
  outline: 3px solid var(--bs24sm-cta) !important;
  outline-offset: 2px !important;
  border-radius: 8px;
}

/* ============================ OVERLAY PANEL ============================ */
.bs24sm-panel {
  position: fixed;
  top: var(--bs24sm-panel-top, 84px);
  /* Eingefasste, zentrierte Karte — geht auf großen Bildschirmen NIE bis zum
     Viewport-Rand. Volle Breite (= Content-Breite, fluchtet mit dem Header,
     max 1280px) entspricht 3 Einheiten; Panels mit weniger Spalten werden
     anteilig schmaler (1 Spalte ≈ 1/3, 2 Spalten ≈ 2/3) und bleiben über
     left:50% + translateX(-50%) zentriert. Ein Featured-Tile zählt als
     eigene Einheit. --bs24sm-cols/--bs24sm-feat setzt render.php inline. */
  left: 50%;
  width: min(
    calc(100% - (var(--bs24sm-gutter) * 2)),
    var(--bs24sm-bar-max),
    calc(var(--bs24sm-bar-max) / 3 * (var(--bs24sm-cols, 3) + var(--bs24sm-feat, 0)))
  );
  margin-top: 8px;
  z-index: var(--bs24sm-z-panel);
  background: var(--bs24sm-bg);
  border: 1px solid var(--bs24sm-line);
  box-shadow: 0 24px 60px -24px rgba(16, 24, 40, .30);
  border-radius: 14px;
  opacity: 0;
  /* --bs24sm-shift (JS, beim Öffnen gesetzt) rückt das Panel horizontal unter
     seinen Toggle; 0px = viewport-zentriert (Fallback und vollbreite Panels). */
  transform: translateX(calc(-50% + var(--bs24sm-shift, 0px))) translateY(-8px);
  pointer-events: none;
  transition: opacity var(--bs24sm-anim) var(--bs24sm-ease),
              transform var(--bs24sm-anim) var(--bs24sm-ease);
}
.bs24sm-panel[hidden] { display: none; }

.bs24sm-item.is-open > .bs24sm-panel {
  opacity: 1;
  transform: translateX(calc(-50% + var(--bs24sm-shift, 0px)));
  pointer-events: auto;
}

.bs24sm-panel__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(260px, 24%, 340px);
  gap: clamp(24px, 3vw, 56px);
  align-items: start;
  max-width: var(--bs24sm-bar-max);
  margin: 0 auto;
  padding: 26px var(--bs24sm-gutter) 30px;
}
.bs24sm-panel__inner--no-feature { grid-template-columns: minmax(0, 1fr); }

.bs24sm-panel__cols {
  display: grid;
  grid-template-columns: repeat(var(--bs24sm-cols, 3), minmax(150px, 1fr));
  gap: 14px 40px;
}

.bs24sm-group { min-width: 0; }
.bs24sm-group__title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--bs24sm-title);
}
.bs24sm-links { margin: 0; padding: 0; list-style: none; }
.bs24sm-links__item { margin: 0 0 2px; }

.bs24sm-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--bs24sm-link);
  transition: background-color 120ms ease, color 120ms ease;
}
.bs24sm-link:hover,
.bs24sm-link:focus-visible {
  background: rgba(13, 110, 253, .06);
  color: var(--bs24sm-link-hover);
}
.bs24sm-link__icon { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 8px; object-fit: cover; background: #eef2f8; }
.bs24sm-link__body { display: flex; flex-direction: column; min-width: 0; }
.bs24sm-link__label { font-size: 15px; font-weight: 600; line-height: 1.3; }
.bs24sm-link__desc {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.35;
  color: var(--bs24sm-muted);
}

.bs24sm-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
  color: #fff;
  background: var(--bs24sm-accent);
  border-radius: 999px;
  vertical-align: middle;
}

/* Featured-Tile */
.bs24sm-feature {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f6f8fc;
  border: 1px solid var(--bs24sm-line);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 150ms ease, transform 150ms ease;
}
a.bs24sm-feature:hover { box-shadow: 0 14px 28px -18px rgba(16, 24, 40, .35); transform: translateY(-2px); }
.bs24sm-feature__media { display: block; aspect-ratio: 3 / 2; background: #e9eef6; }
.bs24sm-feature__img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bs24sm-feature__body { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 16px; }
.bs24sm-feature__title { font-size: 15px; font-weight: 700; color: var(--bs24sm-title); }
.bs24sm-feature__desc { font-size: 13px; color: var(--bs24sm-muted); }
.bs24sm-feature__cta {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--bs24sm-cta);
}
.bs24sm-feature__cta::after { content: " →"; }

/* ============================ HAMBURGER ============================ */
.bs24sm-mobile-root { display: inline-flex; align-items: center; }

.bs24sm-burger {
  display: none;
  align-items: center;       /* Striche vertikal zentrieren (sonst sitzen sie zu hoch) */
  justify-content: center;
  inline-size: 44px;
  block-size: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
}
/* Wenn sichtbar geschaltet: als zentriertes Flex rendern. */
.bs24sm-mobile-toggle { align-items: center; justify-content: center; }
.bs24sm-burger__bars {
  position: relative;
  display: block;
  width: 26px;
  height: 18px;
  margin: 0 auto;
}
.bs24sm-burger__bars > span {
  position: absolute;
  left: 0;
  width: 100%;            /* drei gleich lange Striche */
  height: 3px;            /* fett */
  border-radius: 2px;
  background: var(--bs24sm-burger);
  transition: transform .22s var(--bs24sm-ease), opacity .15s linear, top .22s var(--bs24sm-ease);
}
.bs24sm-burger__bars > span:nth-child(1) { top: 0; }
.bs24sm-burger__bars > span:nth-child(2) { top: 7.5px; }
.bs24sm-burger__bars > span:nth-child(3) { top: 15px; }
.bs24sm-burger[aria-expanded="true"] .bs24sm-burger__bars > span:nth-child(1) { top: 7.5px; transform: rotate(45deg); }
.bs24sm-burger[aria-expanded="true"] .bs24sm-burger__bars > span:nth-child(2) { opacity: 0; }
.bs24sm-burger[aria-expanded="true"] .bs24sm-burger__bars > span:nth-child(3) { top: 7.5px; transform: rotate(-45deg); }

/* ============================ ADAPTIVE COLLAPSE ============================ */
@media (max-width: 1100px) {
  .bs24sm-desktop { display: none; }
  .bs24sm-mobile-toggle { display: inline-flex; }
  /* Eigenständigen Desktop-Switcher ausblenden — NICHT den im Drawer (bs24sm-langswitch). */
  .header-right .bs24-langswitch:not(.bs24sm-langswitch) { display: none; }
}
.bs24sm-collapsed .bs24sm-desktop { display: none; }
.bs24sm-collapsed .bs24sm-mobile-toggle { display: inline-flex; }
.bs24sm-collapsed .header-right .bs24-langswitch:not(.bs24sm-langswitch) { display: none; }

/* ---------- Mobile-Header-Layout (sobald Hamburger sichtbar ist) ----------
   Logo + Telefon kompakt; header-right nur inhaltsbreit (Telefon + Hamburger),
   rechtsbündig — so wird der Hamburger nie aus dem Viewport geschoben.
   Sehr hohe Spezifität (.wp-site-blocks header.wp-block-template-part …) +
   !important, um Theme-Header-Regeln (max-height-Logo, .header-phone{flex:1},
   .header-right{flex:1}) sicher zu schlagen. */
@media (max-width: 1100px) {
  /* Logo klein + fix */
  .wp-site-blocks header.wp-block-template-part a.custom-logo-link img.custom-logo,
  .wp-site-blocks header.wp-block-template-part .wp-block-site-logo img.custom-logo,
  .wp-site-blocks header.wp-block-template-part .site-branding img {
    max-height: 28.5px !important;
    max-width: 142.5px !important;
    width: auto !important;
    height: auto !important;
  }
  /* header-right: nur so breit wie Inhalt, rechtsbündig (kein flex:1, kein Collapse) */
  .wp-site-blocks header.wp-block-template-part .header-right {
    flex: 0 0 auto !important;
    justify-content: flex-end !important;
    gap: 8px !important;
  }
  /* Telefon = EIN konsistenter, kompakter blauer Button über den gesamten
     Mobile-Bereich (≤1100). Feste Form/Background/Radius mit !important, damit
     er an Theme-Breakpoints (z. B. 600px: radius 4→8) NICHT mehr „die Form ändert". */
  .wp-site-blocks header.wp-block-template-part .header-phone {
    display: inline-flex !important;
    align-items: center !important;
    flex: 0 0 auto !important;
    gap: 7px !important;
    padding: 8px 14px !important;
    background: #0d6efd !important;
    border-radius: 8px !important;
  }
  .wp-site-blocks header.wp-block-template-part .header-phone,
  .wp-site-blocks header.wp-block-template-part .header-phone * { color: #fff !important; }
  .wp-site-blocks header.wp-block-template-part .header-phone svg,
  .wp-site-blocks header.wp-block-template-part .header-phone svg path { fill: #fff !important; }
  .wp-site-blocks header.wp-block-template-part .header-phone > .wp-block-group > p:first-child { display: none !important; }
  .wp-site-blocks header.wp-block-template-part .header-phone .icon-container { width: 18px !important; }
  .wp-site-blocks header.wp-block-template-part .header-phone svg { width: 16px !important; height: 16px !important; }
  .wp-site-blocks header.wp-block-template-part .header-phone a[href^="tel:"],
  .wp-site-blocks header.wp-block-template-part .header-phone p {
    font-size: 13px !important;
    line-height: 1.2 !important;
    white-space: nowrap;
  }
  /* Hamburger: feste Größe, schrumpft nie weg */
  .wp-site-blocks header.wp-block-template-part .bs24sm-mobile-root { flex: 0 0 auto !important; }
}

/* ============================ MOBILE DRAWER ============================ */
.bs24sm-mobile {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
  max-width: 100vw;
  z-index: var(--bs24sm-z-mobile);
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: -16px 0 48px -24px rgba(16, 24, 40, .4);
  transform: translateX(100%);
  transition: transform .22s var(--bs24sm-ease);
}
.bs24sm-mobile[hidden] { display: none; }
.bs24sm-mobile.is-open { transform: none; }
@media (max-width: 600px) { .bs24sm-mobile { width: 100vw; } }

.bs24sm-mobile__scrim {
  position: fixed;
  inset: 0;
  z-index: calc(var(--bs24sm-z-mobile) - 2);
  background: rgba(16, 24, 40, .45);
  opacity: 0;
  transition: opacity .22s var(--bs24sm-ease);
}
.bs24sm-mobile__scrim[hidden] { display: none; }
.bs24sm-mobile__scrim.is-open { opacity: 1; }

.bs24sm-mobile__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--bs24sm-line);
}
.bs24sm-mobile__logo img,
.bs24sm-mobile__logo .custom-logo { max-height: 30.78px; width: auto; height: auto; display: block; } /* 2026-06-09: header logo −10% (was 34.2px) */
.bs24sm-mobile__close {
  inline-size: 44px;
  block-size: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--bs24sm-title);
  cursor: pointer;
  border-radius: 8px;
}
.bs24sm-mobile__close svg { width: 24px; height: 24px; fill: currentColor; }

.bs24sm-mobile__scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 8px 0;
}

.bs24sm-acc { margin: 0; padding: 0; list-style: none; }
.bs24sm-acc__item { border-bottom: 1px solid var(--bs24sm-line); }
.bs24sm-acc__header,
.bs24sm-acc__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 10px;
  padding: 15px 18px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  color: var(--bs24sm-title);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.bs24sm-acc__chevron {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform var(--bs24sm-anim) var(--bs24sm-ease);
}
.bs24sm-acc__header[aria-expanded="true"] .bs24sm-acc__chevron { transform: rotate(-135deg); }

.bs24sm-acc__panel { padding: 2px 18px 10px; }
.bs24sm-acc__panel[hidden] { display: none; }
.bs24sm-acc__group { margin: 0 0 12px; }
.bs24sm-acc__group-title {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--bs24sm-muted);
}
.bs24sm-acc__group ul { margin: 0; padding: 0; list-style: none; }
.bs24sm-acc__group li { margin: 0; }
.bs24sm-acc__group a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 15px;
  color: var(--bs24sm-link);
  text-decoration: none;
}
.bs24sm-acc__group a .bs24sm-link__icon { width: 30px; height: 30px; }
.bs24sm-acc__group a:hover { color: var(--bs24sm-link-hover); }
.bs24sm-acc__feature {
  display: block;
  margin: 4px 0 8px;
  padding: 10px 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--bs24sm-title);
  background: #f6f8fc;
  border: 1px solid var(--bs24sm-line);
  border-radius: 10px;
  text-decoration: none;
}

.bs24sm-mobile__lang { padding: 14px 18px 4px; }
.bs24sm-mobile__phone { padding: 8px 18px 16px; font-weight: 700; }
.bs24sm-mobile__phone a { color: var(--bs24sm-title); text-decoration: none; }

.bs24sm-mobile__foot {
  flex: 0 0 auto;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--bs24sm-line);
  background: #fff;
}

/* CTA */
.bs24sm-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 16px;
  background: var(--bs24sm-cta);
  color: var(--bs24sm-cta-text);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border-radius: 8px;
  transition: background-color 150ms ease;
}
.bs24sm-cta:hover { background: var(--bs24sm-cta-hover); color: #fff; }
.bs24sm-cta--block { display: flex; width: 100%; padding: 12px 20px; }

/* Scroll-Lock am Dokument, wenn Drawer offen */
html.bs24sm-no-scroll, html.bs24sm-no-scroll body { overflow: hidden; }

/* Admin-Bar-Offset für den fixed Drawer */
.admin-bar .bs24sm-mobile { top: 32px; }
@media (max-width: 782px) { .admin-bar .bs24sm-mobile { top: 46px; } }

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .bs24sm-panel,
  .bs24sm-mobile,
  .bs24sm-mobile__scrim,
  .bs24sm-burger__bars > span,
  .bs24sm-toggle__chevron,
  .bs24sm-acc__chevron { transition: none !important; }
  .bs24sm-panel { transform: translateX(calc(-50% + var(--bs24sm-shift, 0px))); }
}

/* Responsive Panel: bei wenig Breite Feature unter die Spalten */
@media (max-width: 980px) {
  .bs24sm-panel__inner { grid-template-columns: minmax(0, 1fr); }
  .bs24sm-panel__feature { max-width: 360px; }
}
