/* =========================================================================
   nav.css - Leistungen dropdown + Ratgeber link for the main navigation.
   Loaded on every page (homepage + sub-pages). Reuses styles.css tokens.
   Desktop: hover/focus reveals the dropdown. Mobile (<=1080px): items shown
   inline (indented) inside the open menu, no JS needed.
   ========================================================================= */

.nav-item {
  position: relative;
  display: inline-flex;
}
.nav-item > a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nav-caret {
  width: 11px;
  height: 11px;
  opacity: 0.65;
  transition: transform 180ms var(--ease);
}
.nav-item:hover .nav-caret,
.nav-item:focus-within .nav-caret {
  transform: rotate(180deg);
}

/* Invisible bridge across the gap so the dropdown does not vanish when the
   pointer travels from the trigger down to the panel. */
.nav-item::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 14px;
}

.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 12px;
  min-width: 258px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 7px;
  background: #15161c;
  border: 1px solid var(--line-dark);
  border-radius: 14px;
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.45);
  z-index: 60;
  /* hidden state: fade + slight rise, kept in the DOM for a smooth reveal */
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 180ms var(--ease), transform 180ms var(--ease),
    visibility 0s linear 180ms;
}
.nav-item:hover > .nav-dropdown,
.nav-item:focus-within > .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 180ms var(--ease), transform 180ms var(--ease),
    visibility 0s;
}
/* Each menu item is its own block-level node so browser auto-translate
   segments them individually instead of merging the inline links. */
.nav-dropdown .nav-dd-item {
  display: flex;
}
.nav-dropdown a {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 9px 14px 9px 16px;
  border-radius: 9px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.003em;
  white-space: nowrap;
  transition: background 160ms var(--ease), color 160ms var(--ease),
    padding-left 160ms var(--ease);
}
/* thin accent bar that scales in on hover */
.nav-dropdown a::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  width: 3px;
  height: 17px;
  border-radius: 3px;
  background: var(--red);
  transform: translateY(-50%) scaleY(0);
  transform-origin: center;
  transition: transform 170ms var(--ease);
}
.nav-dropdown a:hover,
.nav-dropdown a:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  color: var(--white);
  padding-left: 20px;
}
.nav-dropdown a:hover::before,
.nav-dropdown a:focus-visible::before {
  transform: translateY(-50%) scaleY(1);
}
.nav-dropdown .nav-dropdown-all {
  margin-top: 6px;
  padding-top: 13px;
  border-top: 1px solid var(--line-dark);
  border-radius: 0 0 9px 9px;
  color: var(--yellow);
  font-weight: 700;
}
.nav-dropdown .nav-dropdown-all::before { top: calc(50% + 6px); }

@media (max-width: 1080px) {
  .nav-item {
    display: block;
    width: 100%;
  }
  .nav-item::after { display: none; }
  /* Top-Level wird zum Akkordeon-Trigger: Label links, Pfeil rechts */
  .nav-item > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }
  .nav-caret {
    display: inline-block;
    flex: 0 0 auto;
    margin-left: 12px;
    transition: transform 0.25s var(--ease, ease);
  }
  .nav-item.is-open > a .nav-caret { transform: rotate(180deg); }

  .nav-dropdown {
    position: static;
    display: flex;
    flex-direction: column;
    margin: 0 0 0 14px;
    min-width: 0;
    padding: 0 0 0 10px;
    background: transparent;
    border: none;
    border-left: 2px solid var(--line-dark);
    border-radius: 0;
    box-shadow: none;
    /* eingeklappt per Default, per .is-open aufklappbar */
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: none;
    transition: max-height 0.32s var(--ease, ease), opacity 0.24s ease, margin 0.32s var(--ease, ease);
  }
  /* Hover/Focus auf Touch NICHT aufklappen, nur per .is-open */
  .nav-item:hover > .nav-dropdown,
  .nav-item:focus-within > .nav-dropdown {
    max-height: 0;
    opacity: 0;
    visibility: hidden;
  }
  .nav-item.is-open > .nav-dropdown {
    max-height: 560px;
    opacity: 1;
    visibility: visible;
    margin: 2px 0 10px 14px;
  }
  .nav-dropdown a { min-height: 40px; }
  .nav-dropdown a::before { display: none; }
  .nav-dropdown a:hover,
  .nav-dropdown a:focus-visible { padding-left: 14px; }
  .nav-dropdown .nav-dropdown-all { border-top: none; padding-top: 9px; margin-top: 2px; }
}
