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

.drawer {
  display: flex;
  overflow: hidden;
  position: fixed;
  height: 100vh;

  &__blur-bg {
    @include blur-bg();
    position: absolute;
    z-index: 1;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    opacity: 0;
    transition: all 300ms ease-out;
  }

  &__content {
    @include blur-bg();
    opacity: 0;
    transform: translateX(#{base(4)});
    position: relative;
    z-index: 2;
    width: 100%;
    transition: all 300ms ease-out;
    overflow: hidden;
  }

  &__content-children {
    position: relative;
    z-index: 1;
    overflow: auto;
    height: 100%;
  }

  &--is-open {
    .drawer__content,
    .drawer__blur-bg,
    .drawer__close {
      opacity: 1;
    }

    .drawer__close {
      transition: opacity 300ms ease-in-out;
      transition-delay: 100ms;
    }

    .drawer__content {
      transform: translateX(0);
    }
  }

  &__close {
    @extend %btn-reset;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    text-indent: -9999px;
    background: rgba(0, 0, 0, 0.08);
    cursor: pointer;
    opacity: 0;
    will-change: opacity;
    transition: none;
    transition-delay: 0ms;

    &:active,
    &:focus {
      outline: 0;
    }
  }

  &__header {
    display: flex;
    margin-top: base(2.5);
    margin-bottom: base(1);
    width: 100%;

    &__title {
      margin: 0;
      flex-grow: 1;
    }

    &__close {
      border: 0;
      background-color: transparent;
      padding: 0;
      cursor: pointer;
      overflow: hidden;
      width: base(1);
      height: base(1);

      svg {
        width: base(2.75);
        height: base(2.75);
        position: relative;
        left: base(-.825);
        top: base(-.825);

        .stroke {
          stroke-width: 2px;
          vector-effect: non-scaling-stroke;
        }
      }
    }
  }

  @include mid-break {
    &__header {
      margin-top: base(1.5);
    }

    &__close {
      width: base(1);
    }
  }
}

html[data-theme=dark] {
  .drawer__close {
    background: rgba(0, 0, 0, 0.2);
  }
}
