/* ──────────────────────────────────────────────────────────────
   Trybe shared navigation — single source of truth for every page
   Loaded by every HTML page (except dashboard.html which uses its
   own organiser sidebar). Design tokens come from trybe-tokens.css.
   ────────────────────────────────────────────────────────────── */

/* Reserve vertical space on first paint so content below doesn't
   jump when nav-common.js injects the inner markup. */
#site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 84px;
  background: rgba(22, 19, 16, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
}

.nav-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  box-sizing: border-box;
  height: 84px;
  max-width: 1400px;
  margin: 0 auto;
}

/* ── Logo ─────────────────────────────────────────────────── */
.nav-logo {
  font-family: var(--syne);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.5px;
  color: var(--parchment);
  text-decoration: none;
  flex-shrink: 0;
}
.nav-logo span { color: var(--horizon); }

/* ── Pill slider ──────────────────────────────────────────── */
.nav-pill-wrap {
  flex: 1;
  display: flex;
  justify-content: center;
}

.nav-pill {
  position: relative;
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
}

.nav-pill__indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 0;
  background: rgba(96, 196, 224, 0.12);
  border: 0.5px solid rgba(96, 196, 224, 0.3);
  border-radius: 999px;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
  pointer-events: none;
}
.nav-pill__indicator.is-idle { transition: none; }

.nav-pill a {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: var(--fig);
  font-size: 14px;
  font-weight: 500;
  color: #8A8378;
  text-decoration: none;
  border-radius: 999px;
  transition: color 0.25s;
  white-space: nowrap;
}
.nav-pill a svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  flex-shrink: 0;
}
.nav-pill a[aria-current="page"] {
  color: #60C4E0;
  font-weight: 600;
}
.nav-pill a:hover:not([aria-current="page"]) {
  color: var(--parchment);
}

/* ── Right side ───────────────────────────────────────────── */
.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
}

.nav-btn-outline {
  font-family: var(--fig);
  font-size: 13px;
  font-weight: 600;
  background: transparent;
  color: var(--parchment);
  border: 1px solid rgba(240, 233, 220, 0.3);
  padding: 10px 18px;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.nav-btn-outline:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(240, 233, 220, 0.5);
}

/* Logged-out avatar-icon button that links to /login */
.nav-avatar-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--parchment);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.nav-avatar-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--stone);
}
.nav-avatar-btn svg { width: 20px; height: 20px; }

/* Logged-in: notification bell */
.nav-bell-wrap {
  position: relative;
  display: inline-flex;
}
.nav-bell-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--parchment);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  padding: 0;
}
.nav-bell-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--stone);
}
.nav-bell-btn svg { width: 20px; height: 20px; stroke-width: 1.8; }
.nav-bell-dot {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--horizon);
  border: 2px solid var(--pitch);
}
.nav-bell-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  padding: 8px;
  background: var(--pitch-2);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 101;
}
.nav-bell-dropdown.is-open {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.nav-bell-empty {
  padding: 16px 14px;
  color: var(--stone);
  font-family: var(--fig);
  font-size: 13px;
  text-align: center;
}

/* Logged-in: username + circular avatar, click opens dropdown */
.nav-user {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 14px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  color: var(--parchment);
  font-family: var(--fig);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.nav-user:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--stone);
}
.nav-user img,
.nav-user .nav-monogram {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.nav-user .nav-monogram {
  background: var(--horizon);
  color: var(--pitch);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--syne);
  font-weight: 700;
  font-size: 13px;
}
.nav-user .nav-username {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Dropdown ─────────────────────────────────────────────── */
.nav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  padding: 8px;
  background: var(--pitch-2);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 101;
}
.nav-dropdown.is-open {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.nav-dropdown a,
.nav-dropdown button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--parchment);
  font-family: var(--fig);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
}
.nav-dropdown a:hover,
.nav-dropdown button:hover {
  background: rgba(255, 255, 255, 0.06);
}
.nav-dropdown svg { width: 16px; height: 16px; stroke-width: 2; color: var(--stone-light); }
.nav-dropdown hr {
  border: 0;
  border-top: 1px solid var(--border-subtle);
  margin: 6px 0;
}

/* ── Hamburger (mobile only) ──────────────────────────────── */
.nav-hamburger {
  display: none;
  width: 40px;
  height: 40px;
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--parchment);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.nav-hamburger svg { width: 20px; height: 20px; }

/* ── Mobile overlay ───────────────────────────────────────── */
.nav-mobile {
  position: fixed;
  inset: 84px 0 0 0;
  background: rgba(22, 19, 16, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: none;
  flex-direction: column;
  padding: 24px 20px;
  gap: 4px;
  z-index: 99;
  overflow-y: auto;
}
.nav-mobile.is-open { display: flex; }
.nav-mobile a {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 12px;
  color: var(--parchment);
  font-family: var(--syne);
  font-size: 20px;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--border-subtle);
}
.nav-mobile a svg {
  width: 22px;
  height: 22px;
  stroke-width: 2;
  color: var(--stone-light);
}
.nav-mobile a[aria-current="page"] { color: var(--horizon); }
.nav-mobile a[aria-current="page"] svg { color: var(--horizon); }
.nav-mobile .nav-mobile-profile {
  gap: 14px;
}
.nav-mobile .nav-mobile-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.nav-mobile .nav-mobile-avatar.nav-monogram {
  background: var(--horizon);
  color: var(--pitch);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--syne);
  font-weight: 700;
  font-size: 14px;
}
.nav-mobile .nav-mobile-cta {
  margin-top: 20px;
  border: none;
  border-radius: 12px;
  background: var(--horizon);
  color: var(--pitch);
  justify-content: center;
  font-family: var(--fig);
  font-size: 16px;
  font-weight: 600;
}

body.nav-locked { overflow: hidden; }

/* ── Responsive ───────────────────────────────────────────── */

/* Tablet: icon-only pill, keep right-side CTAs */
@media (max-width: 1024px) {
  .nav-pill a .nav-label { display: none; }
  .nav-pill a { padding: 10px 14px; }
  .nav-user .nav-username { display: none; }
  .nav-btn-outline { padding: 10px 14px; font-size: 12px; }
}

/* Mobile: hide pill, show hamburger */
@media (max-width: 768px) {
  .nav-shell { padding: 0 16px; }
  .nav-pill-wrap { display: none; }
  .nav-hamburger { display: inline-flex; margin-left: auto; }
  .nav-right { display: none; }
  .nav-logo { font-size: 20px; }
}
