/* Fixer's Forge in-card product gallery */
.ff-product-gallery {
  position: sticky;
  top: 18px;
  min-width: 0;
  overflow: visible;
}

.ff-gallery-viewport {
  display: flex;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  touch-action: pan-x pan-y;
  cursor: grab;
  user-select: none;
  -webkit-overflow-scrolling: touch;
  border: 1px solid rgba(20,37,29,.08);
  border-radius: 24px;
  background: #f3f5f2;
}

.ff-gallery-viewport::-webkit-scrollbar { display: none; }
.ff-gallery-viewport:active,
.ff-gallery-viewport.is-dragging { cursor: grabbing; scroll-behavior: auto; }
.ff-gallery-viewport:focus-visible { outline: 3px solid #ffca00; outline-offset: 4px; }

.ff-gallery-slide {
  display: grid;
  place-items: center;
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  min-width: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
}

.ff-gallery-slide img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  padding: clamp(14px,3vw,30px);
  object-fit: contain;
  pointer-events: none;
  background: transparent !important;
}

.ff-gallery-arrow {
  position: absolute;
  z-index: 5;
  top: calc(50% - 50px);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(13,75,54,.13);
  border-radius: 999px;
  background: rgba(255,255,255,.9);
  color: #0d4b36;
  box-shadow: 0 10px 28px rgba(23,54,42,.16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform .18s ease,background .18s ease;
}

.ff-gallery-arrow:hover { background: #fff; transform: scale(1.06); }
.ff-gallery-arrow:focus-visible { outline: 3px solid #ffca00; outline-offset: 3px; }
.ff-gallery-arrow-prev { left: 14px; }
.ff-gallery-arrow-next { right: 14px; }

.ff-gallery-position {
  position: absolute;
  z-index: 4;
  right: 14px;
  top: 14px;
  padding: 7px 11px;
  border: 1px solid rgba(255,255,255,.82);
  border-radius: 999px;
  background: rgba(13,75,54,.88);
  color: #fff;
  font-size: .72rem;
  font-weight: 850;
  line-height: 1;
  box-shadow: 0 8px 22px rgba(15,47,33,.17);
}

.ff-gallery-thumbs {
  display: flex;
  gap: 9px;
  width: 100%;
  margin-top: 11px;
  padding: 2px 2px 7px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}

.ff-gallery-thumbs button {
  display: grid;
  place-items: center;
  flex: 0 0 76px;
  width: 76px;
  height: 76px;
  padding: 0;
  overflow: hidden;
  scroll-snap-align: center;
  border: 1px solid rgba(13,75,54,.13);
  border-radius: 15px;
  background: #fff;
  transition: border-color .18s ease,box-shadow .18s ease,transform .18s ease;
}

.ff-gallery-thumbs button:hover,
.ff-gallery-thumbs button.is-active,
.ff-gallery-thumbs button:focus-visible {
  border-color: #159447;
  box-shadow: 0 0 0 3px rgba(21,148,71,.14);
  transform: translateY(-1px);
}

.ff-gallery-thumbs button:focus-visible { outline: 0; }
.ff-gallery-thumbs img { width: 100%; height: 100%; padding: 5px; object-fit: contain; pointer-events: none; }

@media (max-width:991.98px) {
  .ff-product-gallery { position: relative; top: auto; }
}

@media (max-width:767.98px) {
  .ff-gallery-viewport { border-radius: 17px; }
  .ff-gallery-slide img { padding: 10px; }
  .ff-gallery-arrow { top: calc(50% - 42px); width: 40px; height: 40px; }
  .ff-gallery-arrow-prev { left: 9px; }
  .ff-gallery-arrow-next { right: 9px; }
  .ff-gallery-position { top: 10px; right: 10px; }
  .ff-gallery-thumbs button { flex-basis: 62px; width: 62px; height: 62px; border-radius: 13px; }
}

@media (prefers-reduced-motion:reduce) {
  .ff-gallery-viewport { scroll-behavior: auto; }
  .ff-gallery-arrow,.ff-gallery-thumbs button { transition: none; }
}
