/* Menu */

.menu--mobile {
  position: fixed;
  display: block;
  padding: var(--space-xl) var(--space-md);
  top: var(--header-height);
  right: 0;
  left: 0;
  background-color: var(--color-light-grey);
  opacity: 0;
  height: calc(100vh - var(--header-height));
  transform: translateY(-100%);
  z-index: -1;
  transition: transform 0.3s ease-in-out 0s, opacity 0.3s ease-in-out 0s;
}

.header__navigation.open .menu--mobile {
  transform: translateY(0);
  opacity: 1;
}

.menu--desktop {
  display: none;
}

/* Menu items */

.menu__item {
  position: relative;
  display: block;
  width: 100%;
}

.menu__link {
  display: block;
  color: var(--color-graphite);
  font-size: var(--font-size-base);
  text-decoration: none;
}

.menu__link:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.menu__link:hover,
.menu__link:focus,
.menu__link:active {
  /* text-decoration: none; */
  opacity: 1;
}

  .menu__link--active-link,
  .menu__link--active-branch {
    font-weight: normal;
    /* color: #000; */
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
  }

  .menu__item.menu__item--has-submenu > .menu__link {
    display: inline-block;    
  }

/* Menu items - top level */

.menu__item--depth-1 {
  border-top: 1px solid #ced4db;
  padding: 0 var(--space-xxs);
}

.menu__item--depth-1 > .menu__link {
  padding: var(--space-xs) 0;
  padding-left: 0;
}

.menu__item--depth-1 > .menu__link--active-link:after {
  content: none;
}

/* Menu items - submenus */

.menu__submenu {
  width: 100%;
  padding: 0;
  background-color: #fff;
  text-align: left;
  text-transform: none;
  max-height: 0;
  overflow: hidden;
  -webkit-transition: max-height 0.3s cubic-bezier(0, 1, 0, 1);
  transition: max-height 0.3s cubic-bezier(0, 1, 0, 1);
}

.menu__item--open > .menu__submenu {
  /* display: block; */
  opacity: 1;
  margin-bottom: var(--space-xxs);
  max-height: 999px;
  transition: max-height 0.6s ease-in-out;
}

.menu__item--open > .menu__submenu--level-3 {
  margin-bottom: 0;
  border-top: 1px solid #d1d6dc;
}

.menu__submenu .menu__item {
  width: 100%;
}

.menu__submenu .menu__item:not(:last-child) {
  border-bottom: 1px solid #d1d6dc;
}

.menu__submenu .menu__link {
  display: block;
  padding: var(--space-xs) var(--space-xxs);
  /* transition: background-color 0.15s; */
  /* width: 100%; */
}

.menu__submenu--level-3 .menu__item .menu__link {
  padding: 0.7rem var(--space-md);
  font-size: var(--font-size-sm);
}

/* Menu icons */

.menu__child-toggle {
  margin-top: 16px;
  margin-right: var(--space-xxs);
  position: absolute;
  right: 0;
  top: 0;
}

.menu__child-toggle-icon {
  display: block;
  height: var(--font-size-sm);
  width: var(--font-size-sm);
  margin-left: var(--space-xxs);
  background-color: var(--color-graphite);
  mask: var(--caret-svg);
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask: var(--caret-svg);
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  transition: transform 0.4s;
}

.menu__item--open > .menu__child-toggle .menu__child-toggle-icon {
  transform: rotate(180deg);
}

@media (min-width: 768px) {
  .menu--mobile {
    display: none;
  }

  .menu--desktop {
    display: block;
  }

  /* Menu items */

  .menu__item {
    display: inline-block;
    width: auto;
  }

  .menu__link {
    display: inline;
    font-size: min(var(--font-size-base), 18px);
  }

  /* .menu__link--active-link,
  .menu__link--active-branch {
    font-weight: normal;
    color: #000;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
  } */


  /* Menu items - top level */

  .menu__item.menu__item--depth-1 {
    display: inline-block;
    width: auto;
    margin-top: var(--space-md);
    padding: var(--space-xs);
    padding-bottom: calc(var(--space-xs) + var(--space-md));
    border: none;
    transition: padding ease-in-out 0.3s, margin ease-in-out 0.3s;
  }

  .page-scrolled .menu__item--depth-1 {
    margin-top: var(--space-xs);
    padding: var(--space-xs);
    padding-bottom: calc(var(--space-xs) * 2);
  }

  .menu__item--depth-1 > .menu__link {
    padding: 0;
  }


  /* Menu items - submenus */

  .menu__submenu {
    position: absolute;
    top: 100%;
    left: 0;
    padding: 0;
    width: 250px;
    background-color: #fff;
    box-shadow: 0 5px 10px 0 rgba(0, 0, 0, 0.1);
    border-radius: 0 0 3px 3px;
    text-align: left;
    text-transform: none;
    visibility: hidden;
    opacity: 0;
    z-index: 999;
    display: -webkit-flex;
    display: flex;
    flex-direction: column;
    max-height: 0;
    overflow: hidden;
    -webkit-transition: max-height 0.6s cubic-bezier(0, 1, 0, 1),
      opacity 0.1s cubic-bezier(0, 1, 0, 1) 0.6s,
      visibility 0.1s cubic-bezier(0, 1, 0, 1) 0.6s;
    transition: max-height 0.2s cubic-bezier(0, 1, 1, 1),
      opacity 0.1s cubic-bezier(0, 1, 0, 1) 0.6s,
      visibility 0.1s cubic-bezier(0, 1, 0, 1) 0.6s;
  }

  .menu__submenu--level-3 {
    position: relative;
    width: 250px;
    box-shadow: none;
    border-radius: 0;
    opacity: 0;
    z-index: 999;
    display: -webkit-flex;
    display: flex;
    flex-direction: column;
    max-height: 0;
    overflow: hidden;
    -webkit-transition: max-height 0.6s cubic-bezier(0, 1, 0, 1),
      opacity 0.1s cubic-bezier(0, 1, 0, 1) 0.6s,
      visibility 0.1s cubic-bezier(0, 1, 0, 1) 0.6s;
    transition: max-height 0.2s cubic-bezier(0, 1, 1, 1),
      opacity 0.1s cubic-bezier(0, 1, 0, 1) 0.6s,
      visibility 0.1s cubic-bezier(0, 1, 0, 1) 0.6s;
  }

  .menu__item--open > .menu__submenu {
    -webkit-transition: max-height 0.4s cubic-bezier(1, 0, 1, 1);
    transition: max-height 0.4s cubic-bezier(1, 0, 1, 1);
    visibility: visible;
  }

  .menu__submenu .menu__link {
    padding: var(--space-xs);
  }

  /* Menu icons */

  .menu__submenu .menu__child-toggle {
    margin-left: auto;
    padding: 0 1.05rem;
  }

  .menu__item--depth-1 > .menu__child-toggle {
    position: static;
    vertical-align: middle;
    margin: 0;
  }

  .menu__item--depth-2 .menu__child-toggle {
    display: none;
  }
}

/* Flyouts for the last two top level menu items go left to keep page responsive */

/* .menu__item--depth-1:nth-last-child(-n + 2) .menu__submenu--level-3 {
  left: auto;
  right: 100%;
  top: 0;
} */

/* Accounts for child toggle */

/* .menu__submenu .menu__item--has-submenu > .menu__link {
  padding-right: 3rem;
} */

/* Creates the triangle at the top of the submenu drop down

@media (min-width: 768px) {
  /* Keeps triangle to the left for the first menu item's drop down menu */

  .menu__item--depth-1:first-child
    > .menu__submenu--level-2
    > .menu__item:first-child:before {
    left: 0;
  }

  .menu__submenu--level-2 > .menu__item:first-child > .menu__link {
    position: relative;
    z-index: 2;
  }
} */
