/* ── Navigation ── */
#nav {
  position: sticky; top: 0; z-index: 300;
  background: rgba(11,21,37,.97);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255,255,255,.07);
  height: 60px; display: flex; align-items: center;
  transition: box-shadow var(--t-base);
  overflow: visible; /* must be visible so avatar dropdown can render below nav */
  max-width: 100vw;
}
#nav.scrolled { box-shadow: 0 4px 24px rgba(0,0,0,.35); }

.nav-inner {
  display: flex; align-items: center;
  justify-content: space-between; width: 100%; gap: 10px;
}

.nav-logo {
  font-size: 1.15rem; font-weight: 700; letter-spacing: -.03em;
  color: #fff; cursor: pointer; display: flex; align-items: center;
  gap: 10px; flex-shrink: 0; font-family: var(--font-display);
  background: none; border: none; padding: 0;
  transition: opacity var(--t-fast);
}
.nav-logo:hover { opacity: .85; }

.logo-mark {
  width: 28px; height: 28px; background: var(--accent);
  border-radius: 7px; display: flex; align-items: center;
  justify-content: center; color: #fff; font-size: .75rem;
  font-weight: 700; font-family: var(--font-display);
  box-shadow: 0 2px 8px rgba(249,115,22,.4);
}
.logo-wordmark {
  display: flex; flex-direction: column; gap: 0; line-height: 1;
  font-family: 'Barlow Condensed','Arial Narrow',var(--font-display),sans-serif;
}
.logo-wordmark-tmp { font-size: 1.2rem; font-weight: 700; color: #fff; letter-spacing: .01em; line-height: 1; }
.logo-hub { display: block; font-size: .65rem; font-weight: 600; color: var(--accent); letter-spacing: .2em; margin-top: 1px; font-family: var(--font-display); }

.nav-links { display: flex; align-items: center; gap: 1px; }
.nav-link {
  padding: 6px 12px; border-radius: var(--rxs); font-size: .85rem;
  font-weight: 500; color: rgba(255,255,255,.65); cursor: pointer;
  border: none; background: none;
  transition: background var(--t-fast), color var(--t-fast);
  font-family: var(--font); position: relative;
}
.nav-link::after {
  content: ''; position: absolute; bottom: -2px; left: 12px; right: 12px;
  height: 2px; background: var(--accent); border-radius: 2px;
  transform: scaleX(0);
  transition: transform var(--t-base) var(--ease-out);
  transform-origin: center;
}
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
/* Active state — works with both JS .active class and aria-current */
.nav-link.active,
.nav-link[aria-current="page"] { color: #fff; }
.nav-link.active::after,
.nav-link[aria-current="page"]::after { transform: scaleX(1); }
.nav-link:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: var(--rxs); }

.nav-actions { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }

.nav-avatar {
  width: 38px; height: 38px; min-width: 38px; min-height: 38px;
  background: var(--accent); color: #fff;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; cursor: pointer; position: relative;
  flex-shrink: 0; font-family: var(--font-display);
  transition: transform var(--t-fast), box-shadow var(--t-fast), border-color var(--t-fast);
  border: 2.5px solid rgba(249,115,22,.45);
  overflow: hidden;
  padding: 0;
}
.nav-avatar:hover {
  transform: scale(1.08);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(249,115,22,.18), 0 2px 12px rgba(249,115,22,.35);
}
/* Photo fills the circle perfectly */
.nav-avatar img {
  width: 100%; height: 100%;
  object-fit: cover; border-radius: 50%; display: block;
}
/* Online dot */
#nav-avatar-wrap::after {
  content: '';
  position: absolute; bottom: 0; right: 0;
  width: 10px; height: 10px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #0b1525;
  pointer-events: none;
}

.avatar-menu {
  position: absolute; top: calc(100% + 10px); right: 0;
  background: var(--navy-mid); border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--r); box-shadow: var(--shadow-lg);
  min-width: 175px; padding: 5px; z-index: 400;
  opacity: 0; transform: translateY(-6px) scale(.97);
  pointer-events: none;
  transition: opacity var(--t-base) var(--ease-out), transform var(--t-base) var(--ease-out);
}
.avatar-menu.open { opacity: 1; transform: none; pointer-events: auto; }
.avatar-menu a, .avatar-menu a.am-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 11px; font-size: .83rem;
  color: rgba(255,255,255,.8); cursor: pointer; border-radius: var(--rxs);
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
}
.avatar-menu a:hover, .avatar-menu a.am-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.avatar-menu .div { height: 1px; background: rgba(255,255,255,.1); margin: 4px 0; }

.hamburger {
  display: none; flex-direction: column; gap: 4px; cursor: pointer;
  padding: 7px; border: none; background: none;
  transition: opacity var(--t-fast);
  min-width: 44px; min-height: 44px; align-items: center; justify-content: center;
}
.hamburger:hover { opacity: .75; }
.hamburger span {
  display: block; width: 19px; height: 2px; background: rgba(255,255,255,.8);
  border-radius: 2px;
  transition: transform var(--t-base) var(--ease-out), opacity var(--t-fast);
}

.mob-menu {
  display: none; position: fixed; inset: 0; top: 60px;
  background: var(--navy); z-index: 250; padding: 16px;
  flex-direction: column; gap: 3px;
  border-top: 1px solid rgba(255,255,255,.08);
  overflow-y: auto; max-height: calc(100vh - 60px);
  animation: slideDown var(--t-base) var(--ease-out);
}
.mob-menu.open { display: flex; }
.mob-menu .nav-link {
  font-size: .97rem; padding: 13px 14px; border-radius: var(--rsm);
  width: 100%; text-align: left; min-height: 44px; color: rgba(255,255,255,.8);
}

/* ── Scroll progress bar ── */
.scroll-progress {
  position: fixed; top: 60px; left: 0; right: 0; height: 2px;
  z-index: var(--z-nav, 300); pointer-events: none;
  background: rgba(255,255,255,.06);
}
.scroll-progress::after {
  content: ''; position: absolute; inset-block: 0; left: 0;
  width: var(--p, 0%); background: var(--accent);
  box-shadow: 0 0 10px rgba(249,115,22,.7), 0 0 2px rgba(249,115,22,.5);
  transition: width 80ms linear;
}

/* ── SPA View switching ── */
#main-content { overflow-x: hidden; width: 100%; }
.view { display: none; }
.view.active { display: block; width: 100%; animation: viewEnter 280ms var(--ease-out) both; }

/* ── Responsive nav ── */
@media (max-width: 960px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
  #nav-login-btn { display: none !important; }
  /* Mobile nav: logo + hamburger only — CTA lives in the dropdown menu */
  .nav-actions .btn-primary { display: none !important; }

  /* Fixed nav on mobile so it stays visible while scrolling */
  #nav {
    position: fixed;
    top: 0; left: 0; right: 0;
  }
  /* Offset page content so it doesn't hide under the fixed nav */
  #main-content { padding-top: 60px; }
}
