.menu-opened {
  overflow: hidden;
}

.nv-navbar {
  background-color: $navbar_background_color;
  max-height: 100vh;
}

.primary-menu-ul {
  overflow-y: auto;
  transition: $transition_med;
  margin-bottom: 0;

  .responsive-opened & {
    max-height: calc(100vh - 70px);
    padding-bottom: $spacing-sm;
  }

  a {
    color: $body-color;
    font-weight: 500;
    width: 100%;
    display: flex;
    position: relative;
  }

  li {
    cursor: pointer;
    width: 100%;
    display: block;
    position: relative;
  }

  .amp-desktop-caret-wrap {
    display: none;
  }
}

.site-logo, .navbar-toggle-wrapper {
  flex: 1 auto;
}

.navbar-toggle-wrapper {
  justify-content: flex-end;
  display: flex;
}

.primary-menu-ul {
  .sub-menu {
    max-height: 0;
    overflow: hidden;
    padding-left: 20px;
    transition: $transition_med;
    border-left: $muted-border;
  }

  .caret-wrap.dropdown-open + .sub-menu,
  .dropdown-open.sub-menu {
    max-height: 2000px;
    transition: $transition_med;
    opacity: 1;
    visibility: visible;
  }
}

.nv-nav-wrap {
  min-height: 1px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.caret {
  @include caret();
  transform: rotate(135deg);
  color: $gray-color;
  top: -4px;
  transition: $transition_med;

  .dropdown-open.caret-wrap > & {
    transform: rotate(-45deg);
    top: -2px;
  }
}

.caret-wrap {
  position: absolute;
  top: 0;
  right: 0;
  cursor: pointer;
  border-radius: 3px;
  border: $muted-border-med;
  padding: 0 10px;
  transition: $transition_med;
}

#nv-primary-navigation .current-menu-item > a {
  color: $link_hover_color;
}

@mixin nav-menu--laptop() {
    .menu-opened {
      overflow: inherit;
    }

  .row {
    .nv-nav-wrap {
      flex-direction: row;
      align-items: center;
      padding-bottom: 0;
    }

    li > .caret-wrap {
      float: right;
      position: absolute;
      top: 50%;
      right: 0;
      transform: translateY(-50%);
    }

    .primary-menu-ul {
      .amp-caret-wrap {
        display: none;
      }

      .amp-desktop-caret-wrap {
        display: block;
      }
    }

    .primary-menu-ul {
      display: flex;
      flex-wrap: wrap;
      padding-left: 0;
      list-style-type: none;
      overflow-y: inherit;
      max-height: inherit;
      margin-left: auto;
      justify-content: flex-start;

      .responsive-opened & {
        padding-bottom: 0;
      }

      > li {
        width: inherit;
        padding: 10px 0;
        &:not(:last-child) {
         padding-right: $spacing-sm;
        }
        > a {
          display: flex;
          align-items: center;
          justify-content: center;
          height: 100%;
        }

        li a {
          position: relative;
        }
      }

      li:hover, li:focus {
        > a {
          color: $link_hover_color;
          text-decoration: none;
        }

        > a .caret {
          color: $link_hover_color;
        }
      }

      .sub-menu {
        @include soft-box-shadow();
        max-height: inherit;
        padding: 0;
        top: 100%;
        background: $navbar_background_color;
        border-left: none;
        border-top: $muted-border;
        position: absolute;
        overflow: visible;
        z-index: 100;
        opacity: 0;
        visibility: hidden;
        &.dropdown-open {
          opacity: 1;
          visibility: visible;
        }
        .sub-menu {
          left: 100%;
          right: auto;
          top: -1px;
        }

        li {
          display: flex;
          align-items: center;
          background-color: $navbar_background_color;
          border: $muted-border;
          border-top: none;
          min-width: 150px;

          a {
            display: flex;
            justify-content: center;
            align-items: center;
            white-space: nowrap;
            width: 100%;
            padding: 7px 14px;
          }
        }
      }

      .menu-item-has-children {
        &:hover > .sub-menu,
        &:focus > .sub-menu,
        &:focus-within > .sub-menu {
          display: block;
          visibility: visible;
          opacity: 1;
        }

        &:last-child {
          padding-right: $spacing-xs;
        }

        > a {
          display: flex;
          align-items: center;
        }
      }

      > .menu-item-has-children > .sub-menu {
        right: 0;
      }

    }

    .caret-wrap {
      position: relative;
      border: none;
      top: 2px;
      width: 10px;

      &.dropdown-open .caret {
        color: $body-color;
        transform: rotate(135deg);
      }
    }


    .menu-item-has-children:last-child .caret-wrap {
      right: -10px;
    }
  }
}
