/* Kopfzeile + Menue (30.11.2026): auf allen Seiten gleich. Wird NACH styles.css bzw. homepage.css geladen und gewinnt
   gegen deren aeltere Menue-Regeln (die bleiben als Rueckfall stehen). Gewichtung: Menuepunkte gross und fett,
   ein Hauptknopf "Upcoming events" (.nav-cta) am Ende - auf dem Handy unten im offenen Menue, am Desktop rechts in der Kopfzeile.
   Zustand "Menue offen": nav.is-open + body.menu-open (app.js). */

.nav-row { position: static; }

/* ---------- Menueknopf (Handy): Streifen werden zum X ---------- */
.menu-toggle span {
  display: block;
  width: 20px;
  height: 2.5px;
  background: var(--text);
  border-radius: 999px;
  transition: transform 220ms ease, opacity 220ms ease;
}

.menu-toggle[aria-expanded="true"] span:first-child { transform: translateY(3.75px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3.75px) rotate(-45deg); }

.menu-toggle:focus-visible,
.site-nav a:focus-visible {
  outline: 2px solid var(--brand-indigo);
  outline-offset: 2px;
}

/* Pfeil-Knopf fuer die Unterpunkte: nur im Handy-Menue (unten), am Desktop gilt das Hover-Untermenue */
.site-nav .site-subnav-toggle { display: none; }

/* ---------- Hauptknopf (alle Breiten) ---------- */
.site-header .site-nav a.nav-cta {
  color: #fff;
  font-weight: 700;
  background: linear-gradient(135deg, var(--brand-indigo), var(--brand-teal));
  box-shadow: 0 10px 24px rgba(37, 63, 133, 0.22);
  white-space: nowrap;
}

.site-header .site-nav a.nav-cta::after {
  content: "\2192" / "";
  display: inline-block;
  margin-left: 10px;
  transition: transform 180ms ease;
}

.site-header .site-nav a.nav-cta:hover,
.site-header .site-nav a.nav-cta:focus-visible {
  color: #fff;
  background: linear-gradient(135deg, var(--brand-indigo), var(--brand-teal));
  box-shadow: 0 14px 30px rgba(37, 63, 133, 0.3);
}

.site-header .site-nav a.nav-cta:hover::after,
.site-header .site-nav a.nav-cta:focus-visible::after {
  transform: translateX(4px);
}

/* ---------- Desktop (ab 1181 px) ---------- */
@media (min-width: 1181px) {
  .site-nav { gap: 2px; }

  .site-nav a {
    padding: 12px 13px;
    color: var(--text);
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
  }

  .site-nav a:hover,
  .site-nav a:focus-visible {
    background: rgba(37, 63, 133, 0.07);
  }

  .site-nav a.is-active {
    color: var(--brand-indigo);
    background: rgba(37, 63, 133, 0.1);
  }

  .site-subnav a { font-weight: 600; }

  .site-header .site-nav a.nav-cta {
    margin-left: 8px;
    padding: 13px 20px;
    color: #fff;
  }
}

/* Schmaler Desktop (1181-1240 px): etwas enger, damit auch lange Seitenmenues (Event-Seiten, Russisch) + Knopf in eine Zeile passen */
@media (min-width: 1181px) and (max-width: 1240px) {
  .site-nav a {
    padding-left: 12px;
    padding-right: 12px;
    font-size: 0.95rem;
  }

  .site-header .site-nav a.nav-cta {
    margin-left: 6px;
    padding: 12px 18px;
  }
}

/* ---------- Handy / Tablet (bis 1180 px): ausklappendes Vollbreiten-Menue unter der Kopfzeile ----------
   Grenze 1180 statt 980 px, weil die Seitenmenues der Event-Seiten (6 Punkte, russisch laenger) samt Knopf darunter nicht in eine Zeile passen. */
@media (max-width: 1180px) {
  .menu-toggle { display: inline-flex; }
  .site-nav-item-has-children::after { display: none; }

  body.menu-open { overflow: hidden; }

  /* schwebende Teile (Sprachwahl, Cookie-Symbol, Cookie-Leiste) treten hinter das offene Menue zurueck; die Leiste kommt beim Schliessen wieder
     (sonst deckt sie auf kleinen Handys den Knopf unten im Menue zu) */
  body.menu-open .lang-switch,
  body.menu-open .cookie-fab,
  body.menu-open .cookie-banner {
    visibility: hidden;
  }

  body.menu-open .site-header {
    background: #fff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  /* Abdunklung der Seite unter der Kopfzeile; Klick darauf schliesst (app.js) */
  body.menu-open .site-header::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 100vh;
    background: rgba(18, 36, 60, 0.45);
    z-index: 1;
  }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: auto;
    max-height: calc(100vh - 88px);
    max-height: calc(100dvh - 88px);
    overflow-y: auto;
    overscroll-behavior: contain;
    margin: 0;
    padding: 4px 20px 28px;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0 0 24px 24px;
    background: #fff;
    box-shadow: 0 28px 48px rgba(16, 32, 58, 0.2);
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    z-index: 2;
  }

  .site-nav.is-open {
    display: flex;
    animation: menu-in 220ms ease both;
  }

  /* Hauptpunkte: gross, fett, mit feiner Trennlinie */
  .site-nav > a:not(.nav-cta),
  .site-nav-item-top a {
    display: flex;
    align-items: center;
    min-height: 60px;
    padding: 14px 4px;
    border-radius: 0;
    color: var(--text);
    background: transparent;
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.2;
    transform: none;
  }

  .site-nav > a:not(.nav-cta),
  .site-nav > .site-nav-item {
    border-bottom: 1px solid var(--line);
  }

  .site-nav > a:not(.nav-cta):hover,
  .site-nav > a:not(.nav-cta):focus-visible,
  .site-nav-item-top a:hover,
  .site-nav-item-top a:focus-visible {
    background: transparent;
    color: var(--brand-indigo);
    transform: none;
  }

  /* aktive Seite: Farbe + Strich links */
  .site-nav > a.is-active,
  .site-nav-item-top a.is-active {
    position: relative;
    color: var(--brand-indigo);
    background: transparent;
    padding-left: 16px;
  }

  .site-nav > a.is-active::before,
  .site-nav-item-top a.is-active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 16px;
    bottom: 16px;
    width: 4px;
    border-radius: 999px;
    background: var(--brand-teal);
  }

  /* Zeile mit Pfeil-Knopf: Text fuehrt zur Seite, Pfeil klappt die Unterpunkte auf/zu (Knopf legt app.js an) */
  .site-nav-item-top,
  .site-nav-item-direct .site-nav-item-top {
    display: flex;
    align-items: stretch;
  }

  .site-nav-item-top a { flex: 1 1 auto; min-width: 0; }

  .site-nav .site-nav-item-direct .site-subnav-toggle,
  .site-nav .site-nav-item-direct .site-subnav-toggle:hover,
  .site-nav .site-nav-item-direct:focus-within .site-subnav-toggle {
    display: flex;
    flex: 0 0 60px;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: auto;
    min-height: 60px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
  }

  .site-nav .site-nav-item-direct .site-subnav-toggle:hover,
  .site-nav .site-nav-item-direct .site-subnav-toggle:focus-visible { color: var(--brand-indigo); }

  .site-subnav-toggle::before {
    content: "";
    position: relative;
    top: -3px;
    width: 10px;
    height: 10px;
    border-right: 2.5px solid currentColor;
    border-bottom: 2.5px solid currentColor;
    transform: rotate(45deg);
    transition: transform 220ms ease, top 220ms ease;
  }

  .site-nav-item.is-expanded .site-subnav-toggle::before {
    top: 3px;
    transform: rotate(225deg);
  }

  /* Unterpunkte (Community): zugeklappt, per Pfeil aufklappbar (is-expanded), eingerueckt */
  .site-nav-item .site-subnav,
  .site-nav-item.is-open .site-subnav,
  .site-nav-item:hover .site-subnav,
  .site-nav-item:focus-within .site-subnav {
    position: static;
    display: grid;
    gap: 0;
    width: 100%;
    min-width: 0;
    margin: 0 0 0 4px;
    padding: 0 0 0 14px;
    border: 0;
    border-left: 2px solid rgba(19, 138, 138, 0.4);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: none !important;
    transition: max-height 240ms ease, margin 240ms ease, opacity 200ms ease, visibility 0s linear 240ms;
  }

  .site-nav .site-nav-item.is-expanded .site-subnav {
    max-height: 240px;
    margin-bottom: 12px;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
  }

  .site-subnav a {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 48px;
    padding: 10px 8px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: var(--text-soft);
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.2;
    transform: none;
    visibility: inherit;   /* styles.css setzt hier "visible"; zugeklappte Links wuerden sonst per Tab erreichbar bleiben */
  }

  .site-subnav a:hover,
  .site-subnav a:focus-visible,
  .site-subnav a.is-active {
    background: transparent;
    color: var(--brand-indigo);
    transform: none;
  }

  .site-subnav a.is-active { font-weight: 700; }

  /* Hauptknopf unten im Menue */
  .site-header .site-nav a.nav-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 58px;
    margin: 24px 0 0;
    padding: 0 24px;
    border-radius: 999px;
    font-size: 1.0625rem;
    transform: none;
  }

  .site-header .site-nav a.nav-cta:hover,
  .site-header .site-nav a.nav-cta:focus-visible { transform: none; }
}

@media (max-width: 720px) {
  .site-nav {
    max-height: calc(100vh - 76px);
    max-height: calc(100dvh - 76px);
  }
}

@keyframes menu-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .site-nav.is-open { animation: none; }
  .site-subnav,
  .site-subnav-toggle::before { transition: none !important; }
  .menu-toggle span,
  .site-header .site-nav a.nav-cta::after { transition: none; }
}
