@mixin navigation-item-text {
  font-family: $font-tgn-condensed-bold;
  font-size: $font-size-body-text;
  color: transparentize($ami-white, 0.4);
  background-color: transparent;

  &:hover {
    color: transparentize($ami-white, 0.4);
    background-color: transparent;
  }

  &.active {
    color: $ami-white;
  }
}

@mixin navigation-item-text-mobile {
  @include mobile {
    color: transparentize($light-black, 0.4);

    &:hover {
      color: $light-black;
    }
  }
}

@mixin navigation-item {
  @include navigation-item-text;
  padding: 0;
  margin: 0 0.6945rem;

  @include mobile {
    border-bottom: none;

    &:hover {
      border-bottom: none;
    }
  }
}

@mixin navigation-item-mobile {
  @include navigation-item-text;
  @include navigation-item-text-mobile;

  @include mobile {
    padding: 0.5556rem 0.75rem;
    margin: 0;
    border-bottom: 0;

    &:hover,
    &.active {
      border-bottom: 0;
      color: $light-black;
    }
  }
}

header.nav-menu-open-mobile,
header.nav-menu-open {
  .logos {
    visibility: hidden;
  }
}

.navbar {
  background-color: transparent;
}

.navbar-menu {
  text-transform: uppercase;
  height: calc(3.9445rem + 0.5556rem);
  position: relative;

  @include until($widescreen) {
    height: calc(2.5rem + 0.5556rem);
  }

  @include tablet-only {
    align-items: stretch;
    display: flex;
    background-color: transparent;
    box-shadow: none;
    padding: 0;
  }

  @include mobile {
    background-color: $ami-beige;
    padding: 0;
    box-shadow: none;
    height: 100%;
  }

  &.is-active {
    display: none;
  }
}

.navbar-brand {
  margin-top: 0.5556rem;
  position: absolute;
  height: 3.9445rem;
  min-height: unset;
  width: fit-content;
  z-index: 1;

  .logos {
    display: inline-flex;
    margin-left: calc(-2.222rem - 0.888rem);
  }

  img {
    height: 3.9445rem;
  }

  .slogan {
    width: 15.6967rem;
    background-color: $ami-black;
    padding-right: 1rem;
    display: flex;
    flex-shrink: 0;
    justify-content: flex-end;
    align-items: center;

    img {
      height: 2.2778rem;
    }
  }

  @include until($fullhd) {
    .slogan {
      width: 12.6967rem;
    }
  }

  @include until($widescreen) {
    padding: 0 0.666rem;
    height: 2.5rem;

    .logos {
      margin-left: calc(-0.666rem - 2.222rem - 1rem);
    }

    img {
      height: 2.5rem;
    }

    .slogan {
      width: 9.3889rem;

      img {
        height: 1.4445rem;
      }
    }
  }

  @include touch {
    .logos {
      margin-left: -2rem;
    }
  }

  @include mobile {
    width: 100%;
  }
}

.navbar-start {
  flex: 1;
  justify-content: center;
  margin-bottom: 1rem;
  height: 100%;
  position: relative;

  @include tablet-only {
    margin-right: auto;
    align-items: stretch;
    display: flex;
    justify-content: flex-start;
    padding-right: 3rem;
    margin-left: 14.6667rem;
  }

  @include mobile {
    padding-top: 2rem;
  }

  .navbar-item {
    @include navigation-item;
    @include navigation-item-text-mobile;
    @include navigation-item-mobile;

    @include tablet-only {
      align-items: center;
      display: flex;
    }

    // to be removed
    &:first-child {
      display: none;
    }
  }

  hr {
    height: 2px;
    background: $ami-yellow;
    width: 50px;
    align-self: flex-start;
    position: absolute;
    bottom: 0;
    margin: 0;
    left: -1000px;
    transition: $transition-duration ease-in-out;

    @include mobile {
      display: none;
    }
  }
}

.navbar-end {
  position: absolute;
  right: 0;
  height: 100%;

  .navbar-item.has-dropdown {
    @include tablet-only {
      display: flex;
      align-items: stretch;
    }
  }

  .navbar-item .navbar-link {
    padding: 0;
    display: flex;
    align-items: center;

    &::after {
      content: none;
    }

    &.is-active {
      @include navigation-item-text;
      @include navigation-item-text-mobile;
      @include navigation-item-mobile;
      z-index: 1;

      > span {
        margin-right: 0.3889rem;
        z-index: -1;
      }

      > i {
        transition: transform $transition-duration ease-out;

        &::before {
          margin: 0;
          z-index: 1;
        }
      }

      &:hover {
        color: $ami-white;
      }
    }
  }

  .dropdown-open {
    .navbar-link {
      > span {
        @include from($tablet) {
          visibility: hidden;
        }
      }

      > i {
        transform: rotate(180deg);
      }
    }

    .navbar-dropdown {
      opacity: 1;
      pointer-events: auto;
      transform: translateY(0);

      @include mobile {
        max-height: 8rem;
        padding: 0.1112rem 0;
      }
    }
  }

  .navbar-dropdown {
    border-radius: 0;
    box-shadow: none;
    background-color: $light-brown;
    position: absolute;
    top: 0.3889rem;
    left: inherit;
    right: -1.111rem;
    z-index: 0;
    padding-bottom: 0.3889rem;
    padding-top: 1.3889rem;
    transition-duration: $transition-duration;
    transition: max-height opacity;
    display: flex;
    flex-direction: column;

    > .navbar-item:nth-child(2n) {
      order: 1;
    }

    .navbar-item {
      @include navigation-item-mobile;
      padding: 0.5556rem 3.333rem 0.5556rem 1rem;

      &:hover {
        color: $ami-white;
      }
    }

    @include tablet-only {
      transition-property: opacity, transform;
      transform: translateY(-5px);
      pointer-events: none;
      opacity: 0;
      border-top: none;
      font-size: 0.875rem;
      min-width: 100%;
      right: -0.3rem;
    }

    @include mobile {
      position: relative;
      opacity: 0;
      right: 0;
      top: auto;
      max-height: 0;
      padding: 0;
    }
  }

  @include tablet-only {
    justify-content: flex-end;
    margin-left: auto;
    align-items: stretch;
    display: flex;
  }

  @include mobile {
    position: relative;
    right: auto;
    height: auto;
  }
}

.navbar-burger {
  @include navigation-item-text;
  border: none;
  display: none;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  padding: 0;

  &:focus {
    outline: 0;
  }

  > span {
    height: 2px;
    left: auto;
    margin-left: 0;
    position: inherit;
    top: auto;

    &:not(:first-child):not(:last-child) {
      visibility: hidden;
    }

    &:first-child {
      width: 1.333rem;
    }

    &:last-child {
      width: 0.777rem;
    }
  }

  &.is-active {
    @include navigation-item-text-mobile;

    > span {
      color: $ami-white;

      &:first-child,
      &:last-child {
        width: 0.833rem;
      }

      &:last-child {
        margin-top: 7px;
      }
    }
  }

  @include mobile {
    display: flex;;
  }
}
