/* Header / navigation — three zones: brand | centered links | actions.
   Collapses into a dropdown under the hamburger below 820px. */
header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: var(--header-bg);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background .3s;
}
header.scrolled { border-bottom-color: var(--border); background: var(--header-bg-scrolled); }

.nav { display: flex; align-items: center; gap: 20px; height: 68px; }

.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; }
.brand .mark {
  width: 32px; height: 32px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-radius: 9px; box-shadow: 0 0 22px var(--glow);
}
.brand .mark svg { width: 18px; height: 18px; }
.brand-name { font-size: 1.06rem; letter-spacing: .2px; }
.brand-name span { color: var(--brand); }

.nav-menu { display: flex; align-items: center; flex: 1; gap: 20px; }
.nav-center { display: flex; align-items: center; gap: 30px; flex: 1; justify-content: center; }
.nav-center a.link { color: var(--muted); font-size: .93rem; font-weight: 500; transition: color .2s; }
.nav-center a.link:hover { color: var(--text); }
.nav-actions { display: flex; align-items: center; gap: 10px; }

.menu-toggle { display: none; background: none; border: 0; color: var(--text); cursor: pointer; padding: 6px; }

/* ---------- Mobile nav ---------- */
@media (max-width: 820px) {
  .nav { justify-content: space-between; }
  .nav-menu {
    display: none; position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 16px; padding: 22px 24px;
    background: var(--menu-bg); border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
  }
  .nav-menu.open { display: flex; }
  .nav-center { flex-direction: column; align-items: flex-start; gap: 16px; }
  .nav-menu .btn { justify-content: center; }
  .menu-toggle { display: block; }
}

/* ---------- Community dropdown ---------- */
.nav-item { position: relative; display: flex; align-items: center; }

.dropdown-trigger {
  display: inline-flex; align-items: center; gap: 5px;
  font: inherit; font-size: .93rem; font-weight: 500;
  color: var(--muted); background: none; border: 0; padding: 0; cursor: pointer;
  transition: color .2s;
}
.dropdown-trigger:hover { color: var(--text); }
.dropdown-trigger .chev { width: 14px; height: 14px; transition: transform .2s; }

.dropdown-menu {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%) translateY(6px);
  min-width: 210px; margin-top: 10px; padding: 8px;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--menu-bg); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.4); backdrop-filter: blur(14px);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .18s, transform .18s, visibility .18s; z-index: 60;
}
/* invisible bridge so the pointer can cross the gap without closing */
.dropdown-menu::before { content: ""; position: absolute; top: -12px; left: 0; right: 0; height: 12px; }

.nav-item:hover .dropdown-menu,
.nav-item:focus-within .dropdown-menu,
.nav-item.open .dropdown-menu {
  opacity: 1; visibility: visible; pointer-events: auto; transform: translateX(-50%) translateY(0);
}
.nav-item:hover .chev,
.nav-item.open .chev { transform: rotate(180deg); }

.dropdown-menu a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  color: var(--muted); font-size: .9rem; font-weight: 500;
  transition: background .15s, color .15s;
}
.dropdown-menu a:hover { background: var(--btn-ghost-bg); color: var(--text); }
.dropdown-menu a svg,
.dropdown-menu .is-soon svg { width: 16px; height: 16px; flex: 0 0 auto; }

/* Placeholder (not-yet-available) dropdown item */
.dropdown-menu .is-soon {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  color: var(--faint); font-size: .9rem; font-weight: 500; cursor: default;
}
.dropdown-menu .soon-badge {
  margin-left: auto; font-size: .62rem; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  color: var(--accent); border: 1px solid rgba(53,224,212,0.3); border-radius: 5px; padding: 1px 6px;
}

/* On mobile the dropdown expands inline inside the collapsed menu. */
@media (max-width: 820px) {
  .nav-item { flex-direction: column; align-items: flex-start; width: 100%; }
  .dropdown-menu {
    position: static; transform: none; opacity: 1; visibility: visible; pointer-events: auto;
    min-width: 0; margin: 10px 0 0; padding: 0 0 0 14px;
    background: none; border: 0; box-shadow: none; backdrop-filter: none;
    border-left: 1px solid var(--border);
  }
  .dropdown-menu::before { display: none; }
  .dropdown-trigger .chev { display: none; }
}
