/*
 * Product gallery controls (inc/product-gallery.php). Loaded after design.css,
 * whose thumbnail rules it refines: inactive thumbnails were drawn at half
 * opacity (WooCommerce's own rule, which is more specific than the theme's),
 * which read as disabled. The selectors here are written to outrank it.
 */

.single-product div.product .woocommerce-product-gallery .flex-viewport {
  position: relative;
}

/* Arrows: round, pale, thin ring, a soft shadow so they hold on a light or a dark picture. */
.mf-gal__nav {
  position: absolute;
  top: 50%;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  margin: 0;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: rgba(247, 246, 243, 0.92);
  color: var(--ink);
  box-shadow: 0 1px 8px rgba(20, 21, 24, 0.2);
  cursor: pointer;
  transform: translateY(-50%);
  transition: background-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.mf-gal__nav--prev {
  left: 0.8rem;
}

.mf-gal__nav--next {
  right: 0.8rem;
}

.mf-gal__nav:hover {
  background: #fff;
  box-shadow: 0 2px 12px rgba(20, 21, 24, 0.3);
  transform: translateY(-50%) scale(1.06);
}

.mf-gal__nav:active {
  transform: translateY(-50%) scale(0.97);
}

/* Counter: small, bottom corner, never in the way of a click. */
.mf-gal__count {
  position: absolute;
  right: 0.8rem;
  bottom: 0.8rem;
  z-index: 5;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: rgba(20, 21, 24, 0.62);
  color: #fff;
  font-size: var(--step--1);
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
  pointer-events: none;
}

/* The gallery is the keyboard target for the arrow keys. */
.mf-gal:focus-visible {
  outline-offset: 4px;
}

/* The picture invites a click: it opens the lightbox. */
.mf-gal .woocommerce-product-gallery__image a {
  cursor: zoom-in;
}

/* Thumbnails: side by side from the left with a 12px gap, a clear frame, the
   chosen one outlined dark, nothing faded. Storefront gives each thumbnail a
   14 % right margin and 1.6em below it (the wide gap, and the empty band under
   the strip); the selectors here outrank those (the attribute and :nth-child terms are there
   to beat Storefront's per-column and per-position rules). */
.single-product div.product .woocommerce-product-gallery .flex-control-thumbs {
  flex-wrap: nowrap;
  gap: 12px;
  justify-content: flex-start;
  overflow-x: auto;
  padding: 3px;
  scrollbar-width: thin;
}

.single-product div.product div.images.woocommerce-product-gallery[class*='--columns-'] .flex-control-thumbs li:nth-child(n) {
  flex: 0 0 5rem;
  width: 5rem;
  margin: 0;
  cursor: pointer;
}

.single-product div.product div.images.woocommerce-product-gallery .flex-control-thumbs li img {
  box-sizing: border-box;
  border: 1px solid var(--rule);
  background: var(--paper-bright);
  opacity: 1;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.single-product div.product div.images.woocommerce-product-gallery .flex-control-thumbs li img:hover {
  border-color: rgba(20, 21, 24, 0.5);
}

.single-product div.product div.images.woocommerce-product-gallery .flex-control-thumbs li img.flex-active {
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}

@media (max-width: 860px) {
  .mf-gal__nav {
    width: 2.2rem;
    height: 2.2rem;
  }

  .mf-gal__nav--prev {
    left: 0.5rem;
  }

  .mf-gal__nav--next {
    right: 0.5rem;
  }

  .mf-gal__count {
    right: 0.5rem;
    bottom: 0.5rem;
  }
}
