@use "../variables";

/* stylelint-disable selector-class-pattern -- Doing swiper overrides here */
.fwe-modal-image-gallery {
  background: transparent;
  box-shadow: none;
  padding: 0px;
  position: fixed;
  width: 288px;
  max-width: unset;
  max-height: 100vh;
  overflow-x: hidden;
  overflow-y: hidden;

  .fwe-btn-link i.fwe-icon-arrows-scale-up.fwe-modal-image-gallery-scale,
  .fwe-btn-link i.fwe-icon-arrows-scale-down.fwe-modal-image-gallery-scale {
    font-size: 24px;
    margin-right: 0px;
    padding-right: 0px;
    padding-top: 3px;
  }

  .fwe-image-gallery {
    // pagination height (37px + 24px) + 12px (extra padding on top and bottom)
    max-height: calc(100vh - 73px);

    &-close-btn {
      width: 32px;
      height: 32px;
      padding: 0;
      border: none;
      min-width: 32px;
      cursor: pointer;
      background: variables.$white;
      mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiI+PHBhdGggZmlsbD0ibm9uZSIgZD0iTTAgMGgzMnYzMkgweiIgZGF0YS1uYW1lPSJ3aGl0ZSBiYWNrZ3JvdW5kIi8+PHBhdGggZmlsbD0iIzMzMyIgZD0iTTIxLjQ4IDkuMSAxNiAxNC41OSAxMC41MSA5LjEgOS4xIDEwLjUyIDE0LjU4IDE2IDkuMSAyMS40OWwxLjQxIDEuNDFMMTYgMTcuNDJsNS40OCA1LjQ4IDEuNDItMS40MUwxNy40MSAxNmw1LjQ5LTUuNDgtMS40Mi0xLjQyeiIgZGF0YS1uYW1lPSJjb250ZW50Ii8+PC9zdmc+");
      &:hover {
        background: variables.$hero;
      }
    }

    &-scale-btn {
      width: 24px;
      height: 24px;
      padding: 0;
      border: none;
      min-width: 24px;
      cursor: pointer;
      background: variables.$white;
      mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiI+PHBhdGggZmlsbD0ibm9uZSIgZD0iTTAgMGgzMnYzMkgweiIgZGF0YS1uYW1lPSJ3aGl0ZSBiYWNrZ3JvdW5kIi8+PGcgZGF0YS1uYW1lPSJjb250ZW50Ij48cGF0aCBkPSJtMTguMTAxIDQgMi44MjggMi44MjgtNC4yNDMgNC4yNDMgNC4yNDMgNC4yNDMgNC4yNDMtNC4yNDNMMjggMTMuODk5VjRoLTkuODk5ek0xMS4wNzEgMTYuNjg2bC00LjI0MyA0LjI0M0w0IDE4LjEwMVYyOGg5LjlsLTIuODI5LTIuODI4IDQuMjQzLTQuMjQzLTQuMjQzLTQuMjQzeiIvPjwvZz48L3N2Zz4=");
      &:hover {
        background: variables.$hero;
      }
    }
  }

  &--with-thumbnails {
    .fwe-image-gallery {
      // pagination height (37px + 24px) + thumbs height (64 + 24) + 12px (extra padding on top and bottom)
      max-height: calc(100vh - 161px);
    }
  }

  &--with-container {
    border-top: none;
    border-bottom: none;

    .fwe-image-gallery-header {
      margin-top: variables.$spacer-m - 6px;
    }
  }
}

.fwe-image-gallery-container {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.fwe-image-gallery-content {
  color: variables.$white;
  padding-top: variables.$spacer-xl;
  padding-bottom: variables.$spacer-m;

  h3 {
    font-weight: variables.$font-weight-bold;
    margin-top: 0;
    margin-bottom: variables.$spacer;
  }
}

.fwe-image-gallery-header {
  display: flex;
  align-items: center;
  margin-bottom: variables.$spacer-m;
  margin-top: 0px;
}

.fwe-image-gallery {
  width: 100%;
  height: 288px;
  background-color: white;
  -webkit-user-select: none;
  user-select: none;

  svg,
  img,
  .swiper-zoom-container img,
  .swiper-zoom-container svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

.fwe-image-gallery-thumbs {
  margin-top: 24px;
  -webkit-user-select: none;
  user-select: none;

  &.swiper {
    width: 100%;
    height: 64px;
    box-sizing: border-box;
    margin-left: auto;
    margin-right: auto;

    .swiper-slide {
      position: relative;
      background-size: cover;
      background-position: center;
      width: 88px;
      margin-right: 8px;
      height: 64px;
      opacity: 0.33;
      transition: opacity 0.3s;
      cursor: pointer;

      &:last-child {
        margin-right: 0px;
      }

      &::after {
        position: absolute;
        content: "";
        height: 4px;
        width: 100%;
        background-color: variables.$hero;
        bottom: 0px;
        opacity: 0;
        transition: opacity 0.3s;
      }

      img {
        display: block;
        object-fit: cover;
        width: 88px;
        height: 56px;
        background-color: white;
      }

      &.swiper-slide-thumb-active,
      &:hover {
        opacity: 1;

        &::after {
          opacity: 1;
        }
      }

      &.swiper-slide-thumb-active {
        cursor: default;
      }
    }
  }

  &:not(.swiper) {
    display: flex;
    flex-direction: row;
    overflow: hidden;
  }

  &-nail {
    position: relative;
    height: 64px;
    width: 88px;
    min-width: 88px;
    margin-right: 8px;
    opacity: 0.33;
    transition: opacity 0.3s;
    cursor: pointer;

    img {
      position: absolute;
      height: 56px;
      width: 88px;
      min-width: 88px;
      background: white;
      object-fit: cover;
    }

    &:last-child {
      margin-right: 0px;
    }

    &::after {
      position: absolute;
      content: "";
      height: 4px;
      width: 100%;
      background-color: variables.$hero;
      bottom: 0px;
      opacity: 0;
      transition: opacity 0.3s;
    }

    &.fwe-active,
    &:hover {
      opacity: 1;

      &::after {
        opacity: 1;
      }
    }

    &.fwe-active {
      cursor: default;
    }
  }
}

@media only screen and (min-width: variables.$grid-breakpoint-xxs) {
  .fwe-modal-image-gallery {
    width: 342px;
    max-height: 90vh;
  }

  .fwe-image-gallery,
  .fwe-image-gallery-content {
    height: 342px;
  }
}

@media only screen and (min-width: variables.$grid-breakpoint-sm) {
  .fwe-modal-image-gallery {
    width: 696px;
  }

  .fwe-image-gallery,
  .fwe-image-gallery-content {
    height: 465px;
  }
}

@media only screen and (min-width: variables.$grid-breakpoint-md) {
  .fwe-modal-image-gallery {
    width: 696px;
  }

  .fwe-image-gallery,
  .fwe-image-gallery-content {
    height: 465px;
  }
}

@media only screen and (min-width: variables.$grid-breakpoint-xl) {
  .fwe-modal-image-gallery {
    width: 960px;
    min-height: 726px;

    &--with-container {
      width: 1320px;
      border-top: none;
      border-bottom: none;
      position: relative;

      .fwe-image-gallery-header {
        position: absolute;
        top: 0px;
        right: 0px;
        width: 312px;
        margin-top: 0px;
      }
    }
  }

  .fwe-image-gallery,
  .fwe-image-gallery-content {
    height: 640px;
  }

  .fwe-image-gallery-container {
    flex-direction: row;

    .fwe-image-gallery {
      width: 984px;
    }

    .fwe-image-gallery-content {
      margin-top: 35px;
      max-width: 312px;
      width: 312px;
      min-width: 312px;
      margin-left: 24px;
      border-top: none;
      border-bottom: none;
    }
  }
}
