/* ============================================================
   SkyMow Primary Navigation — nav.css
   Shared across all pages. Loaded via <link rel="stylesheet" href="/nav.css">
   ============================================================ */

/* ---- Reset / Base ---------------------------------------- */
#main-nav *,
#main-nav *::before,
#main-nav *::after {
  box-sizing: border-box;
}

/* ---- Nav Container --------------------------------------- */
#main-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 64px;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 3rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(245, 241, 235, 0.92);
  border-bottom: 1px solid rgba(26, 58, 42, 0.1);
}

/* ---- Logo ------------------------------------------------ */
.nav-logo {
  text-decoration: none;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.nav-logo img {
  display: block;
  height: 32px;
  width: auto;
}

/* ---- Desktop Nav Links ----------------------------------- */
.nav-links {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0;
}

.nav-links > li {
  position: relative;
}

.nav-links > li > a {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: #2d3748;
  text-decoration: none;
  padding: 0 0.85rem;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  white-space: nowrap;
  transition: color 0.15s ease;
  border-bottom: 2px solid transparent;
}

.nav-links > li > a:hover {
  color: #2d6a4f;
}

/* Active state */
.nav-links > li > a.nav-active {
  color: #2d6a4f;
  border-bottom-color: #40916c;
  font-weight: 600;
}

/* Caret icon */
.nav-caret {
  font-size: 0.65rem;
  line-height: 1;
  opacity: 0.6;
  transition: transform 0.2s ease;
  display: inline-block;
}

.nav-links > li.has-dropdown:hover .nav-caret {
  transform: rotate(180deg);
}

/* ---- Dropdown -------------------------------------------- */
.nav-dropdown {
  position: absolute;
  top: calc(100% + 0px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 220px;
  background: #fff;
  border: 1px solid rgba(26, 58, 42, 0.12);
  border-radius: 10px;
  padding: 0.5rem 0;
  box-shadow: 0 8px 32px rgba(26, 58, 42, 0.12), 0 2px 8px rgba(0,0,0,0.06);
  list-style: none;
  margin: 0;

  /* Hidden by default */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-50%) translateY(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

/* Show on hover */
.nav-links > li.has-dropdown:hover .nav-dropdown,
.nav-links > li.has-dropdown:focus-within .nav-dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* Triangle arrow pointing up */
.nav-dropdown::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 6px;
  background: #fff;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  border-top: none;
}

.nav-dropdown a {
  display: block;
  padding: 0.6rem 1.1rem;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
  color: #2d3748;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}

.nav-dropdown a:hover {
  background: #f0faf4;
  color: #2d6a4f;
}

/* ---- Hamburger Button ------------------------------------ */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.15s;
}

.nav-hamburger:hover {
  background: rgba(26, 58, 42, 0.08);
}

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #1a3a2a;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
  transform-origin: center;
}

/* Hamburger → X animation */
.nav-hamburger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-hamburger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.nav-hamburger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---- Mobile Overlay Menu --------------------------------- */
#mobile-menu {
  display: none;
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  background: rgba(245, 241, 235, 0.98);
  overflow-y: auto;
  padding: 1rem 0 2rem;
  transform: translateY(-8px);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

#mobile-menu.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.mobile-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mobile-nav-list > li {
  border-bottom: 1px solid rgba(26, 58, 42, 0.08);
}

.mobile-nav-list > li > a,
.mobile-nav-item-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: #1a3a2a;
  text-decoration: none;
  background: none;
  border: none;
  width: 100%;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}

.mobile-nav-list > li > a:hover,
.mobile-nav-item-toggle:hover {
  background: rgba(26, 58, 42, 0.04);
}

.mobile-nav-item-toggle .mobile-caret {
  font-size: 0.75rem;
  opacity: 0.5;
  transition: transform 0.2s ease;
}

.mobile-nav-item-toggle[aria-expanded="true"] .mobile-caret {
  transform: rotate(180deg);
}

.mobile-submenu {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0 0 0.5rem;
  background: rgba(245, 241, 235, 0.6);
}

.mobile-submenu.open {
  display: block;
}

.mobile-submenu li a {
  display: block;
  padding: 0.7rem 2.5rem;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.9rem;
  font-weight: 400;
  color: #2d6a4f;
  text-decoration: none;
  transition: background 0.12s;
}

.mobile-submenu li a:hover {
  background: rgba(45, 106, 79, 0.06);
}

/* ---- Responsive: Show hamburger at 768px --------------- */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .nav-hamburger {
    display: flex;
  }

  #mobile-menu {
    display: block;
  }
}

/* ---- Body offset: add .nav-offset to body on pages that need it --- */
body.nav-offset {
  padding-top: 64px;
}

/* ---- Skip to main content link (keyboard / screen reader accessibility) --- */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 9999;
  background: #1a3a2a;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: 0 0 8px 8px;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid #74c69d;
  outline-offset: 2px;
}

/* ---- Visible focus indicators for all interactive elements ----------- */
a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #40916c;
  outline-offset: 2px;
  border-radius: 3px;
}

/* Nav-specific focus styles */
.nav-links > li > a:focus-visible {
  outline: 3px solid #40916c;
  outline-offset: 2px;
  border-radius: 3px;
}

.nav-dropdown a:focus-visible {
  outline: 3px solid #40916c;
  outline-offset: -2px;
  border-radius: 3px;
  background: #f0faf4;
}
