.block-gallery {
  position: relative;
  width: 100%;
  margin: 50px 0;

  &__slider {
    margin: 0 auto 30px;
    position: relative;
    overflow: hidden;
    width: 100%;
    min-height: 670px;
    transition: height 200ms ease-out;

    @include sm {
      min-height: auto;
    }
  }

  &__slide {
    position: absolute;
    width: 100%;
    height: 670px;
    user-select: none;
    pointer-events: none;

    @include md {
      pointer-events: all;
    }

    @include sm {
      display: flex;
      flex-direction: column-reverse;
      height: auto;
    }

    img {
      object-fit: cover;
      width: 100%;
      height: 100%;
      pointer-events: none;



      &.animate__fadeIn {
        position: relative;
        opacity: 0;
        transition: 0.3s all 0.4s;
      }
    }

    &.block-gallery--current img {
      pointer-events: all;
    }
  }

  &__slide-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    max-width: 585px;
    height: 100%;
    background-color: $white-overlay;
    display: flex;
    align-items: center;
    z-index: 1;
    padding: 0 120px;

    @include mdx {
      max-width: 400px;
      padding: 0 80px;
    }

    @include sm {
      position: relative;
      top: unset;
      left: unset;
      width: 100%;
      background-color: transparent;
      height: auto;
      padding: 20px 0 0;
      max-width: 100%;
    }

    &.animate {
      &__fadeIn {
        transform: translateX(-250%);
        opacity: 0;
        transition: 0.3s all 0.3s;
      }
    }

    & > div.animate {
      &__fadeIn {
        opacity: 0;
        transition: 0.3s all 0.6s;
      }
    }


    .block-gallery__content {
      width: 100%;
      opacity: 1;
      transition: 0.3s opacity 0.5s;

      @include sm {
        margin: 0 auto;
        padding: 0 $gutter-mobile;
      }
    }

    &.js-hide-overlay {
      max-width: 85px;
      padding: 0;

      .block-gallery__content {
        opacity: 0;
        pointer-events: none;
        transition: 0.3s opacity;
      }

      @include sm {
        max-width: unset;
        padding: 20px 0 0;

        .block-gallery__content {
          opacity: 1;
          pointer-events: all;
        }
      }
    }
  }

  &__content {
    @include sm {
      text-align: center;
      margin: 0 auto;
      padding: 0 50px;
    }
  }

  &__open-button {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22px;
    height: 22px;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s opacity;
    transform: translate(-50%, -50%) rotate(-90deg);

    @include sm {
      display: none;
    }

    .js-hide-overlay & {
      opacity: 1;
      cursor: pointer;
      pointer-events: all;
    }
  }

  &__close-button {
    position: absolute;
    top: 19px;
    right: 15px;
    width: 22px;
    height: 22px;
    opacity: 1;
    cursor: pointer;
    transition: 0.3s opacity;

    @include sm {
      display: none;
    }

    .js-hide-overlay & {
      opacity: 0;
      pointer-events: none;
    }

    &::after, &::before {
        content: " ";
        width: 10px;
        height: 10px;
        display: inline-block;
        transform: rotate(45deg);
        position: absolute;
        top: 6px;
    }

    &::after {
        border-right: 2px solid $gray-70;
        border-top: 2px solid $gray-70;
        left: 0;
    }

    &::before {
        border-left: 2px solid $gray-70;
        border-bottom: 2px solid $gray-70;
        right: 0;
    }
  }

  .js-current {
    pointer-events: all;

    img.animate {
      &__fadeIn {
        opacity: 1;
      }
    }

    .block-gallery__slide-overlay.animate__fadeIn {
      transform: translateX(0%);
      opacity: 1;
    }

    & .block-gallery__slide-overlay > div.animate__fadeIn {
      opacity: 1;
    }
  }

  &__navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
  }

  &__prev {
    margin-right: 20px;
    transform: rotate(90deg);
    cursor: pointer;
    height: 12px;
    width: 12px;
  }

  &__next {
    margin-left: 14px;
    transform: rotate(-90deg);
    cursor: pointer;
    height: 12px;
    width: 12px;
  }

  .js-disable {
    opacity: 0.5;
    cursor: default;
  }

  &__dot {
    width: 6px;
    height: 6px;
    border-radius: 100%;
    background-color: $gray-border;
    margin-right: 6px;
    cursor: pointer;
  }

  .js-active {
    background-color: $primary-color;
  }

  &__subtitle {
    font-size: 2.1rem;
    color: $secondary-color;
    margin-bottom: 32px;
    font-weight: 700;
  }

  &__cta {
    margin-top: 40px;
  }

  &__caption {
    position: absolute;
    bottom: 0;
    right: 0;
    padding: 8px 16px;
    color: $white;
    font-size: 1.4rem;
    line-height: 2rem;
    background: rgba(13, 24, 41, 0.4);
    opacity: 0;
    transition: opacity 250ms ease-out;

    .js-current & {
      opacity: 1;
    }

    @include sm {
      bottom: auto;
      top: 0;
    }
  }
}
