/**
 * Mobile-Navigation: Hamburger + Off-Canvas, ab max-width: 700px
 * Wird NACH seitenlokalen nav-Regeln geladen; blendet .nav-links aus.
 */

.nav-mobile-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  margin: 0 4px 0 0;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.06);
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease;
}
.nav-mobile-toggle:hover {
  background: rgba(0, 0, 0, 0.1);
}
.nav-mobile-toggle:focus-visible {
  outline: 2px solid var(--billyr-blue, #0052cc);
  outline-offset: 2px;
}
nav[data-nav-theme="dark"] .nav-mobile-toggle {
  background: rgba(255, 255, 255, 0.12);
}
nav[data-nav-theme="dark"] .nav-mobile-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
}
.nav-mobile-toggle__bar {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 1px;
  background: #1a1a1a;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
nav[data-nav-theme="dark"] .nav-mobile-toggle__bar {
  background: #fff;
}
.nav-mobile-toggle[aria-expanded="true"] .nav-mobile-toggle__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-mobile-toggle[aria-expanded="true"] .nav-mobile-toggle__bar:nth-child(2) {
  opacity: 0;
}
.nav-mobile-toggle[aria-expanded="true"] .nav-mobile-toggle__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-mobile-backdrop {
  position: fixed;
  inset: 0;
  z-index: 198;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.nav-mobile-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.nav-mobile-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 199;
  width: min(100%, 22rem);
  max-width: 100vw;
  height: 100%;
  min-height: 100dvh;
  background: #121212;
  color: #f4f4f5;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.35);
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 0 max(20px, env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
}
.nav-mobile-panel.is-open {
  transform: translateX(0);
}
.nav-mobile-panel[hidden] {
  display: none !important;
}
.nav-mobile-panel:not([hidden]).is-open {
  display: flex !important;
}

/* Schließen nur oben rechts, über dem Menü – kein Extra-Balken, kein Label (Dialog hat aria-label) */
.nav-mobile-panel__head {
  position: absolute;
  top: env(safe-area-inset-top, 0px);
  right: 6px;
  left: 0;
  z-index: 3;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  min-height: 0;
  padding: 6px 6px 0 0;
  margin: 0;
  border: none;
  background: none;
  pointer-events: none;
}
.nav-mobile-close {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #f4f4f5;
  font-size: 1.5rem;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-mobile-close:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}
.nav-mobile-close:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.45);
  outline-offset: 2px;
}

.nav-mobile-panel__nav {
  display: flex;
  flex-direction: column;
  padding: calc(12px + env(safe-area-inset-top, 0px) + 44px) 16px 24px 20px;
  gap: 2px;
}
.nav-mobile-panel__nav > a {
  display: block;
  padding: 14px 14px;
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: 600;
  color: #fafafa !important;
  text-decoration: none;
  font-family: var(--font-body, system-ui, sans-serif);
  transition: background 0.12s ease;
}
.nav-mobile-panel__nav > a:hover {
  background: rgba(255, 255, 255, 0.08);
}
.nav-mobile-panel__label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #71717a;
  margin: 18px 14px 8px;
  padding: 0;
  font-family: var(--font-display, system-ui, sans-serif);
}
.nav-mobile-panel__nav > a[aria-current="page"] {
  background: rgba(0, 82, 204, 0.25);
  color: #fff !important;
}

html.nav-mobile-open,
html.nav-mobile-open body {
  overflow: hidden;
}

@media (min-width: 701px) {
  .nav-mobile-toggle {
    display: none !important;
  }
  .nav-mobile-backdrop,
  .nav-mobile-panel {
    display: none !important;
  }
  html.nav-mobile-open,
  html.nav-mobile-open body {
    overflow: unset;
  }
}

@media (max-width: 700px) {
  .nav-mobile-toggle {
    display: inline-flex;
  }
  .nav-inner .nav-pill .nav-links {
    display: none !important;
  }

  /*
   * Zwei-Pill-Header: nebeneinander passt nicht → untereinander, keine Überlappung.
   * :has(…) nur wenn zwei Pills (sonst trifft "nur ein Pill" nur erste Regel – harmlos).
   */
  .nav-inner:has(> .nav-pill + .nav-pill) {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    max-width: 100%;
  }
  .nav-inner:has(> .nav-pill + .nav-pill) > .nav-pill {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-height: 52px;
    height: auto;
    padding: 8px 12px;
  }
  .nav-inner:has(> .nav-pill + .nav-pill) > .nav-pill:first-of-type .nav-logo {
    flex-shrink: 0;
    min-width: 0;
  }
  .nav-inner:has(> .nav-pill + .nav-pill) > .nav-pill:first-of-type .nav-mobile-toggle {
    margin-left: auto;
    flex-shrink: 0;
  }
  .nav-inner:has(> .nav-pill + .nav-pill) > .nav-pill:last-of-type {
    justify-content: stretch;
    gap: 8px;
    padding: 8px 10px;
  }
  .nav-inner:has(> .nav-pill + .nav-pill) > .nav-pill:last-of-type .btn-ghost,
  .nav-inner:has(> .nav-pill + .nav-pill) > .nav-pill:last-of-type .btn-primary {
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    padding: 10px 8px;
    line-height: 1.25;
    text-align: center;
    white-space: normal;
  }
  .nav-inner:has(> .nav-pill + .nav-pill) > .nav-pill:last-of-type .btn-primary i,
  .nav-inner:has(> .nav-pill + .nav-pill) > .nav-pill:last-of-type .btn-primary svg {
    flex-shrink: 0;
  }
}

/*
 * Hero (Mobile): Viele Hero-Sektionen nutzen flex + vertical center – das hebt padding-top auf.
 * flex-start + moderates .hero-content-Padding, damit die Headline unter der zweizeiligen Nav startet.
 *
 * Offset muss >= fixierte Nav-Höhe sein: zwei gestapelte .nav-pill + Padding + ggf. Safe Area.
 * Zu klein (früher 268px) → Headline unter Logo/Zweitzeile (Überlappung).
 */
@media (max-width: 700px) {
  /*
   * flex-direction: column — Produkt/Über uns nutzen standardmäßig row-Flex; ohne Spalte wirkt
   * der Slot unter der Nav oft noch zu „hoch“ (Überlappung mit zweizeiligem Header).
   * Starthero (Home/Produkt/Über uns): gleicher Offset unter zweizeiliger Nav.
   */
  body.page-home section.hero,
  body.page-produkt section.hero,
  body.page-ueber-uns section.hero {
    flex-direction: column !important;
    justify-content: flex-start !important;
    /* stretch: volle Breite wie Desktop — flex-start ließe den .container schmal ausrichten */
    align-items: stretch !important;
  }

  /* Home + Produkt + Über uns: gleicher Nav-Offset und Hero-Höhe (mobil) */
  body.page-home section.hero,
  body.page-produkt section.hero,
  body.page-ueber-uns section.hero {
    margin-top: calc(-1 * (744px + env(safe-area-inset-top, 0px))) !important;
    padding-top: calc(744px + env(safe-area-inset-top, 0px)) !important;
    /* Kein übertriebenes min-height — sonst entsteht unter dem Inhalt viel „leeres“ Blau */
    min-height: clamp(760px, 88vh, 1040px) !important;
  }

  body.page-home section.hero .hero-content,
  body.page-produkt section.hero .hero-content,
  body.page-ueber-uns section.hero .hero-content {
    padding-top: 156px !important;
    padding-bottom: 88px !important;
  }
}
