/* ════════════════════════════════════════════════════════════════════════
   Shared green-header nav (v3)
   Pairs with template-parts/template-custom-nav-v3.php.
   Load this AFTER a page's own stylesheet so these rules win by load order
   (selectors match the older per-page nav rules, same specificity).
   Green is inlined (rgba(68,214,44,1)) so it doesn't depend on a page :root.
   ════════════════════════════════════════════════════════════════════════ */

/* ── BURGER ───────────────────────────────── */
.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  z-index: 101;
}

.nav-burger span {
  display: block;
  width: 24px;
  height: 2px;
  background: white;
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

.nav-burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; }
.nav-burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── NAV ──────────────────────────────────── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(68, 214, 44, 1);
  backdrop-filter: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.45);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 60px;
  height: 96px;
}

/* WordPress admin bar offset for logged-in users */
.admin-bar nav { top: 32px; }
@media screen and (max-width: 782px) {
  .admin-bar nav { top: 46px; }
}

.nav-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.nav-logo img {
  height: 100% !important;
  max-height: 74px !important;
  width: auto;
  display: block;
}

.nav-logo-icon { display: none; }
.nav-logo-text { display: none; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 100%;
  list-style: none;
}

.nav-links > li {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
}

.nav-links > li > a {
  color: white;
  text-decoration: none;
  font-size: clamp(14px, calc(7.14px + 0.67vw), 20px);
  font-weight: 700;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 20px 0;
  cursor: pointer;
}

.nav-links > li > a:hover { color: white; }

/* Dropdown */
.nav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: -12px;
  background: rgba(68, 214, 44, 1);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  padding: 12px 0;
  width: max-content;
  min-width: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  z-index: 200;
  backface-visibility: hidden;
}

.nav-links > li:hover .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown a {
  display: block;
  padding: 8px 28px;
  font-size: clamp(12px, calc(7.43px + 0.45vw), 16px);
  font-weight: 700;
  color: white;
  text-decoration: none;
  transition: background-color 0.15s;
  background-color: transparent;
}

.nav-dropdown a:hover {
  background-color: rgba(255, 255, 255, 0.14);
}

.nav-cta {
  background: white;
  color: rgba(68, 214, 44, 1) !important;
  height: auto !important;
  padding: 11px 26px !important;
  border-radius: 8px;
  font-weight: 700 !important;
  font-size: clamp(14px, calc(7.14px + 0.67vw), 20px) !important;
  transition: background 0.2s, transform 0.2s !important;
  text-decoration: none;
  align-self: center;
}

.nav-cta:hover {
  background: white !important;
  transform: translateY(-1px);
}

/* ── MOBILE (≤960px) ──────────────────────── */
@media (max-width: 960px) {
  /* Lock page scroll while the mobile menu is open.
     body.nav-open covers pages whose JS sets that class (e.g. landing);
     body:has(.nav-links.open) covers pages whose nav JS only toggles
     .open on the menu itself. */
  body.nav-open,
  body:has(.nav-links.open) { overflow: hidden; }

  nav {
    height: 88px;
    padding: 0 24px;
  }

  .nav-logo img {
    height: 62px;
    max-height: 62px !important;
  }

  .nav-burger { display: flex; }

  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(68, 214, 44, 1);
    border-top: 1px solid rgba(255, 255, 255, 0.45);
    padding: 16px 24px 24px;
    gap: 0;
    height: auto;
    max-height: calc(100vh - 88px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 100;
  }

  .nav-links.open {
    display: flex;
    animation: navSlideDown 0.25s ease forwards;
  }

  @keyframes navSlideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .nav-links > li {
    display: block;
    height: auto;
    width: 100%;
    padding: 0; /* some pages (sgmom) add li padding that makes the menu taller */
  }

  .nav-links > li > a {
    color: white;
    font-size: 14px;
    height: auto;
    padding: 14px 0;
    width: 100%;
    border-bottom: none; /* override per-page v2 nav which adds a divider line */
  }

  .nav-links > li:last-child > a { border-bottom: none; }

  .nav-dropdown {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 0 0 8px 8px;
    padding: 4px 12px;
    margin: 0 0 8px; /* full reset — some pages add a left margin that misaligns the dropdown */
    width: auto;
  }

  .nav-dropdown a {
    font-size: 14px;
    color: white !important;
    padding: 10px 8px;
    border: none; /* override any per-page v2 dropdown divider */
  }
}

/* ── DESKTOP NAV GUARD (≥961px) ───────────── */
/* Re-assert the horizontal green nav so pages whose own CSS switches to a
   mobile/burger nav at a WIDER breakpoint (e.g. SGMOM at ≤1024px) don't leak
   mobile styles — absolute position, column, white bg — into the 961–1024px
   range. Harmless on pages that already show the desktop nav here. */
@media (min-width: 961px) {
  nav { padding: 0 60px; }

  .nav-burger { display: none; }

  .nav-links {
    display: flex;
    flex-direction: row;
    align-items: center;
    position: static;
    top: auto;
    left: auto;
    right: auto;
    gap: 32px;
    height: 100%;
    max-height: none;
    padding: 0;
    background: transparent;
    border-top: none;
    border-bottom: none;
    box-shadow: none;
    overflow: visible;
  }

  .nav-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    background: rgba(68, 214, 44, 1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    margin: 0;
  }

  .nav-links > li:hover .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
}

/* ── LARGE SCREENS (nav scaling only) ─────── */
@media (min-width: 1920px) {
  nav { height: 110px; }
  .nav-logo img { height: 84px; max-height: 84px !important; }
  .nav-links > li > a { font-size: clamp(20px, calc(8px + 0.625vw), 24px); }
  .nav-dropdown { top: calc(100% + 8px); }
  .nav-dropdown a { font-size: clamp(16px, calc(4px + 0.625vw), 20px); }
  .nav-cta { font-size: clamp(20px, calc(8px + 0.625vw), 24px) !important; }
}

@media (min-width: 2560px) {
  nav { height: 128px; }
  .nav-logo img { height: 98px; max-height: 98px !important; }
  .nav-links > li > a { font-size: clamp(24px, calc(12px + 0.469vw), 30px); }
  .nav-dropdown a { font-size: clamp(20px, calc(12px + 0.3125vw), 24px); }
  .nav-cta { font-size: clamp(24px, calc(12px + 0.469vw), 30px) !important; }
}

@media (min-width: 3840px) {
  nav { height: 150px; }
  .nav-logo img { height: 116px; max-height: 116px !important; }
  .nav-links > li > a { font-size: 30px; }
  .nav-dropdown a { font-size: 24px; }
  .nav-cta { font-size: 30px !important; }
}
