@import "assets/src/scss/utils/variables";

.wcf--image-gallery {
  display: grid;
  align-items: center;

  .icon {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    inset-inline-start: 0;
    background-color: rgba(0, 0, 0, 0.5);
    transform: translateX(-101%);
    transition: all 0.7s;

    i {
      display: inline-block;
      position: absolute;
      inset-inline-start: 0%;
      top: 50%;
      z-index: 9;
      font-size: 20px;
      color: #fff;
      opacity: 0;
      transition: all 0.6s;
      transform: translate(-50%, -50%);
    }
  }

  a {
    display: block;
    position: relative;
    line-height: 0;

    &:hover {
      .icon {
        transform: translateX(0%);
      }

      i {
        opacity: 1;
        inset-inline-start: 50%;
      }
    }
  }

  .wcf--gallery-item {
    overflow: hidden;

    img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }

  &.style-2 {
    align-items: start;

    .wcf--gallery-item:nth-child(even) {
      margin-top: 120px;

      @media #{$xl} {
        margin-top: 90px;
      }

      @media #{$lg} {
        margin-top: 60px;
      }

      @media #{$sm} {
        margin-top: 0;
      }
    }
  }
}

.elementor-widget-wcf--image-gallery {
  &.wcf--image {
    &-effect-zoom-in,
    &-effect-zoom-out,
    &-left-move,
    &-right-move {
      img {
        transition: all 0.5s;
      }

      .wcf--gallery-item {
        overflow: hidden;
      }
    }

    &-effect-zoom-in {
      img {
        transform: scale(1);
      }

      .wcf--gallery-item:hover {
        img {
          transform: scale(1.1);
        }
      }
    }

    &-effect-zoom-out {
      img {
        transform: scale(1);
      }

      .wcf--gallery-item:hover {
        img {
          transform: scale(0.9);
        }
      }
    }

    &-left-move {
      img {
        transform: scale(1.1);
      }

      .wcf--gallery-item:hover {
        img {
          transform: scale(1.1) translateX(4%);
        }
      }
    }

    &-right-move {
      img {
        transform: scale(1.1);
      }

      .wcf--gallery-item:hover {
        img {
          transform: scale(1.1) translateX(-4%);
        }
      }
    }
  }
}

// === WCF Lightbox ===
.wcf--lightbox-enabled .wcf--lightbox-trigger {
  cursor: zoom-in;
}

.wcf--lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.35s ease, visibility 0.35s ease;

  &.wcf--lightbox-active {
    visibility: visible;
    opacity: 1;
  }
}

.wcf--lightbox-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
}

.wcf--lightbox-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.wcf--lightbox-toolbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 16px 20px;
  z-index: 3;
  gap: 12px;
}

.wcf--lightbox-counter {
  color: #fff;
  font-size: 14px;
  margin-right: auto;
  opacity: 0.8;
  letter-spacing: 1px;
}

.wcf--lightbox-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 20px;
  padding: 8px;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.25s ease, transform 0.25s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  &:hover {
    opacity: 1;
    transform: scale(1.15);
  }

  svg {
    width: 1em;
    height: 1em;
    fill: currentColor;
  }

  i {
    font-size: inherit;
  }
}

.wcf--lightbox-close {
  font-size: 24px;
}

.wcf--lightbox-prev,
.wcf--lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  font-size: 28px;
  padding: 12px;

  &:hover {
    transform: translateY(-50%) scale(1.15);
  }
}

.wcf--lightbox-prev {
  left: 12px;
}

.wcf--lightbox-next {
  right: 12px;
}

.wcf--lightbox-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 85%;
  max-height: 85%;
  transition: opacity 0.25s ease;

  &.wcf--lightbox-stage-fade {
    opacity: 0;
  }
}

.wcf--lightbox-image {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 4px;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

// Fade & Scale animation
.wcf--lightbox-fade-scale {
  .wcf--lightbox-image {
    transform: scale(0.85);
    transition: transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.35s ease;
    opacity: 0;
  }

  &.wcf--lightbox-active .wcf--lightbox-image {
    transform: scale(1);
    opacity: 1;
  }
}

// Slide animation
.wcf--lightbox-slide {
  .wcf--lightbox-image {
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.35s ease;
    opacity: 0;
  }

  &.wcf--lightbox-active .wcf--lightbox-image {
    opacity: 1;
  }
}

.wcf--slide-out-left {
  transform: translateX(-100%) !important;
  opacity: 0 !important;
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.35s ease !important;
}

.wcf--slide-out-right {
  transform: translateX(100%) !important;
  opacity: 0 !important;
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.35s ease !important;
}

.wcf--slide-in-right {
  animation: wcfSlideInRight 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.wcf--slide-in-left {
  animation: wcfSlideInLeft 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes wcfSlideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes wcfSlideInLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@media only screen and (max-width: 767px) {
  .wcf--lightbox-stage {
    max-width: 95%;
    max-height: 80%;
  }

  .wcf--lightbox-prev {
    left: 4px;
  }

  .wcf--lightbox-next {
    right: 4px;
  }

  .wcf--lightbox-prev,
  .wcf--lightbox-next {
    font-size: 22px;
    padding: 8px;
  }

  .wcf--lightbox-toolbar {
    padding: 10px 12px;
  }
}
