/* ═══════════════════════════════════════════════════════════════
   Patriot Forklifts — global header (desktop nav, Models mega menu, mobile nav)
   Single source for every page. Markup is stamped from specs/tools/partials/header.html
   by specs/tools/build_header.py — edit those, not individual pages.
   Colour/font variables (--gray-300, --red, ...) come from each page's :root.
   ═══════════════════════════════════════════════════════════════ */

.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 0.75rem 2rem;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  background: rgba(10, 22, 40, 0.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  transition: background 0.3s;
}
.nav.scrolled { background: rgba(10, 22, 40, 0.96); }
.nav-logo { grid-column: 2; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.nav-logo-img { height: 38px; width: auto; }

.nav-links-left,
.nav-links-right { display: flex; gap: 2rem; align-items: center; }
.nav-links-left { grid-column: 1; justify-content: flex-end; padding-right: 2.5rem; }
.nav-links-right { grid-column: 3; justify-content: flex-start; padding-left: 2.5rem; }
.nav-links-left a,
.nav-links-right a {
  color: var(--gray-300); text-decoration: none;
  font-family: 'Gotham', sans-serif; font-size: 0.82rem; font-weight: 500;
  letter-spacing: 0.05em; text-transform: uppercase; transition: color 0.2s;
}
.nav-links-left a:hover,
.nav-links-right a:hover,
.nav-links-left .active,
.nav-links-right .active { color: var(--white); }

.nav-cta {
  background: var(--red); color: var(--white); border: none;
  padding: 0.6rem 1.4rem; border-radius: 4px;
  font-family: 'Gotham', sans-serif; font-weight: 600; font-size: 0.82rem;
  cursor: pointer; text-decoration: none; letter-spacing: 0.03em; transition: background 0.2s;
}
.nav-links-right a.nav-cta,
.nav-links-right a.nav-cta.active { color: var(--white); }
.nav-cta:hover { background: var(--red-hover); }

/* ── Models trigger + mega menu ──
   Hover fix: the trigger's hover area is extended (padding/negative margin) down to the
   bottom of the nav bar, and the menu's ::before bridge covers the rest, so there is no
   dead gap between "Models" and the dropdown. Closing is delayed briefly so a diagonal or
   slow mouse move doesn't drop the menu, and it stays hoverable while it fades. */
.nav-models-trigger {
  position: relative; cursor: pointer;
  display: inline-block; padding: 1.25rem 0; margin: -1.25rem 0;
}
.nav-models-trigger::after {
  content: ''; display: inline-block; width: 0; height: 0;
  border-left: 3.5px solid transparent; border-right: 3.5px solid transparent;
  border-top: 4px solid currentColor; margin-left: 0.4rem; vertical-align: middle;
  transition: transform 0.2s;
}
.nav-models-trigger:hover::after,
.nav-models-trigger:focus-within::after { transform: rotate(180deg); }

.mega-menu {
  position: fixed; top: 60px; left: 50%; transform: translateX(-50%);
  width: 680px; max-width: calc(100vw - 2rem); padding: 1.75rem 2rem;
  background: rgba(10, 22, 40, 0.97);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.08);
  border-top: 2px solid var(--red);
  border-radius: 0 0 12px 12px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem;
  opacity: 0; visibility: hidden;
  /* close: wait 150ms, fade 200ms, then hide */
  transition: opacity 0.2s ease 0.15s, visibility 0s linear 0.35s;
  z-index: 200;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.nav-models-trigger:hover .mega-menu,
.nav-models-trigger:focus-within .mega-menu,
.mega-menu:hover {
  opacity: 1; visibility: visible;
  /* open: immediately */
  transition: opacity 0.2s ease 0s, visibility 0s linear 0s;
}
.mega-menu::before { content: ""; position: absolute; top: -20px; left: 0; right: 0; height: 20px; }
.mega-col-title {
  font-family: 'Gotham', sans-serif; font-size: 0.6rem; font-weight: 700;
  letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 0.75rem; padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(200,169,110,0.15);
}
.mega-link { display: block; padding: 0.45rem 0; text-decoration: none; transition: all 0.15s; }
.mega-link:hover,
.mega-link:focus-visible { padding-left: 0.3rem; }
.mega-link-model { font-family: 'Gotham', sans-serif; font-weight: 700; font-size: 0.85rem; color: var(--white); display: block; }
.mega-link:hover .mega-link-model,
.mega-link:focus-visible .mega-link-model { color: var(--gold); }
.mega-link-cap { font-family: 'MyriadPro', sans-serif; font-size: 0.72rem; color: var(--gray-500); }

/* ── Mobile nav ── */
.nav-mobile {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10, 22, 40, 0.98); backdrop-filter: blur(20px);
  z-index: 99; padding: 5rem 2rem 2rem; flex-direction: column; overflow-y: auto;
}
.nav-mobile.show { display: flex; }
.nav-mobile a {
  font-family: 'Gotham', sans-serif; color: var(--gray-300); text-decoration: none;
  font-size: 1rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 1rem 0; border-bottom: 1px solid rgba(255,255,255,0.06); display: block;
  transition: color 0.2s;
}
.nav-mobile a:hover { color: var(--white); }
.nav-mobile .nav-cta { margin-top: 1.5rem; text-align: center; display: block; padding: 1rem; border-radius: 4px; color: var(--white); }
.mobile-models-toggle {
  font-family: 'Gotham', sans-serif; color: var(--gray-300); background: none; border: none;
  width: 100%; text-align: left; font-size: 1rem; font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; padding: 1rem 0; border-bottom: 1px solid rgba(255,255,255,0.06);
  cursor: pointer; display: flex; justify-content: space-between; align-items: center;
}
.mobile-models-toggle::after { content: '+'; font-size: 1.2rem; color: var(--gray-500); transition: transform 0.2s; }
.mobile-models-toggle.open::after { content: '-'; }
.mobile-models-panel { display: none; padding: 0 0 0.5rem; }
.mobile-models-panel.show { display: block; }
.mobile-cat-title {
  font-family: 'Gotham', sans-serif; font-size: 0.65rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold);
  padding: 0.75rem 0 0.4rem; margin-top: 0.25rem;
}
.mobile-models-panel a { font-size: 0.9rem; font-weight: 500; padding: 0.6rem 0 0.6rem 0.75rem; border-bottom: none; }
.mobile-models-panel a span { font-weight: 400; color: var(--gray-500); font-size: 0.78rem; margin-left: 0.5rem; }

.nav-toggle {
  display: none; background: none; border: none; color: white; cursor: pointer;
  position: absolute; right: 1.5rem; top: 50%; transform: translateY(-50%);
}
.nav-toggle svg { width: 28px; height: 28px; }

@media (max-width: 768px) {
  .nav { display: flex; justify-content: center; }
  .nav-links-left, .nav-links-right { display: none; }
  .nav-logo-img { height: 32px; }
  .nav-toggle { display: block; }
  .mega-menu { display: none; }
}
