/**
 * GPBox Product Gallery styling
 */

/* Structure */
.product-gallery {
  display: grid;
  row-gap: 1.5rem;
  column-gap: 1.5rem;
  grid-template-columns: repeat(6, 1fr);
  justify-items: stretch;
  align-items: stretch;
  align-content: stretch;
  justify-content: stretch;
  grid-auto-flow: dense;

  width: 100%;
  max-width: 100%;

  content-visibility: auto;
  contain-intrinsic-size: auto 854px;
}

.product-gallery__item {
  justify-self: stretch;
  align-self: stretch;
  grid-row-end: span 1;
  grid-column-end: span 1;
}

.product-gallery__item:first-child,
.product-gallery:not(.small) .product-gallery__item:nth-child(7) {
  grid-row-end: span 2;
  grid-column-end: span 2;
}

.small .product-gallery__item:nth-child(4) {
  grid-row-end: span 2;
  grid-column-end: span 2;
}

/* Selector pills */
.product-gallery-grid .product-gallery-selector {
  white-space: nowrap;
  transition: border-color 295ms var(--bezier-nobounce), color 295ms var(--bezier-nobounce), background-color 295ms var(--bezier-nobounce);
  flex-shrink: 0;
}
.product-gallery-grid .product-gallery-selector.active {
  background-color: var(--dark-grey-clr);
  color: var(--text-white-clr);
  border-color: var(--dark-grey-clr) !important;
}
.product-gallery-grid .product-gallery-selector > h3 {
  font-size: 1rem;
  line-height: 1.5;
}
/* Image */
.product-gallery__thumbnail {
  overflow: hidden;
  z-index: 0; /*Safari fix*/
  transform: translateZ(0); /*Safari fix*/
  -webkit-transform: translateZ(0); /*Safari fix*/
  mask-image: -webkit-radial-gradient(circle, white 100%, black 100%); /*Safari fix*/
  -webkit-mask-image: -webkit-radial-gradient(circle, white 100%, black 100%); /*Safari fix*/
  border-radius: 8px;
  border: var(--border);
  margin-bottom: 0.25rem;
  height: calc(100% - 24px);
  position: relative;
  padding: 100% 0 0 0;
  aspect-ratio: 0 !important;
}
.product-gallery__thumbnail img {
  height: 100%;
  width: 100%;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  border-radius: 8px;
  object-fit: cover;
  transition: transform 295ms var(--bezier-nobounce);
}

.product-gallery__thumbnail img.loop-product__image-second {
  opacity: 0;
  transition: opacity 595ms var(--bezier-nobounce), transform 395ms var(--bezier-nobounce);
}

@media (hover: hover) and (pointer: fine) {
  .product-gallery__thumbnail:not(.product-pip):hover img {
    transform: scale(1.15);
  }
  .product-gallery__thumbnail.product-pip:hover img.loop-product__image-second {
    opacity: 1;
    transform: scale(1.05);
  }

  body.loaded .product-gallery__thumbnail.product-pip img.loop-product__image-second {
    display: block !important;
  }
}

.product-gallery__item a:target .product-gallery__thumbnail img,
.product-gallery__item a:focus .product-gallery__thumbnail img,
.product-gallery__item a:active .product-gallery__thumbnail img {
  opacity: 0.75;
}

/* Price */
.product-gallery__details .price {
  display: block;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.25rem;
  text-align: right;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-gallery__details .price del,
.product-gallery__details .price .sale-off {
  color: var(--dark-green-clr);
  font-weight: 400;
}

.product-gallery__details .woocommerce-price-suffix {
  display: none;
}

@media screen and (max-width: 37.5rem) {
  .product-gallery {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, 1fr);
    overflow: hidden;
    row-gap: 1rem;
    column-gap: 0.75rem;
    contain-intrinsic-size: auto 670px;
  }

  .product-gallery-grid {
    overflow-x: scroll;
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: none; /* Internet Explorer 10+ */
    scrollbar-width: none; /* Firefox */
  }

  .product-gallery-grid::-webkit-scrollbar {
    display: none; /* Safari and Chrome */
    width: 0; /* Remove scrollbar space */
    height: 0; /* Remove scrollbar space */
    background: transparent; /* Optional: just make scrollbar invisible */
  }

  .product-gallery__item:first-child,
  .small .product-gallery__item:nth-child(4),
  .product-gallery:not(.small) .product-gallery__item:nth-child(7) {
    grid-row-end: span 1;
    grid-column-end: span 1;
  }

  .product-gallery .product-gallery__item:nth-child(n + 7) {
    display: none;
  }

  .product-gallery__item:nth-child(4) {
    grid-row-end: span 2;
    grid-column-end: span 2;
  }
}

@media screen and (min-width: 37.5rem) and (max-width: 64rem) {
  .product-gallery {
    grid-template-columns: repeat(4, 1fr);
    contain-intrinsic-size: auto 644px;
  }
  .product-gallery__item:nth-child(n + 11) {
    display: none;
  }
}
