/* ===================================================
   Navbar Dropdown — Desktop hover + Mobile tap toggle
   =================================================== */

.dropdown {
  position: relative;
  display: flex;
  align-items: center;
}

.dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
}

/* Dropdown panel */
.dropdown-menu {
  display: none;
  list-style: none;
  margin: 0;
  padding: 8px 0;
  min-width: 220px;
  z-index: 1100;
  /* Desktop: floating panel anchored below the toggle */
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(12px);
}

/* Invisible bridge so cursor can travel from toggle to panel without flickering */
.dropdown-menu::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 0;
  width: 100%;
  height: 10px;
}

.dropdown-menu li {
  margin: 0;
  display: block;
}

.dropdown-menu a {
  display: block;
  padding: 9px 20px;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  color: var(--text-secondary, #475569) !important;
  transition: background 0.2s, color 0.2s;
}

.dropdown-menu a:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--accent-cyan, #42a5f5) !important;
}

/* ── Desktop: open on hover ── */
@media (min-width: 769px) {
  .dropdown:hover .dropdown-menu {
    display: block;
  }
}

/* ── Mobile: open via .open class toggled by JS ── */
@media (max-width: 768px) {
  .dropdown {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }

  .dropdown-toggle {
    width: 100%;
    padding: 14px 10px;
    border-bottom: 1px solid var(--border-glass, rgba(0, 0, 0, 0.08));
    font-size: 1rem;
    color: var(--text-secondary, #475569);
    font-weight: 600;
  }

  .dropdown-menu {
    position: static;
    box-shadow: none;
    background: transparent;
    border: none;
    border-left: 2px solid rgba(0, 0, 0, 0.08);
    padding: 4px 0 4px 12px;
    margin: 0 0 4px 10px;
    min-width: unset;
    width: calc(100% - 10px);
    display: none;
    backdrop-filter: none;
  }

  /* Show when toggled by JS */
  .dropdown.open .dropdown-menu {
    display: block;
  }

  .dropdown-menu::before {
    display: none;
  }

  .dropdown-menu a {
    padding: 10px 10px !important;
    font-size: 0.9rem !important;
    color: var(--text-secondary, #475569) !important;
    border-bottom: 1px solid var(--border-glass, rgba(0, 0, 0, 0.05));
    white-space: normal;
  }

  .dropdown-menu a:hover,
  .dropdown-menu a:active {
    color: var(--accent-cyan, #42a5f5) !important;
    background: transparent;
  }

  /* Allow nav to scroll if dropdown makes it tall */
  #nav-links.open {
    overflow-y: auto;
    max-height: 85vh;
  }
}
