/* ── Shared site navigation ─────────────────────────────────────────────── */
/* Loaded after theme.css on every page. Overrides any page-specific nav CSS. */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--navy-mid);
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
}
.nav-logo img {
  display: block;
  opacity: 0.92;
  transition: opacity 0.15s;
  max-width: 180px;
  height: auto;
}
.nav-logo:hover img { opacity: 1; }
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-links a {
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 6px 11px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
  text-transform: none;
}
.nav-links a:hover { color: var(--cream); background: rgba(255,255,255,0.05); }
.nav-links a.active { color: var(--amber-light); }
.nav-links a.nav-login {
  color: var(--amber-light);
  border: 1px solid rgba(27,108,168,0.25);
  padding: 5px 10px;
  border-radius: var(--radius);
}
.nav-links a.nav-login:hover { background: rgba(27,108,168,0.1); color: var(--amber-light); }
.nav-links a.nav-cta {
  background: var(--amber);
  color: var(--navy);
  font-weight: 600;
  margin-left: 8px;
}
.nav-links a.nav-cta:hover { background: var(--amber-light); color: var(--navy); }
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-muted);
  border-radius: 1px;
  transition: all 0.2s;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 820px) {
  .nav-hamburger { display: flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: 58px;
    left: 0;
    right: 0;
    background: var(--navy-mid);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 12px 20px calc(20px + env(safe-area-inset-bottom, 0px));
    gap: 2px;
    /* Scroll the menu when it taller than the viewport — at large
       text-size / 200% zoom the menu items overflow on small screens
       and were previously unreachable. The header is sticky-pinned at
       the top so the available height is viewport minus 58px. */
    max-height: calc(100vh - 58px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 11px 12px; font-size: 14px; }
  .nav-links a.nav-login { border: none; padding: 11px 12px; }
  .nav-links a.nav-cta { margin-left: 0; margin-top: 8px; text-align: center; }
}
@media (max-width: 1100px) and (min-width: 821px) {
  .nav-links { gap: 2px; }
  .nav-links a { padding: 5px 8px; font-size: 11px; }
  .nav-links a.nav-cta { margin-left: 4px; padding: 5px 10px; }
}
@media (max-width: 960px) and (min-width: 821px) {
  .nav-links a { padding: 5px 6px; font-size: 10px; letter-spacing: 0.02em; }
}
@media (max-width: 480px) {
  .nav-inner { padding: 0 16px; }
}

/* ── Secondary (sub) nav ─────────────────────────────────────────────────── */
.sub-nav {
  background: var(--navy-mid);
  border-bottom: 1px solid var(--border);
}
.sub-nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
  height: 36px;
}
.sub-nav a {
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
}
.sub-nav a:hover { color: var(--cream); text-decoration: none; }
#sub-nav-signout:hover { color: #E05C3A; }
.sub-nav a.sub-nav-active { font-weight: 700; color: var(--cream); }
html[data-theme="light"] .sub-nav a.sub-nav-active { color: var(--text-primary); }
.sub-nav-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  margin-left: 5px;
  border-radius: 2px;
  background: rgba(27,108,168,0.18);
  color: var(--amber-light);
  vertical-align: middle;
  text-transform: none;
}
@media (max-width: 820px) { .sub-nav { display: none !important; } }

/* ── Light mode overrides ───────────────────────────────────────────────── */
html[data-theme="light"] .nav-links a { color: var(--text-muted); }
html[data-theme="light"] .nav-links a:hover {
  color: var(--text-primary);
  background: rgba(44,34,24,0.05);
}
html[data-theme="light"] .nav-links a.active { color: var(--accent); }
html[data-theme="light"] .nav-links a.nav-login {
  color: var(--accent);
  border-color: var(--border-standard);
}
html[data-theme="light"] .nav-links a.nav-login:hover { background: rgba(44,34,24,0.05); }
html[data-theme="light"] .nav-links a.nav-cta { background: var(--accent); color: #fff; }
html[data-theme="light"] .nav-links a.nav-cta:hover { background: var(--accent-hover); color: #fff; }
html[data-theme="light"] .nav-hamburger span { background: var(--text-muted); }
html[data-theme="light"] .nav-links {
  background: var(--bg-secondary);
  border-bottom-color: var(--border-subtle);
}
html[data-theme="light"] .sub-nav { background: var(--bg-secondary); border-bottom-color: var(--border-subtle); }
html[data-theme="light"] .sub-nav a { color: var(--text-muted); }
html[data-theme="light"] .sub-nav a:hover { color: var(--text-primary); }
html[data-theme="light"] .sub-nav-badge { background: rgba(27,108,168,0.12); }
