/* ============================================================
   NO-SHOP PRODUCT GALLERY
   ============================================================ */

.product-gallery-wrapper {
  --thumbs-visible: 5;
  --thumbs-gap: 10px;
  width: 100%;
}

/* ---------- GŁÓWNE ZDJĘCIE (statyczny kontener) ---------- */
.product-gallery-main {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #f5f5f5;
  margin-bottom: 16px;
}

.product-gallery-main[data-ratio="16-10"] { aspect-ratio: 16 / 10; }
.product-gallery-main[data-ratio="16-9"]  { aspect-ratio: 16 / 9; }
.product-gallery-main[data-ratio="4-3"]   { aspect-ratio: 4 / 3; }
.product-gallery-main[data-ratio="3-2"]   { aspect-ratio: 3 / 2; }
.product-gallery-main[data-ratio="1-1"]   { aspect-ratio: 1 / 1; }

.product-gallery-main-link {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 1;
}

.product-gallery-main-img {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  display: block;
  opacity: 1;
  transition: opacity 0.3s ease;
  will-change: opacity;
}

.product-gallery-main-img.is-fading {
  opacity: 0;
}

/* ---------- STRZAŁKI MINIATUR ---------- */
.product-gallery-thumbs-arrow {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #fff;
  color: #333;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, opacity 0.2s ease;
  user-select: none;
  align-self: center;
}

.product-gallery-thumbs-arrow:hover {
  background: #f0f0f0;
}

.product-gallery-thumbs-arrow.swiper-button-disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

/* ---------- TRYB GRID (flexbox) ---------- */
.product-gallery-thumbs-wrapper.product-gallery-thumbs-mode-grid {
  display: block;
}

.product-gallery-thumbs-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--thumbs-gap, 10px);
}

.product-gallery-thumbs-grid .product-gallery-thumb {
  flex: 0 0 calc((100% - (var(--thumbs-visible) - 1) * var(--thumbs-gap, 10px)) / var(--thumbs-visible));
  aspect-ratio: 16 / 10;
  height: auto;
  box-sizing: border-box;
}

/* ---------- TRYB SLIDER (Swiper) ---------- */
.product-gallery-thumbs-wrapper.product-gallery-thumbs-mode-slider {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.product-gallery-thumbs {
  flex: 1 1 auto;
  overflow: hidden;
  position: relative;
}

.product-gallery-thumbs .swiper-wrapper {
  display: flex;
  gap: var(--thumbs-gap, 10px);
}

/* Slajd - identyczny rozmiar jak w gridzie */
.product-gallery-thumbs .swiper-slide {
  flex: 0 0 calc((100% - (var(--thumbs-visible) - 1) * var(--thumbs-gap, 10px)) / var(--thumbs-visible));
  width: auto;
  height: auto;
  aspect-ratio: 16 / 10;
  box-sizing: border-box;
}

/* ---------- POJEDYNCZA MINIATURA (wspólne dla slidera i gridu) ---------- */
.product-gallery-thumb {
  position: relative;
  width: 100%;
  height: 100%;
  border: 2px solid transparent;
  background: #f0f0f0;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s ease, opacity 0.2s ease;
  opacity: 0.7;
  border-radius: 4px;
  box-sizing: border-box;
  padding: 0;
}

.product-gallery-thumb img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  display: block;
  pointer-events: none;
  border-radius: inherit;
}

.product-gallery-thumb:hover {
  opacity: 1;
}

.product-gallery-thumb.is-active {
  border-color: #0073aa;
  opacity: 1;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
  .product-gallery-wrapper {
    --thumbs-visible: 4;
  }
}

@media (max-width: 480px) {
  .product-gallery-wrapper {
    --thumbs-visible: 3;
  }
  .product-gallery-thumbs-arrow {
    width: 30px;
    height: 30px;
  }
}