/* ============================================================
   SITE NAV — einheitliche Navigation für alle Seiten
   Lädt als LETZTES Stylesheet, damit es alte .nav*-Regeln überschreibt.
   Abhängig nur von Kern-Variablen; Fallbacks für optionale.
   ============================================================ */

.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--nav-bg, rgba(255,255,255,0.88));
  border-bottom: 1px solid var(--nav-border, rgba(0,0,0,0.08));
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
}
.nav__inner {
  max-width: var(--container, 1160px);
  margin: 0 auto;
  padding: 0 var(--pad, 24px);
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
}

/* Logo */
.nav__logo { display: flex; align-items: center; gap: 12px; text-decoration: none; flex-shrink: 0; }
.nav__logo img { height: 20px; width: auto; }
.nav .logo-dark { display: none; }
[data-theme="dark"] .nav .logo-light { display: none; }
[data-theme="dark"] .nav .logo-dark { display: inline-block; }
.nav__logo-sep { width: 1px; height: 16px; background: var(--border, #e0e0e0); }
.nav__logo-product { font-size: 13px; font-weight: 700; color: var(--text-head, #222); letter-spacing: 0.06em; text-transform: uppercase; }

/* Desktop links */
.nav__links { display: flex; align-items: center; gap: 26px; list-style: none; margin: 0; padding: 0; }
.nav__links > li { position: relative; }
.nav__links a { font-size: 13px; font-weight: 500; color: var(--text-muted, #666); text-decoration: none; transition: color var(--dur-base, 220ms); white-space: nowrap; }
.nav__links a:hover { color: var(--text-head, #222); }
.nav__links a.is-active { color: var(--green, #33cc3f); font-weight: 600; }

/* Dropdown (desktop) — nur im Kontext (Carrier-/Funktions-Seite) aktiv */
.nav__has-sub.is-context > a::after {
  content: ''; display: inline-block; width: 5px; height: 5px; margin-left: 5px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-1px); opacity: 0.6;
}
.nav__sub {
  position: absolute; top: calc(100% + 14px); left: 50%; transform: translateX(-50%) translateY(6px);
  min-width: 200px; background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e0e0e0); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.12);
  padding: 8px; display: flex; flex-direction: column; gap: 2px;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity var(--dur-base, 220ms), transform var(--dur-base, 220ms), visibility var(--dur-base, 220ms);
  z-index: 101;
}
.nav__sub::before { /* Hover-Brücke, damit der Mauspfad nicht abreißt */
  content: ''; position: absolute; top: -14px; left: 0; right: 0; height: 14px;
}
.nav__has-sub.is-context:hover .nav__sub,
.nav__has-sub.is-context:focus-within .nav__sub {
  opacity: 1; visibility: visible; pointer-events: auto; transform: translateX(-50%) translateY(0);
}
.nav__sub a { font-size: 13px; font-weight: 500; color: var(--text-muted, #666); padding: 8px 12px; border-radius: 8px; transition: color var(--dur-base, 220ms), background var(--dur-base, 220ms); }
.nav__sub a:hover { color: var(--text-head, #222); background: var(--bg-alt, #f7f7f7); }

/* Right cluster */
.nav__right { display: flex; align-items: center; gap: 12px; }

/* Theme toggle */
.nav .theme-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 50%; border: 1px solid var(--border, #e0e0e0);
  background: var(--card-bg, #fff); cursor: pointer; color: var(--text-muted, #666);
  transition: border-color var(--dur-base, 220ms), color var(--dur-base, 220ms);
}
.nav .theme-toggle:hover { color: var(--text-head, #222); border-color: var(--text-muted, #666); }
.nav .theme-toggle svg { width: 16px; height: 16px; }
.nav .icon-sun { display: block; }
.nav .icon-moon { display: none; }
[data-theme="dark"] .nav .icon-sun { display: none; }
[data-theme="dark"] .nav .icon-moon { display: block; }

/* Demo CTA */
.nav__cta {
  display: inline-flex; align-items: center; flex-shrink: 0;
  background: var(--green, #33cc3f); color: #fff;
  font-size: 13px; font-weight: 700; padding: 8px 18px;
  border-radius: 99px; text-decoration: none;
  transition: background var(--dur-base, 220ms);
}
.nav__cta:hover { background: var(--green-dark, #29a332); }

/* Hamburger */
.nav__hamburger {
  display: none; flex-direction: column; gap: 5px;
  width: 36px; height: 36px; align-items: center; justify-content: center;
  cursor: pointer; border: none; background: none; padding: 0; flex-shrink: 0;
}
.nav__hamburger span {
  display: block; width: 20px; height: 1.5px; background: var(--text-head, #222);
  border-radius: 2px; transition: transform var(--dur-base, 220ms), opacity var(--dur-base, 220ms);
}
.nav__hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav__hamburger.open span:nth-child(2) { opacity: 0; }
.nav__hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* Mobile panel */
.nav__mobile {
  display: none; position: fixed; top: 60px; left: 0; right: 0;
  background: var(--nav-bg, rgba(255,255,255,0.95));
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--nav-border, rgba(0,0,0,0.08));
  padding: 14px var(--pad, 24px) 24px;
  z-index: 99; max-height: calc(100vh - 60px); overflow-y: auto;
}
.nav__mobile.open { display: block; }
.nav__mobile a { display: block; padding: 11px 0; font-size: 15px; font-weight: 500; color: var(--text, #333); text-decoration: none; border-bottom: 1px solid var(--border-sub, var(--border, #e0e0e0)); }
.nav__mobile a:last-child { border-bottom: none; }
.nav__mobile a.is-active { color: var(--green, #33cc3f); font-weight: 600; }

/* Mobile: Zurück-Link */
.nav__mobile-back {
  color: var(--text-muted, #666) !important; font-size: 13px !important;
  font-weight: 600 !important; display: flex !important; align-items: center; gap: 6px;
}
.nav__mobile-back.is-hidden { display: none !important; }

/* Mobile: Unterpunkte eingerückt — nur im Kontext sichtbar */
.nav__mobile-subs { display: none; flex-direction: column; }
.nav__mobile-subs.is-context { display: flex; }
.nav__mobile-subs a {
  padding-left: 18px; font-size: 14px; color: var(--text-muted, #666);
  border-bottom: 1px solid var(--border-sub, var(--border, #e0e0e0));
}
.nav__mobile-subs a::before { content: '↳'; margin-right: 8px; opacity: 0.45; }

/* Mobile: Demo-CTA betont */
.nav__mobile-cta { color: var(--green, #33cc3f) !important; font-weight: 700 !important; }

/* Breakpoints */
@media (max-width: 900px) {
  .nav__links { display: none; }
  .nav__hamburger { display: flex; }
}
@media (max-width: 560px) {
  /* Demo-Button rückt ins Hamburger-Menü (dort als nav__mobile-cta vorhanden) */
  .nav__cta { display: none; }
}
