/**
 * ArmyFitnessTestCalculator.com - Navigation System CSS (nav.css)
 * Desktop nav, dropdowns, keyboard focus, active states,
 * sticky header, mobile toggle, breadcrumbs, skip link.
 */

/* ==========================================================================
   SKIP NAVIGATION (Accessibility)
   ========================================================================== */
.skip-nav-link {
  position: absolute;
  top: -100px;
  left: 8px;
  z-index: 200;
  background: var(--color-primary-dark);
  color: var(--color-accent-gold);
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  font-weight: 700;
  font-size: 0.875rem;
  text-decoration: none;
  transition: top 0.2s ease;
}

.skip-nav-link:focus {
  top: 0;
  outline: 2px solid var(--color-accent-gold);
  outline-offset: 2px;
}

/* ==========================================================================
   TACTICAL DISCLAIMER BANNER
   ========================================================================== */
.tactical-disclaimer-banner {
  background-color: #0a0f0b;
  color: rgba(255, 184, 0, 0.75);
  font-size: 0.78125rem;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 184, 0, 0.15);
  text-align: center;
  line-height: 1.4;
}

.tactical-disclaimer-banner strong {
  color: var(--color-accent-gold);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ==========================================================================
   SITE HEADER
   ========================================================================== */
.site-header {
  background-color: #181818;
  border-bottom: 1px solid #2a2a2a;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 0 rgba(255,184,0,0.08), 0 4px 16px rgba(0,0,0,0.4);
  transition: box-shadow 0.2s ease;
}

.site-header.scrolled {
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(255,184,0,0.12);
}

.nav-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: var(--space-4);
}

/* ==========================================================================
   BRAND LOGO
   ========================================================================== */
.brand-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  flex-shrink: 0;
  outline-offset: 3px;
}

.brand-wordmark {
  font-size: 1.1875rem;
  font-weight: 800;
  color: #F5F5F5;
  letter-spacing: -0.02em;
  line-height: 1;
  white-space: nowrap;
}

.brand-wordmark .accent {
  color: var(--color-accent-gold);
}

/* ==========================================================================
   DESKTOP PRIMARY NAVIGATION
   ========================================================================== */
.primary-nav { flex: 1; display: flex; justify-content: flex-end; }

.main-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Nav Item */
.nav-item { position: relative; }

/* Nav Link (both <a> and <button> variants) */
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #C0C0C0;
  border-radius: var(--radius-md);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
  font-family: inherit;
}

.nav-link:hover {
  background: rgba(255, 184, 0, 0.08);
  color: #F5F5F5;
}

.nav-link.active,
.nav-link[aria-current="page"] {
  color: var(--color-accent-gold);
  background: rgba(255, 184, 0, 0.1);
  font-weight: 700;
}

/* Active underline indicator */
.nav-link.active::after,
.nav-link[aria-current="page"]::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 12px;
  right: 12px;
  height: 2px;
  background: var(--color-accent-gold);
  border-radius: var(--radius-full);
}

/* ==========================================================================
   DROPDOWN MENUS — Hover gap fix via padding bridge
   ========================================================================== */
.nav-link-dropdown {
  position: relative;
}

.dropdown-chevron {
  transition: transform 0.2s ease;
  color: #666;
}

.nav-link-dropdown[aria-expanded="true"] .dropdown-chevron,
.has-dropdown.dropdown-open > .nav-link-dropdown .dropdown-chevron {
  transform: rotate(180deg);
  color: var(--color-accent-gold);
}

/* The dropdown is positioned directly at top:100% (no gap).
   Padding-top on the dropdown itself bridges the visual gap
   so the mouse never leaves the hover zone. */
.nav-dropdown {
  display: block;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  position: absolute;
  top: 100%;          /* flush to button — no gap */
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  min-width: 260px;
  background: #1E1E1E;
  border: 1px solid #333;
  border-top: 2px solid var(--color-accent-gold);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.3);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 8px 0 8px;
  padding-top: 14px;  /* visual breathing room + hover bridge */
  list-style: none;
  z-index: 100;
  transition: opacity 0.18s ease, visibility 0.18s ease, transform 0.18s ease;
}

/* Keep dropdown right-aligned when near right edge */
.nav-item:last-child .nav-dropdown,
.nav-item:nth-last-child(2) .nav-dropdown {
  left: auto;
  right: 0;
  transform: translateY(-4px);
}

/*
 * Show dropdown only when the shared navigation controller opens it.
 *
 * The previous desktop :hover rule immediately reopened a menu after a
 * submenu navigation because the pointer remained over the same screen
 * coordinates while the destination page loaded.  Explicit state also keeps
 * mouse, keyboard and touch behaviour consistent.
 */
.has-dropdown.dropdown-open .nav-dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.nav-item:last-child .nav-dropdown,
.nav-item:nth-last-child(2) .nav-dropdown {
  transform: translateY(-4px);
}

.nav-item:last-child.dropdown-open .nav-dropdown,
.nav-item:nth-last-child(2).dropdown-open .nav-dropdown {
  transform: translateY(0);
}

/* Dropdown links */
.nav-dropdown-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 9px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #B0B0B0;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease, padding-left 0.12s ease;
  border-left: 3px solid transparent;
}

.nav-dropdown-link:hover {
  background-color: rgba(255, 184, 0, 0.08);
  color: #F5F5F5;
  padding-left: 20px;
  border-left-color: var(--color-accent-gold);
}

.nav-dropdown-link.active {
  background-color: rgba(255, 184, 0, 0.1);
  color: var(--color-accent-gold);
  font-weight: 700;
  border-left-color: var(--color-accent-gold);
  padding-left: 20px;
}

.nav-dropdown-icon {
  width: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-dropdown-link:hover .nav-dropdown-icon,
.nav-dropdown-link.active .nav-dropdown-icon {
  opacity: 1;
}

/* ==========================================================================
   MOBILE TOGGLE BUTTON
   ========================================================================== */
.mobile-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: 1px solid #333;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: #C0C0C0;
  flex-shrink: 0;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.mobile-nav-toggle:hover {
  border-color: var(--color-accent-gold);
  background: rgba(255, 184, 0, 0.08);
  color: var(--color-accent-gold);
}

.mobile-nav-toggle[aria-expanded="true"] {
  border-color: var(--color-accent-gold);
  background: rgba(255, 184, 0, 0.1);
  color: var(--color-accent-gold);
}

/* ==========================================================================
   BREADCRUMBS
   ========================================================================== */
.breadcrumb-section {
  background: #1a1a1a;
  border-bottom: 1px solid #2a2a2a;
  padding: var(--space-3) 0;
}

.breadcrumb-nav { }

.breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.8125rem;
}

.breadcrumb-item a {
  color: #777;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

.breadcrumb-item a:hover {
  color: var(--color-accent-gold);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.breadcrumb-sep {
  color: #444;
  font-size: 0.75rem;
  user-select: none;
  padding: 0 2px;
}

.breadcrumb-item.current {
  color: #B0B0B0;
  font-weight: 600;
}

/* ==========================================================================
   KEYBOARD / FOCUS STYLES (Navigation specific)
   ========================================================================== */
.nav-link:focus-visible,
.nav-dropdown-link:focus-visible {
  outline: 2px solid var(--color-accent-gold);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 1024px) {
  .nav-link {
    font-size: 0.8125rem;
    padding: 6px 8px;
  }
}

@media (max-width: 900px) {
  .main-nav { display: none !important; }
  .mobile-nav-toggle { display: flex; }
  .primary-nav { justify-content: flex-end; }
}

/* ==========================================================================
   PRINT
   ========================================================================== */
@media print {
  .tactical-disclaimer-banner,
  .site-header,
  .breadcrumb-section { display: none !important; }
}
