/* ─────────────────────────────────────────────────────────────
   eqctrl shared site nav — single source of truth
   Each page imports this file. Structure, spacing, breakpoints,
   and behavior all live here so adding a new page = copy-paste
   mount point + include this CSS + site-nav.js. No per-page
   nav styling needed.
   ───────────────────────────────────────────────────────────── */

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  /* Cross-browser tap-event correctness */
  pointer-events: auto;
  -webkit-tap-highlight-color: rgba(196, 181, 253, 0.25);
  touch-action: manipulation;
}

/* Fixed overlay variant (landing page — on top of a canvas) */
.site-nav.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  isolation: isolate;
  background: linear-gradient(to bottom, rgba(13, 17, 23, 0.82) 0%, rgba(13, 17, 23, 0.55) 60%, rgba(13, 17, 23, 0) 100%);
}

/* Inline variant (article-type pages) — spans full viewport width so the
   home logo sits at the same distance from the viewport edge as the overlay
   variant. Pages put the mount at body level (not inside a max-width wrapper)
   for this to hold. */
.site-nav.inline {
  border-bottom: 1px solid rgba(240, 246, 252, 0.08);
  margin: 0 0 24px;
  max-width: none;
}

/* Left cluster: logo + center links */
.site-nav-left {
  display: flex;
  align-items: center;
  gap: 28px;
  min-width: 0;
}

/* Home link (logo + wordmark) — identical placement on every page */
.site-nav-home {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 10px;
  transition: background 0.2s ease;
  pointer-events: auto;
}
.site-nav-home:hover { background: rgba(255, 255, 255, 0.05); }
.site-nav-home:active { background: rgba(255, 255, 255, 0.09); }

.site-nav-home .logo-mark {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: linear-gradient(135deg, #8B5CF6, #40916C);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 600;
  font-size: 11px;
  color: white;
  letter-spacing: 0;
  flex-shrink: 0;
}
.site-nav-home .wordmark {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(240, 246, 252, 0.78);
  white-space: nowrap;
}
.site-nav-home .wordmark-sep {
  color: rgba(240, 246, 252, 0.45);
}

/* Center links (page destinations) */
.site-nav-links {
  display: flex;
  gap: 22px;
  align-items: center;
}
.site-nav-links a {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  color: rgba(240, 246, 252, 0.7);
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease;
  letter-spacing: 0.02em;
  padding: 8px 10px;
  border-radius: 6px;
  white-space: nowrap;
}
.site-nav-links a:hover {
  color: rgba(240, 246, 252, 0.95);
  background: rgba(255, 255, 255, 0.04);
}
/* Active page indicator */
.site-nav-links a.site-nav-active {
  color: rgba(240, 246, 252, 0.95);
  background: rgba(196, 181, 253, 0.1);
}

/* Right cluster: mail + login */
.site-nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.site-nav-mail {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 32px;
  color: rgba(240, 246, 252, 0.7);
  border: 1px solid rgba(240, 246, 252, 0.15);
  border-radius: 7px;
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.site-nav-mail:hover {
  color: rgba(240, 246, 252, 0.95);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(240, 246, 252, 0.28);
}
.site-nav-login {
  display: inline-flex;
  align-items: center;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: rgba(240, 246, 252, 0.92);
  text-decoration: none;
  padding: 7px 14px;
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 7px;
  background: rgba(139, 92, 246, 0.12);
  transition: background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.site-nav-login:hover {
  background: rgba(139, 92, 246, 0.22);
  border-color: rgba(139, 92, 246, 0.55);
}

/* Mount-point reserves vertical space so late-injected nav doesn't
   cause layout shift. Overlay variant doesn't occupy flow so no reservation. */
#site-nav:not(:has(.site-nav.overlay)) {
  min-height: 62px;
}

/* Mobile breakpoints */
@media (max-width: 720px) {
  .site-nav { padding: 12px 18px; gap: 12px; }
  .site-nav-left { gap: 18px; }
  .site-nav-links a { font-size: 12px; padding: 7px 8px; }
}

@media (max-width: 640px) {
  .site-nav { padding: 10px 14px; gap: 10px; }
  .site-nav-home { padding: 6px 8px; }
  .site-nav-home .wordmark { display: none; }
  .site-nav-home .logo-mark { width: 34px; height: 34px; font-size: 13px; }
  /* Center links redundant on mobile — body CTAs + footer cover those links */
  .site-nav-links { display: none; }
  .site-nav-right { gap: 8px; }
  .site-nav-mail { width: 40px; height: 40px; }
  /* Hide login on mobile — dashboard is desktop-only, and iOS Safari
     downloads the Basic Auth 401 response instead of prompting. */
  .site-nav-login { display: none; }
}

/* Coarse-pointer global tap targets */
@media (pointer: coarse) {
  .site-nav-links a,
  .site-nav-mail,
  .site-nav-login,
  .site-nav-home { min-height: 44px; }
}

/* prefers-reduced-motion: disable nav transitions */
@media (prefers-reduced-motion: reduce) {
  .site-nav-home,
  .site-nav-links a,
  .site-nav-mail,
  .site-nav-login {
    transition: none;
  }
}
