/* ── App navigation (auth / dashboard / admin pages) ── */

.site-header {
  background: var(--bg-nav);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-nav {
  padding: 0 var(--pad);
  height: 100%;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* ── Brand link ── */
.site-nav-brand-link {
  font-family: var(--fd);
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -.01em;
  text-decoration: none;
  transition: color .2s;
}

.site-nav-brand-link:hover { color: var(--accent); }

/* ── Center links ── */
.site-nav-links {
  display: flex;
  align-items: center;
  gap: 2.25rem;
  flex: 1;
}

.site-nav-links a:not(.site-nav-brand-link) {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
  text-decoration: none;
  letter-spacing: .02em;
  transition: color .2s;
}

.site-nav-links a:not(.site-nav-brand-link):hover { color: var(--accent); }

/* ── Injected section links (public, always visible on desktop) ── */
.site-nav-section-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
  text-decoration: none;
  letter-spacing: .02em;
  transition: color .2s;
}
.site-nav-section-link:hover { color: var(--accent); }

/* ── Injected auth links (after public links, desktop only) ── */
.site-nav-auth-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
  text-decoration: none;
  letter-spacing: .02em;
  transition: color .2s;
}
.site-nav-auth-link:hover { color: var(--accent); }
.site-nav-auth-link.active { color: var(--accent); }

/* Separator before the first auth link */
.site-nav-auth-first {
  border-left: 1px solid var(--border);
  padding-left: 1.25rem;
}

/* ── Right side ── */
.site-nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
  min-height: 32px;
}

.site-nav-right > a {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
  text-decoration: none;
  transition: color .2s;
}

.site-nav-right > a:hover { color: var(--accent); }

/* ── Right-side identity (name + avatar, opens sign-out dropdown) ── */
.nav-auth-identity { position: relative; }

.nav-auth-id-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.nav-auth-id-btn:hover .nav-auth-name { color: var(--text); }
.nav-auth-id-btn:hover .nav-auth-avatar { border-color: var(--accent); }

.nav-auth-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-accent);
  background: var(--accent-dim);
  color: var(--accent);
  font-family: var(--fd);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .5px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  transition: border-color .2s;
}

.nav-auth-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Right-side placeholder shown only while /users/me is in flight, and only when
   this browser has a stored session. Neutral by design — it asserts neither
   signed-in nor signed-out, which the old optimistic "Login" link did. */
.nav-auth-skeleton {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid var(--border-accent);
  flex-shrink: 0;
  animation: navSkeletonPulse 1.4s ease-in-out infinite;
}

@keyframes navSkeletonPulse {
  0%, 100% { opacity: .45; }
  50%      { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .nav-auth-skeleton { animation: none; opacity: .6; }
}

.nav-auth-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
  letter-spacing: .02em;
  white-space: nowrap;
  transition: color .2s;
}

/* Sign-out dropdown */
.nav-auth-id-dd {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  min-width: 120px;
  display: none;
  z-index: 500;
  overflow: hidden;
}

.nav-auth-id-dd.open { display: block; }

.nav-auth-id-dd button,
.nav-auth-id-dd a {
  display: block;
  width: 100%;
  text-align: left;
  padding: .6rem 1rem;
  font-size: .875rem;
  color: var(--text-sub);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--fb);
  text-decoration: none;
  transition: background .15s, color .15s;
}

/* Sign out is the danger action — red on hover. Navigation links stay neutral. */
.nav-auth-id-dd button:hover {
  background: var(--bg-surface);
  color: var(--danger);
}

.nav-auth-id-dd a:hover {
  background: var(--bg-surface);
  color: var(--accent);
}

/* ── Hamburger button ── */
.site-nav-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  width: 44px; height: 44px;
  background: none; border: none; cursor: pointer;
  padding: 0; flex-shrink: 0;
}

.site-nav-menu-btn span {
  display: block; width: 22px; height: 2px;
  background: var(--text); border-radius: 2px;
  transition: transform .25s ease, opacity .2s;
}

.site-nav-menu-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.site-nav-menu-btn.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.site-nav-menu-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Mobile menu overlay ── */
.site-mobile-menu {
  display: flex; flex-direction: column;
  position: fixed; inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 99;
  padding: calc(var(--nav-h) + 2.5rem) var(--pad) 3rem;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .25s ease, visibility .25s;
}

.site-mobile-menu.open { opacity: 1; visibility: visible; pointer-events: auto; }

.site-mobile-nav { display: flex; flex-direction: column; }

.site-mobile-nav a {
  font-family: var(--fd);
  font-size: clamp(1.75rem, 8vw, 2.5rem);
  font-weight: 700;
  color: var(--text); text-decoration: none;
  padding: .9rem 0; letter-spacing: -.03em;
  border-bottom: 1px solid var(--border);
  opacity: 0; transform: translateY(12px);
  transition: transform .3s ease, opacity .3s ease, color .2s, padding-left .15s;
}

.site-mobile-menu.open .site-mobile-nav a { opacity: 1; transform: translateY(0); }
.site-mobile-nav a:last-child { border-bottom: none; }
.site-mobile-nav a:hover,
.site-mobile-nav a:focus { color: var(--accent); padding-left: 10px; }

/* Stagger entrance */
.site-mobile-menu.open .site-mobile-nav a:nth-child(1) { transition-delay: .04s; }
.site-mobile-menu.open .site-mobile-nav a:nth-child(2) { transition-delay: .09s; }
.site-mobile-menu.open .site-mobile-nav a:nth-child(3) { transition-delay: .14s; }
.site-mobile-menu.open .site-mobile-nav a:nth-child(4) { transition-delay: .19s; }
.site-mobile-menu.open .site-mobile-nav a:nth-child(5) { transition-delay: .24s; }
.site-mobile-menu.open .site-mobile-nav a:nth-child(6) { transition-delay: .28s; }
.site-mobile-menu.open .site-mobile-nav a:nth-child(7) { transition-delay: .32s; }
.site-mobile-menu.open .site-mobile-nav a:nth-child(8) { transition-delay: .36s; }

/* Auth link variants */
.site-mobile-nav .nav-auth-link { color: var(--accent); }
.site-mobile-nav .nav-auth-first { padding-top: 1.1rem; }
.site-mobile-nav .nav-auth-signout { color: var(--danger); }
.site-mobile-nav .nav-auth-signout:hover,
.site-mobile-nav .nav-auth-signout:focus { color: var(--danger) !important; }

/* ── Mobile ── */
@media (max-width: 768px) {
  .site-nav { padding: 0 16px; gap: .75rem; }
  .site-nav-menu-btn { display: flex; }
  .nav-auth-identity { display: none; }
  .nav-auth-skeleton { display: none; }
  .site-nav-right > a { display: none; }
  .site-nav-section-link { display: none; }
  .site-nav-auth-link { display: none; }
}
