/* ===  MAIN-NAV === */

.mainnav {
  width: 50%;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
}

/* Topbar */
.mainnav-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 34px;
}

.mainnav-actions {
  min-height: 1px; /* optional */
}

/* Burger */
.burger {
  background: none;
  border: 0;
  padding: 0.25rem;
  cursor: pointer;
}

.burger span {
  display: block;
  width: 22px;
  height: 3px;
  margin: 6px 0;
  background: white;
  transition:
    transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.2s ease;
}

/* Burger → Close */
.burger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.burger.open span:nth-child(2) {
  opacity: 0;
}
.burger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Overlay (mobil) */
.mainnav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
  z-index: 998;
}
.mainnav-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Panel (mobil: off-canvas) */
.mainnav-panel {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: min(360px, 100%);
  background: black;
  z-index: 999;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  transform: translateX(-100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);

  overflow-y: auto;
}
.mainnav-panel.open {
  transform: translateX(0);
}

/* Mobile header (Logo + Close) */
.mainnav-mobile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
}
.mainnav-logo img {
  display: block;
  max-width: 100%;
  height: auto;
}
.mainnav-close {
  width: 30%;
  background: none;
  color: white;
  border: 0;
  font-size: 1rem;
  padding: var(--space-md);
  line-height: 1;
  cursor: pointer;
}

/* Nav list (mobile default) */
.mainnav-list {
  list-style: none;
  margin: 0;
  padding: 1rem 0;
}
.mainnav-list > li > a {
  display: block;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: var(--color-text-primary);
  font-size: var(--font-size-lg);
  font-family: "Cinzel Decorative";
}
.mainnav-list > li > a:hover {
  color: goldenrod;
}

/* Submenus (mobile: animated height via class; desktop: absolutely positioned dropdown) */
.submenu {
  list-style: none;
  margin: 0;
  padding: 0;
  background: #f8f9fa;

  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition:
    max-height 0.3s ease,
    opacity 0.25s ease;
}

.has-submenu.open > .submenu {
  max-height: 520px;
  opacity: 1;
}

.submenu li {
  border-bottom: var(--border-width-hairline) solid black;
}

.submenu li:last-child {
  border-bottom: none;
}

/* DESKTOP (lg ≥ 992px): Menu sichtbar, Submenus als Dropdown (drücken nichts nach unten) */
@media (min-width: 992px) {
  /* Off-canvas Mechanik deaktivieren */
  .burger,
  .mainnav-overlay,
  .mainnav-mobile-header {
    display: none;
  }

  .mainnav-panel {
    position: static;
    height: auto;
    width: auto;
    transform: none;
    transition: none;
    background: transparent;
    overflow: visible;
  }

  .mainnav-list {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0;
  }

  .mainnav-list > li {
    position: relative;
  }

  .mainnav-list > li > a {
    padding: 0.75rem 1rem;
    white-space: nowrap;
  }

  /* Dropdown: aus dem Flow nehmen, damit nichts nach unten gedrückt wird */
  .submenu {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    min-width: 220px;
    padding: 0.5rem;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    background: #fff;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
    z-index: 1000;

    /* Desktop: nicht über max-height steuern */
    max-height: none;
    overflow: visible;

    /* Hidden state */
    display: none;
    opacity: 1;
    transition: none;
  }

  .submenu a {
    display: block;
    padding: 0.55rem 0.75rem;
    border-radius: 0.4rem;
    color: #212529;
    text-decoration: none;
  }

  .submenu a:hover {
    background: #f8f9fa;
  }

  /* Öffnen per Hover + Tastatur (focus-within) */
  .has-submenu:hover > .submenu,
  .has-submenu:focus-within > .submenu {
    display: block;
  }
}

.mobile-menu-teamlogo {
  width: 61%;
}
