/* Glow Standard — product gallery polish
   Enhancement layer over WooCommerce's FlexSlider gallery. */

.woocommerce-product-gallery {
  --gsg-rose: #e8a0bd;
  --gsg-gold: #c9a15b;
  --gsg-line: #f0dfe1;
  --gsg-text: #2e2027;
  --gsg-muted: #8a7680;
  --gsg-surface: #ffffff;

  position: relative;
  opacity: 1 !important; /* Woo fades this in via JS; keep it visible if JS is slow */
}

/* ---------- main image ---------- */

/* Round the images themselves rather than the slider container. FlexSlider
   sizes .flex-viewport with inline JS styles, and giving that element a
   border-radius + overflow + border promotes a compositing layer that stops
   the active slide painting in some browsers. Styling the img is safe. */

.woocommerce-product-gallery__image > a,
.woocommerce-product-gallery__image > img,
.woocommerce-product-gallery__image > a > img {
  border-radius: 24px;
  display: block;
}

/* A drop shadow would be clipped by the slider's own overflow:hidden, so a
   hairline edge does the work of separating the image from the page. */
.woocommerce-product-gallery__image > a > img,
.woocommerce-product-gallery__image > img {
  box-shadow: inset 0 0 0 1px rgba(46, 32, 39, .06);
}

/* ---------- lightbox trigger ---------- */

.woocommerce-product-gallery__trigger {
  position: absolute !important;
  top: 14px;
  right: 14px;
  z-index: 20;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--gsg-line);
  box-shadow: 0 6px 18px -8px rgba(46, 32, 39, .4);
  font-size: 0;
  color: var(--gsg-text);
  transition: transform .2s ease, background .2s ease;
}
.woocommerce-product-gallery__trigger:hover { transform: scale(1.06); background: #fff; }

/* hide Woo's emoji/text glyph and draw a real magnifier instead */
.woocommerce-product-gallery__trigger img,
.woocommerce-product-gallery__trigger span { display: none !important; }

.woocommerce-product-gallery__trigger::after {
  content: "";
  width: 17px;
  height: 17px;
  background-color: currentColor;
  -webkit-mask: var(--gsg-zoom-icon) center / contain no-repeat;
  mask: var(--gsg-zoom-icon) center / contain no-repeat;
}

.woocommerce-product-gallery {
  --gsg-zoom-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.9-3.9M11 8v6M8 11h6'/%3E%3C/svg%3E");
}

/* ---------- arrows (injected by gallery.js) ---------- */

.gsg-nav {
  position: absolute;
  top: 50%;
  z-index: 15;
  width: 42px;
  height: 42px;
  margin-top: -21px;
  display: grid;
  place-items: center;
  border: 1px solid var(--gsg-line);
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 6px 18px -8px rgba(46, 32, 39, .4);
  color: var(--gsg-text);
  cursor: pointer;
  padding: 0;
  opacity: 0;
  transition: opacity .22s ease, transform .22s ease, background .2s ease;
}
.gsg-nav--prev { left: 14px; transform: translateX(-6px); }
.gsg-nav--next { right: 14px; transform: translateX(6px); }

.woocommerce-product-gallery:hover .gsg-nav,
.gsg-nav:focus-visible { opacity: 1; transform: translateX(0); }

.gsg-nav:hover { background: #fff; }
.gsg-nav svg { width: 17px; height: 17px; }

/* touch devices have no hover — keep them visible */
@media (hover: none) {
  .gsg-nav { opacity: 1; transform: translateX(0); }
}

/* ---------- slide counter ---------- */

.gsg-count {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 15;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--gsg-text);
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--gsg-line);
  font-variant-numeric: tabular-nums;
}

/* ---------- thumbnails ---------- */

/* One row whatever the image count — a fixed 4-column grid leaves an
   orphan row on 5 or 6 images. Falls back to horizontal scroll if a
   product ever has more thumbs than will comfortably fit. */
.woocommerce-product-gallery .flex-control-thumbs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 12px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: thin;
}

.woocommerce-product-gallery .flex-control-thumbs li {
  margin: 0;
  padding: 0;
  list-style: none;
  width: auto !important;
  float: none !important;
}

.woocommerce-product-gallery .flex-control-thumbs img {
  box-sizing: border-box;   /* without this the 1px border overflows the track */
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  border-radius: 14px;
  border: 1px solid var(--gsg-line);
  cursor: pointer;
  opacity: .58;
  transition: opacity .22s ease, transform .22s ease, box-shadow .22s ease;
}

.woocommerce-product-gallery .flex-control-thumbs img:hover {
  opacity: .85;
  transform: translateY(-2px);
}

.woocommerce-product-gallery .flex-control-thumbs img.flex-active {
  opacity: 1;
  border-color: var(--gsg-rose);
  box-shadow: 0 0 0 2px var(--gsg-rose), 0 8px 18px -10px rgba(46, 32, 39, .45);
}

/* ---------- single-image products ---------- */
/* No thumbs, no arrows, no counter — just the rounded frame. */

.woocommerce-product-gallery--columns-4:not(:has(.flex-control-thumbs)) .gsg-nav,
.woocommerce-product-gallery--columns-4:not(:has(.flex-control-thumbs)) .gsg-count {
  display: none;
}

/* ---------- responsive ---------- */

@media (max-width: 600px) {
  .woocommerce-product-gallery__image > a,
  .woocommerce-product-gallery__image > img,
  .woocommerce-product-gallery__image > a > img { border-radius: 18px; }
  .woocommerce-product-gallery .flex-control-thumbs { gap: 8px; margin-top: 10px; }
  .woocommerce-product-gallery .flex-control-thumbs img { border-radius: 10px; }
  .gsg-nav { width: 36px; height: 36px; margin-top: -18px; }
  .gsg-nav--prev { left: 8px; }
  .gsg-nav--next { right: 8px; }
  .woocommerce-product-gallery__trigger { width: 36px; height: 36px; top: 10px; right: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .woocommerce-product-gallery .flex-control-thumbs img,
  .gsg-nav,
  .woocommerce-product-gallery__trigger { transition-duration: .01ms; }
  .woocommerce-product-gallery .flex-control-thumbs img:hover { transform: none; }
}
