/* Untermenues: Desktop-Hover in der Kopfleiste, aufklappbar im Menue-Overlay.
   Markup steht in jeder Seite; Logik in js/untermenue.js. */

html { scroll-padding-top: 80px; }

/* ── Kopfleiste (Desktop, ab 1051px sichtbar) ── */
.nav-dd { position: relative; display: flex; }
.nav-dd-menu {
  position: absolute; top: 100%; left: -4px; z-index: 110;
  padding-top: 14px; min-width: 230px;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
}
.nav-dd:hover .nav-dd-menu,
.nav-dd:focus-within .nav-dd-menu {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s;
}
.nav-dd-liste {
  display: flex; flex-direction: column;
  background: var(--beige); border: 4px solid var(--dark); box-shadow: 6px 6px 0 var(--dark);
}
.nav-links .nav-dd-liste a {
  border: 0; box-shadow: none; transform: none;
  padding: 13px 18px; font-size: 11px; letter-spacing: 0.14em;
  white-space: nowrap; background: transparent; color: var(--dark);
}
.nav-links .nav-dd-liste a + a { border-top: 2px solid var(--dark); }
.nav-links .nav-dd-liste a:hover,
.nav-links .nav-dd-liste a:focus-visible {
  background: var(--red); color: var(--beige); border-color: var(--dark);
  box-shadow: none; transform: none; outline: none;
}
.nav-links .nav-dd-liste a + a:hover { border-top-color: var(--dark); }

/* ── Menue-Overlay ── */
.menu-overlay { overflow-y: auto; justify-content: flex-start; }
.menu-overlay nav { margin: auto 0; padding: 104px 0 24px; width: 100%; }
.menu-overlay .menu-legal { position: static; margin: 16px 0 32px; flex-shrink: 0; }

.menu-gruppe { display: flex; flex-direction: column; align-items: center; }
/* Der Knopf haengt rechts neben dem Text und zaehlt nicht zur Breite – so bleibt der Text zentriert */
.menu-zeile { position: relative; display: flex; align-items: center; justify-content: center; }
.menu-zeile .menu-auf { position: absolute; left: 100%; top: 0; height: 100%; } /* ohne transform: die Einblend-Animation setzt transform */

.menu-auf {
  width: 44px; height: 44px; flex-shrink: 0;
  display: grid; place-items: center; cursor: pointer;
  background: transparent; color: var(--beige); border: 0; padding: 0;
  font-family: var(--font); font-size: 32px; font-weight: 500; line-height: 1;
  opacity: 0; transition: color 0.15s;
}
.menu-auf::before { content: '+'; }
.menu-auf[aria-expanded="true"]::before { content: '−'; }
.menu-auf:hover { color: var(--red); }
.menu-auf:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.menu-auf[aria-expanded="true"] { color: var(--red); }
.menu-overlay.open .menu-auf { animation: menuItemIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards; }

.menu-sub {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.menu-sub.offen { grid-template-rows: 1fr; }
.menu-sub-innen {
  overflow: hidden; min-height: 0;
  display: flex; flex-direction: column; align-items: center;
}
.menu-sub.offen .menu-sub-innen { padding: 6px 0 14px; }
.menu-overlay nav .menu-sub a,
.menu-overlay.open nav .menu-sub a {
  font-family: var(--font); font-size: 14px; font-weight: 900;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(255, 255, 229, 0.7); padding: 9px 16px;
  opacity: 1; transform: none; animation: none;
}
.menu-overlay nav .menu-sub a:hover { color: var(--beige); }
.menu-overlay nav .menu-sub a::after { bottom: 4px; left: 16px; right: 16px; height: 3px; }

/* Einblend-Verzoegerung pro Hauptpunkt (die Seiten zaehlen nur direkte Links) */
.menu-overlay.open nav > :nth-child(1) .menu-zeile > a { animation-delay: 0.1s; }
.menu-overlay.open nav > :nth-child(2) .menu-zeile > a { animation-delay: 0.15s; }
.menu-overlay.open nav > :nth-child(3) .menu-zeile > a { animation-delay: 0.2s; }
.menu-overlay.open nav > :nth-child(4) .menu-zeile > a { animation-delay: 0.25s; }
.menu-overlay.open nav > :nth-child(5) .menu-zeile > a { animation-delay: 0.3s; }
.menu-overlay.open nav > :nth-child(6) .menu-zeile > a { animation-delay: 0.35s; }
.menu-overlay.open nav > :nth-child(7) .menu-zeile > a { animation-delay: 0.4s; }

@media (max-width: 600px) {
  .menu-auf { width: 34px; height: 40px; font-size: 32px; }
  .menu-overlay nav .menu-zeile > a { padding-left: 10px; padding-right: 10px; }
  .menu-overlay nav .menu-zeile > a::after { left: 10px; right: 10px; }
  .menu-overlay nav { padding-top: 96px; }
}
@media (prefers-reduced-motion: reduce) {
  .menu-sub, .nav-dd-menu { transition: none; }
  .menu-overlay.open .menu-auf { animation: none; opacity: 1; }
}

/* Sprungziele mit Einblend-Effekt sitzen vor dem Einblenden 40px tiefer
   (.reveal: translateY(40px)) – Abstand ausgleichen, damit sie nicht unter der Kopfleiste landen. */
.reveal[id]:not(.visible) { scroll-margin-top: 40px; }
