/*
 * FHEERA - Product Gallery
 * Lightweight, swipe-friendly gallery layer for the PDP.
 */

.pd-gallery {
  display: grid;
  gap: 0.9rem;
}

.pd-gallery__viewport {
  display: grid;
  gap: 0.75rem;
}

.pd-gallery__stage {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.3), rgba(240, 233, 224, 0.9)),
    #ede8e0;
  cursor: zoom-in;
  touch-action: pan-y;
}

#pdMainImage {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center top;
  opacity: 1;
  transition:
    opacity 0.36s var(--ease-luxury),
    transform 0.48s var(--ease-luxury);
  transform-origin: var(--zoom-origin-x, 50%) var(--zoom-origin-y, 50%);
  will-change: transform, opacity;
}

#pdMainImage.is-switching {
  opacity: 0;
  transform: scale(1.018);
}

.pd-gallery__stage.is-zoomed {
  cursor: zoom-out;
}

.pd-gallery__stage.is-zoomed #pdMainImage {
  transform: scale(1.72);
}

.pd-gallery__caption {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: rgba(23, 22, 20, 0.52);
  font-family: 'Jost', sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* thumb default border */
.pd-gallery__thumb {
  border: 1px solid var(--brand-border);
  background: rgba(255, 255, 255, 0.34);
  /* rest unchanged */
}

/* thumb active/hover border */
.pd-gallery__thumb:hover,
.pd-gallery__thumb:focus-visible,
.pd-gallery__thumb.is-active {
  border-color: var(--brand-gold-dim);
  transform: translateY(-2px);
  outline: none;
}

.pd-gallery__thumb:focus-visible {
  box-shadow: 0 0 0 3px rgba(184, 151, 90, 0.12);
}

/* caption color */
.pd-gallery__caption {
  color: var(--brand-soft);
  /* rest unchanged */
}

.product-img-placeholder {
  aspect-ratio: 4 / 5;
  display: grid;
  place-items: center;
  gap: 1rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.3), rgba(240, 233, 224, 0.9));
  color: rgba(23, 22, 20, 0.24);
  text-align: center;
  padding: 1.5rem;
}

.product-img-placeholder span {
  font-family: 'Jost', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

@media (min-width: 1024px) {
  .pd-gallery {
    grid-template-columns: minmax(5rem, 6rem) minmax(0, 1fr);
    align-items: start;
  }

  .pd-gallery__thumbs {
    grid-template-columns: 1fr;
    align-content: start;
  }

  .pd-gallery__viewport {
    gap: 1rem;
  }
}

@media (max-width: 767.98px) {
  .pd-gallery__thumbs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .pd-gallery__stage.is-zoomed #pdMainImage {
    transform: scale(1.32);
  }
}

@media (max-width: 479.98px) {
  .pd-gallery__caption {
    font-size: 0.62rem;
    letter-spacing: 0.12em;
  }

  .pd-gallery__thumbs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  #pdMainImage,
  .pd-gallery__thumb {
    transition: none;
  }
}
