/* ============================================================
   VALEN – Navigation
   EINE Navigation für alle Seiten.
   Oben: transparente Leiste, bündig mit dem Inhaltsraster.
   Nach dem Scrollen: Glaskapsel – gleiche Breite, gleiche
   Innenabstände, nur Höhe/Hintergrund/Radius verändern sich.
   ============================================================ */

.navbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  /* Seitlicher Rand, damit die Kapsel schwebt statt zu kleben. */
  padding: 0 var(--nav-gutter);
  /* Die Leiste selbst fängt keine Klicks ab – nur ihre Inhalte. */
  pointer-events: none;
}

.nav-content {
  position: relative;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 2rem;
  /* Identische Box wie .container → Logo sitzt exakt auf der
     Fluchtlinie der Überschriften darunter. */
  width: 100%;
  max-width: var(--max-w);
  height: var(--nav-h);
  margin: 0 auto;
  padding: 0 var(--nav-pad);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  transition:
    height 0.5s var(--ease-out),
    margin-top 0.5s var(--ease-out),
    background 0.45s var(--ease-soft),
    border-color 0.45s var(--ease-soft),
    box-shadow 0.45s var(--ease-soft);
}

/* Gescrollt: Kapsel. Nur Höhe, Fläche und Rahmen ändern sich –
   die horizontale Fluchtlinie bleibt stehen (kein Textversprung). */
.navbar.is-scrolled .nav-content {
  height: var(--nav-h-compact);
  margin-top: var(--nav-float);
  border-color: rgba(255, 255, 255, 0.13);
  /* Deckend genug, dass die helle Schrift auch über den hellen
     Abschnitten (Produkte, Software, CASEOS) sicher lesbar bleibt. */
  background: rgba(13, 15, 17, 0.86);
  box-shadow:
    0 20px 55px -20px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(26px) saturate(165%);
  -webkit-backdrop-filter: blur(26px) saturate(165%);
}

/* ── Logo ──────────────────────────────────────────────────── */

.logo {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-inv);
  text-decoration: none;
}
.logo-img {
  height: 24px;
  width: 24px;
  object-fit: contain;
  filter: invert(1) brightness(1.4);
}

/* ── Links ─────────────────────────────────────────────────── */

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  /* Links sitzen mittig zwischen Logo und CTA. */
  margin: 0 auto;
}
.nav-links a {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 0.85rem;
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text-inv-sub);
  text-decoration: none;
  transition: color 0.25s, background 0.25s;
}
.nav-links a:hover { color: var(--text-inv); background: rgba(255, 255, 255, 0.07); }

/* Aktive Seite: gefüllte Pille statt Unterstrich – der Unterstrich
   hätte die Zeilenhöhe verändert und die Leiste verzogen. */
.nav-links a[aria-current="page"] {
  color: var(--text-inv);
  background: rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* ── CTA ───────────────────────────────────────────────────── */

.btn-nav {
  flex: none;
  height: 38px;
  padding: 0 1.15rem;
  font-size: 0.84rem;
  background: var(--stone);
  color: var(--ink);
}
.btn-nav:hover { background: #fff; transform: translateY(-1px); }

/* ── Hamburger ─────────────────────────────────────────────── */

.hamburger {
  display: none;
  flex: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  /* Ganz nach rechts, und um die eigene Innenluft zurückgezogen,
     damit die Striche auf der Fluchtlinie sitzen – nicht der Rahmen. */
  margin-left: auto;
  margin-right: -11px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: none;
  cursor: pointer;
  transition: background 0.25s, border-color 0.25s;
}
.hamburger:hover { background: rgba(255, 255, 255, 0.07); }
.hamburger span {
  display: block;
  width: 19px;
  height: 1.5px;
  border-radius: 2px;
  background: var(--text-inv);
  transform-origin: center;
  transition: transform 0.28s var(--ease-out), opacity 0.2s;
}
.hamburger.is-open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.hamburger.is-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.is-open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ── Mobiles Menü ──────────────────────────────────────────── */

.mobile-menu {
  display: none;
  flex-direction: column;
  pointer-events: auto;
  /* Exakt unter der Kapsel und in derselben Breite. */
  width: 100%;
  max-width: var(--max-w);
  margin: 0.5rem auto 0;
  padding: 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: var(--radius-lg);
  background: rgba(14, 16, 18, 0.9);
  box-shadow: 0 26px 60px -24px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  animation: navMenuIn 0.32s var(--ease-out) both;
}
.mobile-menu.is-open { display: flex; }
@keyframes navMenuIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: none; }
}
.mobile-menu-link {
  display: flex;
  align-items: center;
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  font-size: 0.98rem;
  font-weight: 500;
  color: var(--text-inv-sub);
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}
.mobile-menu-link:hover { background: rgba(255, 255, 255, 0.06); color: var(--text-inv); }
.mobile-menu-link[aria-current="page"] { background: rgba(255, 255, 255, 0.09); color: var(--text-inv); }
.mobile-menu-cta { margin-top: 0.6rem; width: 100%; }

/* ── Umbruch: ab hier Burger statt Linkleiste ──────────────── */

@media (max-width: 1000px) {
  .nav-links,
  .btn-nav-desktop { display: none; }
  .hamburger { display: flex; }
}

/* Auf kleinen Displays rückt die Kapsel näher an den Rand, damit
   Logo und Seiteninhalt annähernd auf derselben Kante stehen. */
@media (max-width: 720px) {
  :root {
    --nav-h: 66px;
    --nav-h-compact: 56px;
    --nav-pad: 0.95rem;
    --nav-gutter: 10px;
  }
  .mobile-menu { padding: 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .nav-content,
  .hamburger span,
  .nav-links a { transition: none; }
  .mobile-menu { animation: none; }
}
