/* ──────────────────────────────────────────────────────────────
   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; }

/* Bottom nav + explore drawer + mobile top nav: hidden by default, shown only at ≤768px */
#trybe-bottom-nav { display: none; }
#trybe-explore-drawer { display: none; }
#trybe-mobile-top-nav { display: none; }
.mtn-overflow-menu { display: none; }
.mtn-overflow-backdrop { display: none; }

/* ── 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, bottom tab bar replaces hamburger */
@media (max-width: 768px) {
  /* Hide desktop #site-nav — mobile top nav replaces it */
  #site-nav { display: none !important; }

  .nav-shell { padding: 0 16px; }
  .nav-pill-wrap { display: none; }
  .nav-hamburger { display: none !important; }
  .nav-right { display: none; }
  .nav-logo { font-size: 20px; }
  .nav-mobile { display: none !important; }

  body { padding-bottom: 72px; }

  /* ── Bottom tab bar ──────────────────────────────────────── */
  #trybe-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    padding-bottom: 8px;
    background: rgba(22, 19, 16, 0.98);
    border-top: 0.5px solid var(--border-subtle);
    z-index: 200;
    align-items: stretch;
  }

  .btm-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 2px 4px;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    color: var(--stone);
    font-family: var(--syne);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.01em;
    position: relative;
    -webkit-tap-highlight-color: transparent;
  }

  .btm-tab svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.8;
    stroke: var(--stone);
    fill: none;
  }

  .btm-tab span {
    white-space: nowrap;
  }

  .btm-tab.is-active,
  .btm-tab.is-drawer-open {
    color: var(--horizon);
  }

  .btm-tab.is-active svg,
  .btm-tab.is-drawer-open svg {
    stroke: var(--horizon);
  }

  .btm-tab.is-active::after,
  .btm-tab.is-drawer-open::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 2px;
    background: var(--horizon);
    border-radius: 0 0 2px 2px;
  }

  /* ── Mobile top nav ────────────────────────────────────── */
  #trybe-mobile-top-nav {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    padding: 0 20px;
    background: rgba(22, 19, 16, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 0.5px solid rgba(96, 196, 224, 0.1);
    position: sticky;
    top: 0;
    z-index: 201;
  }

  .mtn-left {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 60px;
  }

  .mtn-back {
    display: flex;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--horizon);
    font-family: var(--fig);
    font-weight: 500;
    font-size: 13px;
    -webkit-tap-highlight-color: transparent;
  }
  .mtn-back i { font-size: 20px; }

  .mtn-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }

  .mtn-wordmark {
    font-family: var(--syne);
    font-weight: 800;
    font-size: 18px;
    color: var(--parchment);
    text-decoration: none;
  }
  .mtn-wordmark span { color: var(--horizon); }

  .mtn-right {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 60px;
    justify-content: flex-end;
  }

  .mtn-icon-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--stone);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    -webkit-tap-highlight-color: transparent;
  }
  .mtn-icon-btn i { font-size: 20px; }

  .mtn-bell-dot {
    position: absolute;
    top: 0;
    right: -1px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ember);
    border: 1.5px solid var(--pitch);
  }

  .mtn-signin {
    font-family: var(--fig);
    font-weight: 500;
    font-size: 12px;
    color: var(--horizon);
    background: none;
    border: 0.5px solid rgba(96, 196, 224, 0.4);
    border-radius: 6px;
    padding: 5px 10px;
    cursor: pointer;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }

  /* ── Mobile overflow menu ─────────────────────────────── */
  .mtn-overflow-menu {
    display: block !important;
    position: fixed;
    top: 52px;
    right: 12px;
    width: 180px;
    background: var(--pitch-3);
    border: 0.5px solid var(--border-medium);
    border-radius: 12px;
    z-index: 202;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
  }
  .mtn-overflow-menu.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .mtn-overflow-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 14px;
    background: none;
    border: none;
    border-bottom: 0.5px solid rgba(138, 131, 120, 0.12);
    cursor: pointer;
    font-family: var(--fig);
    font-weight: 400;
    font-size: 13px;
    color: var(--parchment);
    text-align: left;
    -webkit-tap-highlight-color: transparent;
  }
  .mtn-overflow-item:last-child { border-bottom: none; }
  .mtn-overflow-item i { font-size: 16px; color: var(--stone); }
  .mtn-overflow-item.destructive { color: var(--ember); }
  .mtn-overflow-item.destructive i { color: var(--ember); }

  .mtn-overflow-backdrop {
    position: fixed;
    inset: 0;
    z-index: 201;
    display: none !important;
  }
  .mtn-overflow-backdrop.is-open { display: block !important; }

  /* ── Explore drawer ──────────────────────────────────────── */
  #trybe-explore-drawer {
    display: none;
    position: fixed;
    bottom: 72px;
    left: 0;
    right: 0;
    background: var(--pitch-2);
    border-top: 0.5px solid var(--border-subtle);
    z-index: 199;
    padding: 8px;
    flex-direction: column;
    gap: 4px;
  }

  #trybe-explore-drawer.is-open {
    display: flex;
  }

  .explore-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.025);
    border: 0.5px solid var(--border-subtle);
    text-decoration: none;
    color: var(--stone-light);
    font-family: var(--syne);
    font-size: 12px;
    font-weight: 600;
    -webkit-tap-highlight-color: transparent;
  }

  .explore-item svg {
    width: 16px;
    height: 16px;
    stroke-width: 1.8;
    stroke: var(--horizon);
    fill: none;
    flex-shrink: 0;
  }

  .explore-divider {
    height: 0.5px;
    background: var(--border-subtle);
    margin: 2px 0;
  }
}
