.elementor-widget-neuron-gallery {
  .m-neuron-gallery {
    &__thumbnail {
      &--link {
        width: 100%;
        position: relative;

        padding-bottom: calc(0.63 * 100%);
        overflow: hidden;

        img {
          transition: all 0.3s ease-in-out;

          display: block;
          position: absolute;
          top: 0;
          left: 0;
          width: 100%;
          height: 100%;
          transition: all 0.3s ease-in-out;
          object-fit: cover;
          object-position: center center;
        }
      }

      &--zoom-in {
        overflow: hidden;

        img {
          transition: transform 0.3s ease;
        }
      }

      &--zoom-out {
        img {
          clip-path: inset(0 0 0 0);
          transition: clip-path 0.3s ease;
        }
      }

      &--tilt-right {
        img {
          transform: scale(1.2);
        }
      }
    }

    &__item:hover {
      .m-neuron-gallery__thumbnail {
        &--zoom-in {
          img {
            transform: scale(1.1);
          }
        }

        &--zoom-out {
          img {
            clip-path: inset(22px);
          }
        }

        &--tilt-right {
          img {
            transform: translatex(15px) scale(1.2);
          }
        }
      }
    }

    &__image-detail {
      &--title {
        font-size: 24px;
      }
      &--caption {
        font-size: 18px;
      }

      &--description {
        font-size: 14px;
      }
    }

    &__image-details {
      display: flex;
      flex-direction: column;
      margin-bottom: 0;
      padding-top: 10px;
      line-height: 28px;

      span {
        color: #333;
      }
    }

    &__item {
      // &[data-elementor-open-lightbox="no"] {
      //   pointer-events: none;
      // }

      &:hover {
        .m-neuron-gallery__overlay {
          opacity: 1;
          visibility: visible;
        }
      }

      &--svg-img {
        .m-neuron-gallery__thumbnail img {
          object-fit: unset;
          object-position: unset;

          left: 50%;
          transform: translateX(-50%);
        }
      }
    }

    &__overlay {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;

      width: auto;
      height: auto;

      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      text-align: center;

      background-color: rgba(51, 51, 51, 0.8);

      transition: all $authenticMotion 300ms;

      opacity: 0;
      visibility: hidden;

      &--detail {
        color: #fff;
      }

      i {
        font-size: 22px;
        color: #fff;
      }
    }
  }

  // Item Ratio
  &.m-neuron-gallery--layout-masonry,
  &.m-neuron-gallery--layout-metro {
    .m-neuron-gallery__thumbnail--link {
      padding-bottom: 0;
      overflow: visible;

      img {
        position: relative;
      }
    }
  }

  &.m-neuron-gallery__overlay--bg-none {
    .m-neuron-gallery__overlay {
      background-color: inherit;
    }
  }

  &.m-neuron-gallery__overlay {
    // Animations
    &--hover-animation-translate {
      .m-neuron-gallery__item {
        &:hover {
          .m-neuron-gallery__overlay--detail {
            opacity: 1;
            transform: translateY(0);
          }
        }
      }

      .m-neuron-gallery__overlay--detail {
        transform: translateY(20px);
        transition-duration: 300ms;
        transition: opacity $easeOutQuad 300ms, transform $easeOutQuad 300ms;
        opacity: 0;
      }
    }

    &--hover-animation-scale {
      .m-neuron-gallery__item {
        &:hover {
          .m-neuron-gallery__overlay--detail {
            opacity: 1;
            transform: scale(1);
          }
        }
      }

      .m-neuron-gallery__overlay--detail {
        transform: scale(0.9);
        // transition-duration: $slow-time;
        transition: opacity $easeOutQuad 300ms, transform $easeOutQuad 300ms;

        backface-visibility: hidden;

        opacity: 0;
      }
    }

    &--hover-animation-tooltip,
    &--hover-animation-fixed {
      .m-neuron-gallery__overlay {
        display: none;
      }
    }

    &--hover-animation-fixed {
      .m-neuron-gallery {
        &__thumbnail--link {
          transition: opacity $easeOutSine 400ms;
          transition-delay: 0.05s;
        }
      }

      &.active
        .m-neuron-gallery__item
        .m-neuron-gallery__thumbnail--link:not(:hover) {
        opacity: 0.25;
      }
    }

    // Active
    &--active {
      .m-neuron-gallery {
        &__overlay {
          opacity: 1;
          visibility: visible;

          &--detail {
            transform: none;
            opacity: 1;
          }
        }
      }
    }

    // Reverse
    &--reverse {
      .m-neuron-gallery__thumbnail--link {
        &:hover {
          .m-neuron-gallery__overlay {
            opacity: 0;
            visibility: hidden;
          }
        }
      }
    }
  }

  .l-neuron-grid--item-ratio {
    .m-neuron-gallery__thumbnail {
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      position: absolute;

      &--link {
        padding-bottom: 56.25%;
      }
    }
  }

  .l-neuron-grid {
    &--masonry {
      align-items: flex-start;
    }

    &--metro {
      display: flex;

      @media (max-width: $screen-md-max) {
        .l-neuron-grid__item {
          max-width: 50% !important;
          flex: 0 0 50% !important;
        }
      }
    }
  }
}

// Animations
#a-tooltip-caption {
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity $easeOutSine 0.15s;
  position: fixed;
  z-index: 999;
  width: -webkit-fit-content;
  width: -moz-fit-content;
  width: fit-content;
  height: auto;

  &.active {
    opacity: 1;
    visibility: visible;
  }
}

.m-neuron-gallery {
  &--tooltip {
    &__inner {
      display: inline-block;
      position: relative;
      margin-top: 2.5rem;
      margin-left: calc(-50% + 90px);
    }

    &__detail {
      width: max-content;

      right: 0;

      opacity: 1;
      color: #000;
      background-color: #fff;

      display: inline-block;
      padding: 8px 25px;
      position: relative;
      z-index: 8;

      &:nth-child(2) {
        padding: 2px 10px 1px;
        position: absolute;
        margin-top: -22px;
        margin-right: -20px;
      }

      &:nth-child(3) {
        padding: 2px 10px 1px;
        position: absolute;
        margin-top: -48px;
        margin-right: -60px;
      }
    }
  }
}

#a-fixed-caption {
  pointer-events: none;
  @include fixed-element;
  z-index: 999;

  article {
    @include absolute-element;
    display: flex;
    align-items: center;
    justify-content: center;

    .m-neuron-gallery--fixed {
      &__inner {
        text-align: center;
        opacity: 0;
        visibility: hidden;
        transform: translateY(35px);
        transition: all $easeOutSine 200ms;

        display: flex;
        flex-direction: column;
      }

      &__detail {
        color: $extra-dark;
        z-index: 8;
        opacity: 1;
        line-height: 1;
        margin-bottom: 8px;

        &:nth-child(1) {
          font-size: 32px;
        }

        &:nth-child(2) {
          font-size: 20px;
        }

        &:nth-child(3) {
          font-size: 16px;
        }
      }
    }

    &.active {
      .m-neuron-gallery--fixed__inner {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
      }
    }
  }
}
