/* ============================================================================
   nav.css  —  shared styles for the "Misc" navigation menu
   ----------------------------------------------------------------------------
   Linked from every page (allowed by the site CSP: style-src 'self').
   "Misc" is a click-to-open menu of projects: clicking it reveals the list of
   Misc projects to choose from (built from assets/misc-projects.js). It reads
   as one more nav item, not a louder feature.

   No-JS fallback: the "Misc" text is a normal link to /misc/ (the landing page,
   which lists every project), so the section is still reachable without JS.
   With JS, clicking "Misc" opens the menu instead of navigating.
   ========================================================================== */

.nav-misc {
  position: relative;
}

/* The "Misc" label inherits .nav-links a styling; we add the caret + pointer. */
.nav-misc-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  cursor: pointer;
}

/* Down-chevron next to "Misc"; points up while the menu is open. */
.nav-misc-caret {
  width: 0.42em;
  height: 0.42em;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-1px) rotate(45deg);
  transition: transform 0.2s ease;
}
.nav-misc.open .nav-misc-caret {
  transform: translateY(1px) rotate(-135deg);
}

/* ── Dropdown menu (desktop) ── */
.nav-misc-menu {
  list-style: none;
  margin: 0;
  padding: 0.4rem 0;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.7rem;
  min-width: 210px;
  background: rgba(11, 11, 11, 0.98);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
  z-index: 120;
}
.nav-misc.open .nav-misc-menu {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.nav-misc-menu li {
  width: 100%;
}
.nav-misc-menu a {
  display: block;
  padding: 0.6rem 1.15rem;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-transform: none;   /* override the uppercase nav-link treatment */
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.18s ease, background 0.18s ease;
}
.nav-misc-menu a:hover {
  color: var(--white);
  background: rgba(37, 99, 235, 0.10);
}
/* Shown only if the project registry is empty / JS is unavailable. */
.nav-misc-empty {
  display: block;
  padding: 0.6rem 1.15rem;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ── Mobile: inline expand/collapse under the "Misc" row ── */
@media (max-width: 768px) {
  .nav-misc {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
  }
  .nav-misc-link {
    flex: 1 1 auto;
  }
  .nav-misc-menu {
    position: static;
    width: 100%;
    flex-basis: 100%;
    min-width: 0;
    margin: 0;
    padding: 0 0 0.4rem 0.9rem;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    transition: none;
    transform: none;
    opacity: 1;
    visibility: visible;
    display: none;
  }
  .nav-misc.open .nav-misc-menu {
    display: block;
  }
  .nav-misc-menu a {
    padding: 0.7rem 0;
    font-size: 0.9rem;
    white-space: normal;
  }
}
