@import '../../styles/main.scss';

$trigger-size: 80px;

.BrandSidebar {
  $r: &;

  position: sticky;
  top: $navbar-height;
  left: 0;
  z-index: 1;
  margin: 0 -20px;
  color: $c_white;
  transition: top $duration ease 0s;

  &--onTop {
    top: 0;

    #{$r} {
      &__wrapper {
        height: 100vh;
      }
    }
  }

  &--open {
    @media #{$screen-only-xs} {
      #{$r} {
        &__trigger {
          transform: translateX(calc(-100vw + #{$trigger-size}));
        }

        &__trigger-icon {
          transform: scaleX(-1);
        }

        &__wrapper {
          width: calc(100vw - #{$trigger-size});
          transition-delay: 0s;
        }

        &__container {
          transform: translate(0, 0);
        }
      }
    }
  }

  &__trigger {
    position: absolute;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: $trigger-size;
    height: $trigger-size;
    font-size: 24px;
    cursor: pointer;
    background-color: $c_ebony-clay;
    transition: transform $duration ease;
  }

  &__trigger-icon {
    transition: transform $duration;
  }

  &__wrapper {
    position: absolute;
    right: 0;
    width: 0;
    height: calc(100vh - #{$navbar-height});
    overflow: hidden;
    transition: width 0s $duration, height $duration 0s;
  }

  &__container {
    width: calc(100vw - #{$trigger-size});
    height: 100%;
    padding: 40px 30px 30px 52px;
    overflow: auto;
    background-color: $c_ebony-clay;
    transform: translate(100%, 0);
    transition: transform $duration ease;
  }

  &__sub-group {
    padding: 40px 0 16px 12px;
  }

  &__group {
    &:not(:last-child) {
      margin-bottom: 24px;
    }
  }

  &__link,
  &__sub-link {
    display: block;
    line-height: 1.25;
    text-align: left;
  }

  &__sub-link {
    font-size: 14px;
    font-weight: 300;
    color: $c_light-gray;

    &:not(:last-child) {
      margin-bottom: 20px;
    }

    &:hover {
      color: $c_white;
      cursor: pointer;
    }

    &--active {
      font-weight: 400;
      color: $c_white;
    }
  }

  &__link {
    position: relative;
    font-family: $font-primary;
    font-size: 16px;
    color: $c_white;

    &:hover {
      font-weight: 600;
      cursor: pointer;
    }

    &--active {
      font-weight: 600;

      &::before {
        position: absolute;
        top: 50%;
        left: -20px;
        display: block;
        width: 4px;
        height: 16px;
        background: $c_blue-ribbon;
        content: '';
        transform: translate(0, -50%);
      }
    }
  }

  &--light {
    @media #{$screen-sm} {
      #{$r} {
        &__link,
        &__sub-link {
          color: $c_ebony-clay;
        }
      }
    }
  }

  @media #{$screen-sm} {
    top: 0;
    left: 0;
    z-index: 0;
    width: 100%;
    width: 25%;
    height: 100vh;
    margin: 0;

    &__wrapper {
      position: relative;
      width: auto;
      height: 100%;
    }

    &__trigger {
      display: none;
    }

    &__container {
      position: relative;
      z-index: 0;
      display: block;
      width: 100%;
      height: 100%;
      padding-top: 100px;
      padding-left: 20px;
      background: none;
      transform: translate(0, 0);
    }

    &__sub-link {
      font-size: 18px;
    }

    &__link {
      font-size: 22px;

      &--active {
        font-weight: 700;

        &:hover {
          font-weight: 700;
          cursor: pointer;
        }
      }
    }
  }
}
