:root { --oc-width: 90%; --dur: 400ms; }
@media (min-width: 630px) { :root { --oc-width: 70%; }}
    
.mod_navigation {
  list-style: none;
  display: flex;
  gap: 1rem;
  flex-direction: column;
}

#haupt-navigation ul.level_1 {
  z-index: 2500;
  margin: -80px 4px 0 4px;
  width: 80%;
}

/* Buttons & Icons */
.menu-button {
  font: inherit; border: 0; background: transparent; cursor: pointer; padding: .5rem .75rem;
}
.menu-button img { display: block; width: 100%; height: 100%; }
    
.menu-close img { display: block; width: 24px; height: 24px; }
.menu-close {
  cursor: pointer;
  background: transparent;
  border: 4px solid var(--accent);
  padding: 0px 4px 6px 4px;
  position: static;        /* bleibt sichtbar beim Scrollen */
  top: 0;                  /* am oberen Rand fixieren */
  right: 0;
  background: #e6e6e6;        /* eigener Hintergrund, damit Symbol nicht überlappt */
  z-index: 3000;             /* über den Links */
  font-size: 28px;
  font-weight: bold;
  color: #c03030;
  width: 37px;
  height: 37px;
  margin-top: 6px;
  margin-right: 2px;
}

    
/* Off-Canvas (links) */
.offcanvas {
  position: fixed; inset: 0 auto 0 0;          /* links andocken */
  width: var(--oc-width); max-width: 90vw; height: 100dvh;
  background: #e6e6e6; 
  box-shadow: 2px 0 20px rgba(0,0,0,.2);     /* Schatten links */
  transform: translateX(-100%);                 /* Start links außen */
  transition: transform var(--dur) ease; will-change: transform;
  z-index: 2000;
  overflow-y: auto;               /* ← Menü selbst kann scrollen */
  overscroll-behavior: contain;   /* ← verhindert Scroll-Chaining zum Body */
  -webkit-overflow-scrolling: touch; /* ← flüssiges Scrollen auf iOS */
  padding-bottom: env(safe-area-inset-bottom, 0); /* ← Platz für iOS-Safe-Area */
}

.offcanvas[data-open="true"] { transform: translateX(0); }

.offcanvas__head {
  position: sticky;
  top: 0;
  z-index: auto;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0 6px;
  background: transparent;
}
    
.offcanvas__list { list-style: none; margin: 0; padding: 0; }

.offcanvas__list a { display: block; padding: .875rem 1rem; text-decoration: none; color: inherit; }
.offcanvas__list a:focus { outline: 2px solid; outline-offset: 2px; }

/* Overlay/Backdrop */
.backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  opacity: 0; pointer-events: none; transition: opacity var(--dur) ease; z-index: 1999;
}
.backdrop[data-open="true"] { opacity: 1; pointer-events: auto; }

/* Bewegungen reduzieren respektieren */
@media (prefers-reduced-motion: reduce) {
  .offcanvas, .backdrop { transition: none; }
}
    
#menu-toggle {
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: #ffffff;
  padding: 0.5rem 1rem;
  position: relative;
}  
  
#menu-toggle {
  width: 74px;
  display: inline-block;
  position: relative;
  cursor: pointer;
  margin-left: 1.5rem;
  background: none;
  border: none;
}

@media (min-width: 577px) {
  #menu-toggle {
    width: 80px;
  }
}


/* Mobile Navigation Submenu Toggle */

/* Nur Mobile-Navigation */
#mobile-navigation .mod_navigation .level_1 > li.submenu {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
}

/* Submenu unter beiden Spalten */
#mobile-navigation .mod_navigation .level_1 > li.submenu > ul {
  grid-column: 1 / -1;
}

/* Toggle-Button rechts bündig */
#mobile-navigation .mod_navigation .submenu-toggle {
  justify-self: end;
  background: transparent;
  border: 0;
  padding: 0.5rem;
  line-height: 1;
  cursor: pointer;
  font-size: 12px;
}

#mobile-navigation .mod_navigation
.submenu-toggle[aria-expanded="true"] i {
  transform: rotate(180deg);
}
