/**
 * Product gallery slider (main + thumbs), ported from the jadubeauty
 * "lp-editorial-ritual" gallery.
 *
 * Desktop (>= 880px): thumbs in a 100px left column (vertical swiper) with
 * up/down nav buttons; main slider square with overlay arrows.
 * Mobile: main slider with dot pagination, horizontal thumbs below.
 */

.nr-product-gallery {
  --nr-gallery-hair: #e3ded6;
  --nr-gallery-ink: #3b3b3b;
  position: relative;
  width: 100%;
  margin: 0 auto;
}

.nr-product-gallery,
.nr-product-gallery * {
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* ------------------------------------------------------------------ */
/* Main slider                                                        */
/* ------------------------------------------------------------------ */

.nr-product-gallery .main-product-gallery {
  width: 100%;
  min-width: 0;
  margin: 0;
  border: 1px solid var(--nr-gallery-hair);
  aspect-ratio: 1 / 1;
  height: auto;
  align-self: start;
  overflow: hidden;
}

.nr-product-gallery .main-product-gallery .swiper-slide {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.nr-product-gallery .main-product-gallery .nr-product-gallery__image-link {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  padding: 10px;
}

.nr-product-gallery .main-product-gallery img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  cursor: crosshair;
}

/* WooCommerce jquery.zoom overlay image */
.nr-product-gallery .main-product-gallery .zoomImg {
  position: absolute !important;
  max-width: none !important;
  max-height: none !important;
  width: auto !important;
  height: auto !important;
  object-fit: none !important;
  cursor: crosshair;
  z-index: 3;
}

/* Arrows */

.nr-product-gallery .swiper-arrows {
  position: absolute;
  top: 40%;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  z-index: 2;
  pointer-events: none;
}

.nr-product-gallery .swiper-arrow {
  width: 35px;
  height: 35px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: all;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.nr-product-gallery .swiper-arrow:hover {
  background: rgba(255, 255, 255, 1);
  transform: scale(1.1);
}

.nr-product-gallery .swiper-arrow svg {
  width: 24px;
  height: 24px;
  fill: #333;
}

.nr-product-gallery .swiper-arrow-prev {
  margin-left: 6px;
}

.nr-product-gallery .swiper-arrow-next {
  margin-right: 6px;
}

.nr-product-gallery .swiper-arrow.swiper-button-disabled {
  opacity: 0.5;
}

/* Pagination dots (mobile) */

.nr-product-gallery .swiper-pagination {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px !important;
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 2;
}

.nr-product-gallery .swiper-pagination .swiper-pagination-bullet {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ccc;
  opacity: 1;
  transition: background 200ms;
}

.nr-product-gallery .swiper-pagination .swiper-pagination-bullet-active {
  background: #000 !important;
}

/* ------------------------------------------------------------------ */
/* Thumbnails                                                          */
/* ------------------------------------------------------------------ */

.nr-product-gallery__thumbs-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.48rem;
  min-height: 0;
  min-width: 0;
  align-self: start;
  overflow: hidden;
}

.nr-product-gallery__thumbs-nav {
  flex-shrink: 0;
  width: 2.2rem;
  height: 2.2rem;
  border: 1px solid var(--nr-gallery-hair);
  border-radius: 50%;
  background: #fff;
  color: var(--nr-gallery-ink);
  display: grid;
  place-content: center;
  padding: 0;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    opacity 0.2s ease;
}

.nr-product-gallery__thumbs-nav svg {
  width: 1.4rem;
  height: 1.4rem;
  fill: currentColor;
}

.nr-product-gallery__thumbs-nav:hover:not([hidden]) {
  border-color: var(--nr-gallery-ink);
  background: #fff;
}

.nr-product-gallery__thumbs-nav[hidden] {
  display: none !important;
}

.nr-product-gallery .thumbnail-gallery {
  display: block;
  width: 100%;
  margin: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.nr-product-gallery .thumbnail-gallery .swiper-slide {
  position: relative;
  width: 100px;
  max-width: 100px;
  height: 100px;
  max-height: 100px;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--nr-gallery-hair);
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.3s;
}

.nr-product-gallery .thumbnail-gallery .swiper-slide-thumb-active {
  outline: 1.5px solid var(--nr-gallery-ink);
  outline-offset: -1px;
}

.nr-product-gallery .thumbnail-gallery .swiper-slide img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ------------------------------------------------------------------ */
/* Layout                                                              */
/* ------------------------------------------------------------------ */

/* Mobile-first: main on top, horizontal thumbs below. */
.nr-product-gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
}

.nr-product-gallery__thumbs-col {
  order: 2;
  width: 100%;
}

.nr-product-gallery .thumbnail-gallery .swiper-slide {
  width: 72px;
  max-width: 72px;
  height: 72px;
  max-height: 72px;
}

@media (min-width: 880px) {
  .nr-product-gallery {
    grid-template-columns: minmax(0, 100px) minmax(0, 1fr);
  }

  .nr-product-gallery__thumbs-col {
    order: 0;
    width: auto;
  }

  .nr-product-gallery .thumbnail-gallery {
    width: 100px;
    max-width: 100px;
  }

  .nr-product-gallery .thumbnail-gallery .swiper-slide {
    width: 100px;
    max-width: 100px;
    height: 100px;
    max-height: 100px;
  }

  .nr-product-gallery .main-product-gallery .swiper-pagination {
    display: none !important;
  }
}
