/* ========================================
   Menu dropdown (reusable for any nav item)
   ======================================== */

/* Gentle Slide Down Animation Keyframes */
@keyframes slideDown {
  0% {
    opacity: 0;
    transform: translateY(-8px) scaleY(0.95);
  }
  60% {
    opacity: 0.9;
  }
  100% {
    opacity: 1;
    transform: translateY(0) scaleY(1);
  }
}

/* Allow dropdown to extend below the green nav bar */
header .main,
header .main .wrapper,
header .main nav.primary,
header .main nav.primary > ul.menu {
  overflow: visible;
}

/* Sticky menu: only unlock overflow when it is actually visible */
html.scrolled.up header .top-menu {
  overflow: visible;
}

header .main nav.primary > ul.menu > li.has-dropdown,
header .top-menu nav.primary > ul.menu > li.has-dropdown {
  position: relative;
  height: 100%;
  display: flex;
  align-items: stretch;
}

header .main nav.primary > ul.menu > li.has-dropdown > a,
header .top-menu nav.primary > ul.menu > li.has-dropdown > a {
  display: flex;
  align-items: center;
}

header .main nav.primary > ul.menu > li.has-dropdown:hover > a,
header .main nav.primary > ul.menu > li.has-dropdown:focus-within > a,
header .top-menu nav.primary > ul.menu > li.has-dropdown:hover > a,
header .top-menu nav.primary > ul.menu > li.has-dropdown:focus-within > a {
  background-color: #fff;
  color: #2c2a29;
}

header .main nav.primary .dropdown,
header .top-menu nav.primary .dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 280px;
  margin: 0;
  padding: 0;
  list-style: none;
  background-color: #fff;
  box-shadow: 0 8px 24px rgba(44, 42, 41, 0.12);
  z-index: 1100;
  height: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
  transform-origin: top center;
  flex-direction: column;
}

header .main nav.primary > ul.menu > li.has-dropdown:hover > .dropdown,
header .main nav.primary > ul.menu > li.has-dropdown:focus-within > .dropdown,
header .top-menu nav.primary > ul.menu > li.has-dropdown:hover > .dropdown,
header
  .top-menu
  nav.primary
  > ul.menu
  > li.has-dropdown:focus-within
  > .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  animation: slideDown 0.25s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
}

header .main nav.primary .dropdown li,
header .top-menu nav.primary .dropdown li {
  width: 100%;
  display: block;
}

header .main nav.primary .dropdown a,
header .top-menu nav.primary .dropdown a {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 15px 25px;
  color: #58595b;
  background-color: transparent;
  font-size: 16px;
  line-height: 1.35;
  text-decoration: none;
  white-space: nowrap;
  box-sizing: border-box;
  transition:
    background-color 0.25s ease,
    color 0.25s ease;
}

header .main nav.primary .dropdown a .icon,
header .top-menu nav.primary .dropdown a .icon {
  width: 20px;
  flex-shrink: 0;
  text-align: center;
  font-size: 16px;
  color: #52a382;
  padding: 0;
  transition: color 0.25s ease;
}

header .main nav.primary .dropdown a.active,
header .main nav.primary .dropdown a:hover,
header .main nav.primary .dropdown a:focus,
header .top-menu nav.primary .dropdown a:hover,
header .top-menu nav.primary .dropdown a:focus {
  background-color: #eaf2ea;
  color: #52a382;
}

header .main nav.primary .dropdown a:hover .icon,
header .main nav.primary .dropdown a:focus .icon,
header .top-menu nav.primary .dropdown a:hover .icon,
header .top-menu nav.primary .dropdown a:focus .icon {
  color: #52a382;
}

@media (max-width: 767px) {
  header .main nav.primary .dropdown,
  header .top-menu nav.primary .dropdown {
    display: none !important;
  }
}

/* ========================================
   Mobile menu submenu
   ======================================== */

.mobile-menu.right {
  text-align: left;
}

.mobile-menu .parent.show-sub .submenu {
  background-color: #fff;
  box-shadow: -2px 0 25px rgba(0, 0, 0, 0.15);
}

.mobile-menu:has(.parent.show-sub) .close-container {
  background-color: transparent;
  border-bottom: none;
}

.mobile-menu:has(.parent.show-sub) .close-button {
  color: #52a382;
}

.mobile-menu:has(.parent.show-sub) .close-button:hover {
  color: #3d8a6a;
}

.mobile-menu .show-sub .submenu .title {
  left: 0;
  right: auto;
  width: 100%;
  height: 60px;
  padding: 0 60px 0 20px;
  color: #52a382;
  text-align: left;
  gap: 8px;
  border-bottom: 1px solid #e0e0e0;
  box-sizing: border-box;
}

.mobile-menu .show-sub .submenu .title .back-icon {
  position: static;
  transform: none;
  width: auto;
  margin: 0;
  font-size: 14px;
}

.mobile-menu .submenu a {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #52a382;
  padding: 10px 10px 10px 15px;
}

.mobile-menu .submenu a .icon {
  position: static;
  transform: none;
  right: auto;
  top: auto;
  margin: 0;
  width: 20px;
  flex-shrink: 0;
  text-align: center;
  font-size: 16px;
  color: #52a382;
}

.mobile-menu .submenu li {
  border-top: 1px solid rgba(0, 0, 0, 0.2);
}

.mobile-menu .submenu li:first-child {
  border-top: none;
}

.mobile-menu .parent.show-sub .submenu a.active,
.mobile-menu .parent.show-sub .submenu a:hover,
.mobile-menu .parent.show-sub .submenu a:focus {
  background-color: #eaf2ea;
  color: #52a382;
}

.mobile-menu .submenu a.active {
  background-color: transparent;
  color: #52a382;
}
