/* Shared product gallery presentation. The Builder owns the gallery module. */
body.single-product .woocommerce-product-gallery.lp-pdp-gallery {
  display: grid !important;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  margin: 0;
  overflow: visible !important;
}

body.single-product .lp-pdp-gallery__thumbnails {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 72px;
  max-height: 100%;
  overflow-y: auto;
  scrollbar-width: thin;
}

body.single-product .lp-pdp-gallery__thumbnail {
  display: block;
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--gds-color-border, #dedfe2);
  border-radius: var(--gds-radius-card, 8px);
  background: var(--gds-color-surface, #fff);
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

body.single-product .lp-pdp-gallery__thumbnail[aria-selected="true"] {
  border: 2px solid var(--gds-color-text, #111316);
  box-shadow: var(--gds-shadow, rgba(0, 0, 0, 0.08) 2px 4px 12px);
}

body.single-product .lp-pdp-gallery__thumbnail:focus-visible {
  outline: 2px solid var(--gds-color-text, #111316);
  outline-offset: 2px;
}

body.single-product .lp-pdp-gallery__thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: cover;
}

body.single-product .woocommerce-product-gallery.lp-pdp-gallery > .woocommerce-product-gallery__wrapper {
  grid-column: 2;
  grid-row: 1;
  display: block !important;
  width: 100% !important;
  height: auto !important;
  min-width: 0;
  margin: 0 !important;
  overflow: hidden;
  transform: none !important;
  aspect-ratio: 1 / 1;
  border-radius: var(--gds-radius-media, var(--gds-radius-card, 8px));
  background: var(--gds-color-surface-muted, #f5f5f5);
  box-shadow: var(--gds-shadow, rgba(0, 0, 0, 0.08) 2px 4px 12px);
}

body.single-product .woocommerce-product-gallery.lp-pdp-gallery .woocommerce-product-gallery__image {
  display: none !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
}

body.single-product .woocommerce-product-gallery.lp-pdp-gallery .woocommerce-product-gallery__image.is-active {
  display: block !important;
}

body.single-product .woocommerce-product-gallery.lp-pdp-gallery .woocommerce-product-gallery__image[hidden] {
  display: none !important;
}

body.single-product .woocommerce-product-gallery.lp-pdp-gallery .woocommerce-product-gallery__image > a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: clamp(12px, 2vw, 24px);
}

body.single-product .woocommerce-product-gallery.lp-pdp-gallery .woocommerce-product-gallery__image img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  max-height: 100%;
  margin: 0 !important;
  object-fit: contain;
}

@media (max-width: 1023px) {
  body.single-product .woocommerce-product-gallery.lp-pdp-gallery {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 10px;
  }

  body.single-product .woocommerce-product-gallery.lp-pdp-gallery > .woocommerce-product-gallery__wrapper {
    grid-column: 1;
    grid-row: 1;
    aspect-ratio: 1 / 1;
  }

  body.single-product .lp-pdp-gallery__thumbnails {
    grid-column: 1;
    grid-row: 2;
    flex-direction: row;
    width: 100%;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 2px 5px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  body.single-product .lp-pdp-gallery__thumbnails::-webkit-scrollbar {
    display: none;
  }

  body.single-product .lp-pdp-gallery__thumbnail {
    width: 60px;
    height: 60px;
  }

  body.single-product .woocommerce-product-gallery.lp-pdp-gallery .woocommerce-product-gallery__image > a {
    padding: 14px;
  }

  /* Keep the support avatar from covering the purchase controls on mobile PDPs. */
  body.single-product #loq-wa-pro-cta {
    display: none !important;
  }

  /* Remove the widget's bubble offset when its message is hidden on PDPs. */
  body.single-product #loq-wa-pro-btn {
    transform: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.single-product .lp-pdp-gallery__thumbnail {
    transition: none;
  }
}
