#masthead {
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 10000;
}

#masthead .primary-menu {
  /* display: flex; */
  /* justify-content: space-between; */
  /* align-items: center; */
  display: grid;
  grid-template-columns: 1fr auto auto;
  box-shadow: none;
  transition: box-shadow 0.3s ease-out;
}

#masthead.scrolled .primary-menu {
  box-shadow: #00000021 1px 1px 4px;
}

#masthead .navbar-brand {
  display: flex;
  align-items: center;
  margin-left: 60px;
}

#masthead .header-logo {
  height: 80px;
  width: auto;
  margin-right: 14px;
}

#masthead .navbar-name {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.05em;
  color: var(--blue-md);
  margin-bottom: 0;
}

#masthead .primary-menu__menu {
  display: flex;
  margin-right: 45px;
}

#masthead .primary-menu__menu .menu {
  display: flex;
  gap: 30px;
}

#masthead .primary-menu__menu .menu-item {
  position: relative;
  height: 144px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
  font-weight: 800;
  text-transform: capitalize;
  letter-spacing: -0.05em;
  gap: 2px;
}

#masthead .primary-menu__menu .menu-item.current-menu-ancestor a {
  color: var(--blue-md);
}

#masthead .primary-menu__menu .menu-item.current-menu-ancestor .sub-menu a {
  color: var(--white);
}

#masthead .primary-menu__menu .menu-item a:hover {
  color: var(--purple-dk);
}

#masthead .primary-menu__buttons {
  position: relative;
  display: flex;
  align-self: center;
  margin-right: 40px;
  opacity: 1;
  transition: opacity 0.3s ease-out;
}

#masthead .primary-menu__buttons.mobile {
  display: none;
}

#masthead .arrow-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-left: 3px;
  margin-top: 5px;
  border-radius: 3px;
  padding: 2px;
  background: var(--purple-t);
  transition: background 0.3s ease-in-out;
}

#masthead .menu-item-has-children .icon.slider-arrow {
  color: var(--purple-dk);
  font-size: 11px;
  transform: rotate(90deg);
  align-self: center;
  justify-self: center;
  transition: transform 0.3s ease-in-out, color 0.3s ease-in-out;
}

#masthead .menu-item-has-children .sub-menu {
  position: absolute;
  z-index: -1;
  max-height: 0;
  overflow: hidden;
  top: 100%;
  left: 50%;
  width: 220px;
  transform: translateX(-50%);
  background: var(--purple-dk);
  display: flex;
  box-shadow: 0px 3px 6px #00000029;
  flex-direction: column;
  gap: 1rem;
  padding: 0rem 45px;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
  transition: all 0.5s ease;
}

#masthead .sub-menu .menu-item {
  height: unset;
  justify-content: unset;
}

#masthead .sub-menu .menu-item a {
  font-weight: 200;
  font-size: 20px;
  line-height: 30px;
  color: var(--white);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

#masthead .sub-menu .menu-item a:hover {
  color: var(--white);
}

#masthead .button-row {
  margin-right: 28px;
  opacity: 1;
  transition: opacity 0.2s ease-out;
}

#masthead .icon.xmark,
#masthead .icon.magnifying-glass {
  font-size: 32px;
  color: var(--blue-md);
  align-self: center;
}

#masthead .navbar-toggler {
  display: none;
}

#masthead .search-button {
  position: relative;
}

#masthead .primary-menu__buttons.active .button-row {
  opacity: 0;
}

#masthead .primary-menu__buttons .xmark {
  display: none;
}

#masthead .primary-menu__buttons.active .xmark {
  display: inline-block;
}

#masthead .primary-menu__buttons.active .magnifying-glass {
  display: none;
}

#masthead .primary-menu__buttons .searchform {
  position: absolute;
  top: 50%;
  transform: translateY(-20%);
  right: 33px;
  width: 215px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin-right: 1rem;
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

#masthead .primary-menu__buttons.mobile .searchform {
  top: unset;
  transform: unset;
  padding-bottom: 1rem;
}

#masthead .primary-menu__buttons .searchform input[type="text"] {
  width: 100%;
}

#masthead .primary-menu__buttons.active .searchform {
  max-height: 80px;
  opacity: 1;
  transform: translateY(-50%);
}

#masthead #searchsubmit {
  padding: 4px 24px;
  font-weight: 500;
  background: var(--blue-gradient);
  color: var(--white);
  border: none;
  transition: unset;
  font-size: 18px;
  border-radius: 1000px;
  display: none;
}

#masthead #searchsubmit:hover {
  outline: 3px solid var(--purple-dk);
  outline-offset: -3px;
}

#masthead .searchform div {
  display: flex;
  gap: 10px;
  height: 38px;
}

@media (max-width: 1800px) {
  #masthead .navbar-name {
    font-size: 18px;
  }

  #masthead .header-logo {
    height: 50px;
  }

  #masthead .primary-menu__menu .menu {
    gap: 25px;
  }

  #masthead .button-row {
    margin-right: 20px;
  }

  #masthead .primary-menu__menu {
    margin-right: 25px;
  }

  #masthead .navbar-brand {
    margin-left: 25px;
  }
}

@media (max-width: 1650px) {
  #masthead .primary-menu {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }

  #masthead .navbar-brand {
    margin-left: 40px;
    margin-top: 1rem;
  }

  #masthead .primary-menu__menu {
    grid-row: 2;
    grid-column: 1 / -1;
    justify-content: center;
  }

  #masthead .primary-menu__menu .menu>.menu-item {
    padding: 0.5rem 0;
  }

  #masthead .primary-menu__menu .menu-item {
    height: unset;
    padding-top: 0.5rem;
  }

  #masthead .primary-menu__buttons {
    justify-content: end;
  }
}

/* DEVICES WITH NORMAL MENU- MENU ITEMS OPEN ON HOVER */
@media (min-width: 992px) {
  #masthead .menu-item-has-children:hover .arrow-container {
    background: var(--purple-dk);
  }

  #masthead .menu-item-has-children:hover .icon.slider-arrow {
    transform: rotate(270deg);
    color: var(--white);
  }

  #masthead .menu-item-has-children:hover .sub-menu {
    max-height: 500px;
    padding: 1rem 45px;
  }
}

@media (max-width: 992px) {
  #masthead .primary-menu {
    padding: 1rem;
  }

  #masthead .navbar-brand {
    margin-left: 0;
  }



  #masthead .primary-menu__menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--white);
    display: flex;
    flex-direction: column;
    width: 100%;
    max-height: 0vh;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
  }

  .admin-bar #masthead .primary-menu__menu.active {
    /* account for the admin bar */
    max-height: calc(100vh - 137px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  #masthead .primary-menu__menu.active {
    /* Constrain to viewport height and enable scrolling within menu */
    max-height: calc(100vh - 91px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  #masthead .primary-menu__menu .menu-primary-container {
    overflow: auto;
  }

  #masthead .primary-menu__menu .menu {
    flex-direction: column;
    gap: 0;
    margin: 1rem 3rem;
  }

  #masthead .primary-menu__menu .menu-item {
    padding: 0.3rem 2rem;
    justify-content: start;
    align-items: start;
  }

  #masthead .navbar-toggler {
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--purple-dk);
    border-radius: 7px;
    width: 65px;
    height: 65px;
    justify-self: right;
    box-shadow: none;
  }

  #masthead .navbar-toggler .menu-icon {
    position: relative;
    display: inline-block;
    width: 95%;
    height: 6px;
    background: white;
    border-radius: 100px;
    visibility: visible;
  }

  #masthead .navbar-toggler .menu-icon::before,
  #masthead .navbar-toggler .menu-icon::after {
    content: "";
    display: inline-block;
    width: 100%;
    height: 6px;
    background: white;
    position: absolute;
    left: 0;
    border-radius: 100px;
    visibility: visible;
    transition: all 0.3s ease;
  }

  #masthead .navbar-toggler .menu-icon::before {
    top: 12px;
  }

  #masthead .navbar-toggler .menu-icon::after {
    bottom: 12px;
  }

  #masthead .navbar-toggler.active .menu-icon {
    visibility: hidden;
  }



  #masthead .navbar-toggler.active .menu-icon::before {
    top: 0px;
    transform: rotate(45deg);
  }

  #masthead .navbar-toggler.active .menu-icon::after {
    bottom: 0px;
    transform: rotate(-45deg);
  }

  #masthead .primary-menu__buttons.mobile {
    display: flex;
    padding-top: 1rem;
    padding-bottom: 3rem;
  }

  #masthead .primary-menu__buttons.desktop {
    display: none;
  }

  #masthead .menu-item {
    width: unset;
  }

  #masthead .menu-item-has-children {
    display: flex;
    flex-direction: column;
  }

  #masthead .menu-item-has-children .sub-menu {
    position: relative;
    z-index: 0;
    top: unset;
    left: unset;
    transform: unset;
    width: 100%;
    border-radius: 0;
    gap: 0;
    box-shadow: 0px 3px 6px #00000029;
    border-radius: 20px;
  }

  #masthead .menu-item-has-children.active .sub-menu {
    max-height: 500px;
  }

  #masthead .menu-item-has-children .sub-menu .menu-item {
    padding: .5rem 0;
  }

  #masthead .menu-item-has-children .sub-menu .menu-item:first-child {
    padding-top: 1rem;
  }

  #masthead .menu-item-has-children .sub-menu .menu-item:last-child {
    padding-bottom: 1rem;
  }

  #masthead .arrow-container {
    position: absolute;
    right: 2rem;
  }

  #masthead .menu-item-has-children .icon.slider-arrow {
    font-size: 16px;
  }

  #masthead .menu-item-has-children.active .icon.slider-arrow {
    transform: rotate(270deg);
  }
}

@media (max-width: 576px) {
  #masthead .primary-menu {
    padding: 0 12px;
    padding-top: 8px;
    padding-bottom: 18px;
  }

  #masthead .navbar-brand {
    margin-top: 0;
  }

  #masthead .header-logo {
    margin-right: 2px;
  }

  #masthead .navbar-name {
    font-size: 14px;
  }
}

@media (max-width: 390px) {
  #masthead .header-logo {
    height: 40px;
  }

  #masthead .navbar-name {
    font-size: 12px;
  }
}