/* =====================================================================
   UTOPIA STORE — Hauptmenü mit Aufklapp-Panels
   Desktop: Hover ODER Klick.  Mobil: Akkordeon im ausgeklappten Menü.
   Ergänzt styles.css, ersetzt es nicht.
   ===================================================================== */

.menu .has-sub { position: relative; }

/* Der Knopf muss den normalen Menülinks exakt gleichen. Diese Werte stehen
   bewusst HIER und nicht in site-chrome.css: index.html lädt site-chrome.css
   nicht, sondern trägt eine eigene Inline-Kopie — dort käme die Regel nie an,
   und der Knopf fiele auf die Browser-Standardwerte zurück (schwarz, 13,3 px). */
.menu .sub-btn {
  display: inline-flex; align-items: center; gap: .35rem;
  background: transparent; border: 0; cursor: pointer;
  font-family: inherit; font-weight: inherit; line-height: inherit;
  font-size: inherit; color: #ffffff;
  padding: .5rem .75rem; border-radius: 12px;
  text-decoration: none; opacity: .9;
}
.menu .sub-btn:hover, .menu .sub-btn:focus-visible { opacity: 1; color: var(--neon); }

/* ab 900px gilt für die Links font-size: clamp(12px,1.1vw,16px) und padding .5rem
   — der Knopf zieht mit, sonst wirkt er größer und sitzt anders */
@media screen and (min-width: 900px) {
  .menu .sub-btn { font-size: clamp(12px, 1.1vw, 16px); padding: .5rem; }
}
.menu .sub-btn::after {
  content: ''; width: .42em; height: .42em; flex: none;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform .18s ease;
}

.menu .sub-panel {
  display: none;
  position: absolute; left: 50%; transform: translateX(-50%);
  top: calc(100% + .55rem); z-index: 1200;
  background: rgba(13, 17, 23, .97);
  border: 1px solid rgba(125, 220, 140, .28);
  border-radius: 14px; padding: .55rem;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .55);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.menu .sub-panel--wide {
  display: none; grid-template-columns: repeat(2, max-content); gap: .1rem .3rem;
}

/* Panels dürfen nie über den Bildschirmrand hinauslaufen */
.menu .sub-panel { max-width: min(94vw, 660px); }
/* Das letzte Menüelement sitzt rechts außen — sein Panel wird rechtsbündig */
.menu .has-sub:last-child .sub-panel { left: auto; right: 0; transform: none; }

/* Zwischen Button und Panel liegt ein sichtbarer Abstand. Ohne diese
   unsichtbare Brücke verliert die Maus dort den Hover und das Panel
   klappt zu, bevor man es erreicht. */
.menu .has-sub > .sub-panel::before {
  content: ''; position: absolute; left: 0; right: 0;
  top: -.75rem; height: .75rem;
}
/* KEIN padding-bottom hier: die Flexbox zentriert die Menüpunkte, ein
   Innenabstand unten schöbe die Aufklapp-Punkte um die Hälfte davon nach
   oben — sie säßen dann höher als die normalen Links. Den Abstand zum
   Panel überbrückt .sub-panel::before. */

.menu .has-sub:hover > .sub-panel,
.menu .has-sub:focus-within > .sub-panel,
.menu .has-sub.open > .sub-panel { display: block; }
.menu .has-sub:hover > .sub-panel--wide,
.menu .has-sub:focus-within > .sub-panel--wide,
.menu .has-sub.open > .sub-panel--wide { display: grid; }
.menu .has-sub.open > .sub-btn::after { transform: rotate(-135deg) translate(-2px, -2px); }

.menu .sub-panel a {
  display: block; white-space: nowrap; text-decoration: none;
  padding: .48rem .8rem; border-radius: 9px;
  color: var(--muted); font-size: .93rem; line-height: 1.25;
  transition: color .12s ease, background .12s ease;
}
.menu .sub-panel a:hover { color: var(--neon); background: rgba(125, 220, 140, .1); }
.menu .sub-panel .sub-all {
  color: #fff; font-weight: 600;
  border-top: 1px solid rgba(255, 255, 255, .1); margin-top: .35rem; padding-top: .55rem;
}
.menu .sub-panel--wide .sub-all { grid-column: 1 / -1; }

/* ---------- Mobil: Akkordeon statt Popup ---------- */
@media (max-width: 1150px) {
  .menu {
    max-height: calc(100vh - 88px);
    overflow-y: auto; overscroll-behavior: contain;
    min-width: 232px; gap: .1rem;
  }
  .menu .has-sub { width: 100%; }
  .menu .sub-btn { width: 100%; justify-content: space-between; padding: .5rem .2rem; }
  .menu .sub-panel,
  .menu .sub-panel--wide {
    position: static; transform: none; display: none;
    background: transparent; border: 0; box-shadow: none;
    padding: .1rem 0 .35rem .7rem; margin: 0;
    border-left: 1px solid rgba(125, 220, 140, .25);
  }
  /* auf Mobil NUR per Klick öffnen — Hover würde beim Scrollen auslösen */
  .menu .has-sub:hover > .sub-panel,
  .menu .has-sub:hover > .sub-panel--wide,
  .menu .has-sub:focus-within > .sub-panel,
  .menu .has-sub:focus-within > .sub-panel--wide { display: none; }
  .menu .has-sub.open > .sub-panel { display: block; }
  .menu .has-sub.open > .sub-panel--wide { display: block; }
  .menu .sub-panel a { white-space: normal; padding: .42rem .6rem; font-size: .88rem; }
  .menu .sub-panel .sub-all { margin-top: .25rem; padding-top: .45rem; }
}

@media (prefers-reduced-motion: reduce) {
  .menu .sub-btn::after { transition: none; }
}

/* =====================================================================
   Elf Menüpunkte passen unterhalb von ~1150px nicht mehr neben das Logo
   (bei 1024px blieb 1px Abstand — je nach Schriftrendering überlappt es).
   Deshalb hier früher auf das Burger-Menü umschalten als die 980px aus
   styles.css. !important ist nötig, weil index.html eine eigene
   Inline-Kopie der Header-Regeln mitbringt, die sonst gewinnt.
   ===================================================================== */
@media screen and (max-width: 1150px) {
  .site-header .menu {
    display: none !important;
    position: absolute; right: 1rem; top: 64px;
    width: auto !important; min-width: 232px;
    background: var(--panel, #11161d);
    padding: .8rem; border-radius: 14px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, .55);
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
  }
  .site-header .menu.open { display: flex !important; }
  .site-header .nav-toggle { display: block !important; margin-left: auto; }
  /* im Klappmenü wieder normale Schriftgröße statt der Kopfzeilen-Skalierung */
  .site-header .menu a, .site-header .menu .sub-btn {
    font-size: .95rem; padding: .5rem .6rem; white-space: normal;
  }
}

/* =====================================================================
   Elf Menüpunkte brauchen 1122px, der Container ist aber auf ~1120px
   gedeckelt und wächst auch bei 1400px Fensterbreite nicht mit — die
   Leiste würde also bei JEDER Breite ins Logo laufen. Deshalb oberhalb
   des Burger-Umschaltpunkts Abstände etwas straffen. Spart rund 70px.
   ===================================================================== */
@media screen and (min-width: 1151px) {
  .site-header .menu { gap: 5px !important; }
  .site-header .menu a,
  .site-header .menu .sub-btn { padding: .5rem .3rem !important; }
  .site-header .menu .sub-btn { gap: .28rem; }
}
