/* ============================================================
   AG54 — Product Image Gallery CSS
   Add after styles-ux.css:
   <link rel="stylesheet" href="/storefront/styles-gallery.css">
   ============================================================ */

/* ── Main gallery wrapper ────────────────────────────────────── */
.gallery {
  position: sticky;
  top: 90px;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* ── Main viewer ─────────────────────────────────────────────── */
.gallery__main {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--color-surface);
  aspect-ratio: 3 / 4;
  cursor: zoom-in;
}

.gallery__main-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 220ms ease, transform 220ms ease;
}

.gallery__main-img.swapping {
  opacity: 0;
  transform: scale(0.98);
}

/* Badge slot */
.gallery__badge {
  position: absolute;
  top: var(--space-4);
  left: var(--space-4);
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* View label (front / back / detail) */
.gallery__view-label {
  position: absolute;
  bottom: var(--space-4);
  right: var(--space-4);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(240, 237, 230, 0.6);
  background: rgba(10, 10, 10, 0.5);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  backdrop-filter: blur(4px);
  transition: opacity 200ms;
  pointer-events: none;
}

/* Prev / Next arrows */
.gallery__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: rgba(10, 10, 10, 0.55);
  border: 0.5px solid rgba(245, 241, 232, 0.15);
  color: rgba(240, 237, 230, 0.8);
  cursor: pointer;
  z-index: 3;
  opacity: 0;
  transition: opacity 160ms, background 160ms;
  backdrop-filter: blur(6px);
}
.gallery__main:hover .gallery__arrow { opacity: 1; }
.gallery__arrow:hover { background: rgba(10, 10, 10, 0.8); color: #F0EDE6; }
.gallery__arrow:focus-visible { opacity: 1; outline: 2px solid var(--color-accent); outline-offset: 2px; }
.gallery__arrow--prev { left: var(--space-3); }
.gallery__arrow--next { right: var(--space-3); }

/* Counter bubble */
.gallery__counter {
  position: absolute;
  bottom: var(--space-4);
  left: var(--space-4);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(240, 237, 230, 0.5);
  pointer-events: none;
}

/* ── Thumbnail strip ─────────────────────────────────────────── */
.gallery__thumbs {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.gallery__thumbs::-webkit-scrollbar { display: none; }

.gallery__thumb {
  flex-shrink: 0;
  width: 68px;
  height: 90px;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  border: 1.5px solid transparent;
  background: var(--color-surface);
  transition: border-color 160ms, opacity 160ms;
  opacity: 0.55;
  position: relative;
}

.gallery__thumb:hover { opacity: 0.85; }
.gallery__thumb:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

.gallery__thumb.active {
  border-color: var(--color-accent);
  opacity: 1;
}

.gallery__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Thumb label */
.gallery__thumb-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  padding: 3px 2px;
  background: rgba(10, 10, 10, 0.65);
  color: rgba(240, 237, 230, 0.7);
}

/* ── Lightbox / zoom overlay ────────────────────────────────── */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  animation: lb-in 200ms ease-out;
  cursor: zoom-out;
}
@keyframes lb-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.gallery-lightbox__img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  animation: lb-scale 200ms cubic-bezier(0.16, 1, 0.3, 1);
  cursor: default;
}
@keyframes lb-scale {
  from { transform: scale(0.94); }
  to   { transform: scale(1); }
}

.gallery-lightbox__close {
  position: absolute;
  top: var(--space-6);
  right: var(--space-6);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  color: #F0EDE6;
  font-size: 20px;
  border: none;
  cursor: pointer;
  transition: background 150ms;
}
.gallery-lightbox__close:hover { background: rgba(255, 255, 255, 0.2); }

.gallery-lightbox__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  color: #F0EDE6;
  border: none;
  cursor: pointer;
  font-size: 18px;
  transition: background 150ms;
}
.gallery-lightbox__arrow:hover { background: rgba(255, 255, 255, 0.2); }
.gallery-lightbox__arrow--prev { left: var(--space-6); }
.gallery-lightbox__arrow--next { right: var(--space-6); }

/* ── Mobile: horizontal scroll instead of sticky ──────────────── */
@media (max-width: 768px) {
  .gallery {
    position: static;
  }
  .gallery__thumb {
    width: 56px;
    height: 74px;
  }
}
