.menu {
  display: none;
  @include mq($from: desktop) {
    display: flex;
    flex: 1 1 auto;
  }

  &--mobile {
    width: 100%;
    height: 100%;
    background: $white;
    display: flex;
    flex-direction: column;
    @include mq($from: desktop) {
      display: none;
    }
  }

  &--user {
    justify-content: flex-end;
    font-size: .875rem;
    background: none;
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 10px;
    @include mq($from: wide) {
      padding: 10px 0;
    }
  }

  &--header {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
  }

  &__list {
    @extend %list;
    width: 100%;
    max-width: 960px;
    position: relative;
    display: flex;
    color: $black;

    &--mobile {
      flex-direction: column;
      max-width: 400px;
      height: 100%;
      padding: 30px 0;
      background: $grey-200;
    }

    &--user {
      width: auto;
    }
  }

  &__list-item {
    list-style: none;
    display: inline-block;
    white-space: nowrap;

    &:hover {
      @include mq($from: desktop) {
        background-color: $grey-lightest;
      }
    }

    & a {
      display: inline-block;
      color: $grey-dark;
      padding: 20px;
      letter-spacing: $x-small-space;

      &:hover {
        color: $black;
        background-color: $grey-100;
        @include mq($from: desktop) {
          background: none;
        }
      }
    }

    &--has-submenu {
      position: relative;

      & a {
        padding-left: 20px;
        @include mq($from: desktop) {
          padding-right: 25px;
        }

        &:after {
          content: '';
          display: inline-block;
          width: 5px;
          height: 5px;
          border-top: 2px solid $black;
          border-right: 2px solid $black;
          transform: rotate(135deg);
          position: absolute;
          left: 15px;
          top: 18px;
          @include mq($from: desktop) {
            border-color: $grey-dark;
            left: auto;
            top: auto;
            right: 10px;
            bottom: 27px;
          }
        }

        &:hover:after {
          border-color: $black;
          @include mq($from: desktop) {
            border-color: $black;
          }
        }

        &.open {
          background-color: $grey-100;

          &:after {
            transform: rotate(315deg);
            top: 20px;
          }
        }
      }
    }

    &--mobile {
      background: none;
      text-align: left;

      & a {
        display: inline-block;
        width: 100%;
        padding: 15px 15px 15px 40px;

        &:hover {
          opacity: 1;
        }
      }
    }

    &--user {
      background: none;
      margin-left: 10px;

      &:hover {
        background: none;
      }

      &:first-child {
        margin-left: 0;
      }

      & a {
        padding: 0;

        &:hover {
          background: none;
        }
      }
    }
  }

  &__children {
    display: none;
    @include mq($from: desktop) {
      left: 0;
      top: 58px;
      position: absolute;
      transition-duration: .9s;
      z-index: 120;
      text-align: left;
      border: 1px solid $white;
      border-top: 0;
    }

    &.open {
      display: block;
      margin-bottom: 20px;

      & a {
        background-color: $grey-100;
      }
    }
  }

  &__content {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    overflow-y: auto;
    padding: 30px;
    height: 100%;
    @include mq($from: mobileBig) {
      padding: 50px;
    }

    &--mobile {
      padding: 0;
      background-color: $grey-100;
    }
  }
}

.side-menu {
  flex-direction: column;
  flex-wrap: nowrap;
  width: 100%;
  background-color: $nearly-black;
  position: fixed;
  left: 0;
  bottom: 0;
  top: 50px;
  height: calc(100vh - 50px);
  z-index: 99;
  display: none;
  @include mq($from: tablet) {
    display: flex;
    max-width: 300px;
    position: relative;
    top: auto;
    height: 100%;
    z-index: auto;
  }

  &__wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: scroll;
    padding: 20px 0;
  }

  &__block {
    display: inline-block;
    width: 100%;
    margin: 20px 0;
    text-align: left;
    @include mq($from: tablet) {
      display: flex;
      flex-direction: column;
    }
  }

  &__block-heading {
    font-weight: 400;
    text-transform: uppercase;
    color: $grey;
    letter-spacing: $small-space;
    padding: 0 25px 2px;
    margin-bottom: 12px;
    font-size: .75rem;
  }

  &__list {
    @extend %list;
    border-top: 1px solid $grey-darkest;
  }

  &__list-item {
    &--has-submenu {
      position: relative;

      & a {
        padding-left: 20px;
        @include mq($from: desktop) {
          padding-right: 25px;
        }

        &:after {
          content: '';
          display: inline-block;
          width: 5px;
          height: 5px;
          border-top: 2px solid $white;
          border-right: 2px solid $white;
          transform: rotate(135deg);
          position: absolute;
          right: 20px;
          top: 15px;
        }

        &:hover:after {
          border-color: $primary-color;
        }

        &.open {
          background-color: $grey-darkest;

          &:after {
            transform: rotate(315deg);
            top: 20px;
          }
        }
      }
    }
  }

  &__list-link {
    display: inline-block;
    width: 100%;
    padding: 10px 20px;
    color: $white;
    border-left: 5px solid $nearly-black;
    border-bottom: 1px solid $grey-darkest;

    &:hover {
      color: $primary-color;
      text-decoration: none;
      background-color: $grey-darkest;
      border-color: $grey-darkest;
    }

    &.current {
      color: $primary-color;
      border-left-color: $primary-color;
    }
  }

  &__children {
    height: 0;
    overflow: hidden;

    &.open {
      height: 100%;
      overflow: visible;
    }
  }
}

.submenu {
  @include mq($from: desktop) {
    width: 230px;
  }

  &--mobile {
    padding: 0;
  }

  &--side-menu {
    width: 100%;
    margin-bottom: 20px;
    background-color: lighten($nearly-black, 4%);
  }

  &__wrapper {
    position: relative;
    height: auto;
  }

  &__list {
    @extend %list;
  }

  &__list-item {
    & a {
      display: inline-block;
      width: 100%;
      padding: 15px 20px;
      position: relative;
      @include mq($from: desktop) {
        background-color: $grey-100;
      }

      &:hover {
        @include mq($from: desktop) {
          background-color: $grey-50;
        }
      }

      &:after {
        content: '';
        display: none;
      }
    }

    &--side-menu a {
      background: none;
      color: $grey-light;
      padding: 10px 20px 10px 25px;

      &:hover {
        background-color: $nearly-black;
      }
    }
  }
}

.menu__list-item--has-submenu:hover .menu__children {
  @include mq($from: desktop) {
    display: block;
  }
}

.submenu__list-item--has-submenu:hover .submenu {
  @include mq($from: desktop) {
    display: flex;
  }
}

.responsive-nav {
  height: 100%;
  position: fixed;
  top: 60px;
  right: 0;
  left: 0;
  bottom: 0;
  display: none;
}

#menu-button {
  /*60px*/
  width: 24px;
  /*45px*/
  height: 20px;
  position: relative;
  transform: rotate(0deg);
  transition: .5s ease-in-out;
  cursor: pointer;

  & span {
    display: block;
    position: absolute;
    height: 4px;
    width: 100%;
    background: $black;
    border-radius: 2px;
    opacity: 1;
    left: 0;
    transform: rotate(0deg);
    /*-webkit-transition: .25s ease-in-out;
    -moz-transition: .25s ease-in-out;
    -o-transition: .25s ease-in-out;*/
    transition: .25s ease-in-out;

    &:nth-child(1) {
      top: 0;
      /*-webkit-transform-origin: left center;
      -moz-transform-origin: left center;
      -o-transform-origin: left center;*/
      transform-origin: left center;
    }

    &:nth-child(2) {
      /*18px*/
      top: 8px;
      /*-webkit-transform-origin: left center;
      -moz-transform-origin: left center;
      -o-transform-origin: left center;*/
      transform-origin: left center;
    }

    &:nth-child(3) {
      /*36px*/
      top: 16px;
      /*-webkit-transform-origin: left center;
      -moz-transform-origin: left center;
      -o-transform-origin: left center;*/
      transform-origin: left center;
    }
  }

  &.open {
    & span {
      &:nth-child(1) {
        /*-webkit-transform: rotate(45deg);
        -moz-transform: rotate(45deg);
        -o-transform: rotate(45deg);*/
        transform: rotate(45deg);
        top: 0;
        left: 3px;
      }

      &:nth-child(2) {
        width: 0;
        opacity: 0;
      }

      &:nth-child(3) {
        /*-webkit-transform: rotate(-45deg);
        -moz-transform: rotate(-45deg);
        -o-transform: rotate(-45deg);*/
        transform: rotate(-45deg);
        top: 17px;
        left: 3px;
      }
    }
  }
}
