/* ============================================================
   CSJ Shop Core — PDP media gallery (images + video).
   Skin-neutral: built on the shared design tokens.
   Replaces the old .csj-pdp__stage / __thumbs / __zoommodal set.
   ============================================================ */

.csj-gallery { position: relative; }

.csj-gallery__stage {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: var(--color-surface-warm, #f2e6d6);
  box-shadow: 0 20px 48px rgba(42, 26, 14, 0.20);
}

/* Native swiping: the track scrolls, one slide snaps into view. */
.csj-gallery__track {
  position: relative;
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.csj-gallery__track::-webkit-scrollbar { display: none; }

.csj-gallery__slide {
  position: relative;
  flex: 0 0 100%;
  scroll-snap-align: start;
  aspect-ratio: 4 / 5;
  background: var(--color-surface-warm, #f2e6d6);
}
.csj-gallery__slide > a { display: block; width: 100%; height: 100%; cursor: zoom-in; }
.csj-gallery__slide img,
.csj-gallery__slide video,
.csj-gallery__embed {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  border: 0;
}

/* ---- Video ---------------------------------------------------------- */

.csj-gallery__playpause,
.csj-gallery__facade {
  border: none;
  cursor: pointer;
  padding: 0;
}
.csj-gallery__playpause {
  position: absolute; bottom: 14px; left: 14px; z-index: 2;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  color: var(--color-text, #2a1a0e);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  transition: background var(--duration-fast, 0.2s) var(--ease-out, ease);
}
.csj-gallery__playpause:hover { background: #fff; }
.csj-gallery__playpause.is-playing svg { display: none; }
.csj-gallery__playpause.is-playing::before {
  content: '';
  width: 12px; height: 14px;
  border-left: 4px solid currentColor;
  border-right: 4px solid currentColor;
}

.csj-gallery__facade {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  background: var(--color-surface-warm, #f2e6d6);
}
.csj-gallery__playicon {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 72px; height: 72px;
  display: grid; place-items: center;
  color: var(--color-text, #2a1a0e);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  box-shadow: 0 6px 24px rgba(42, 26, 14, 0.28);
  transition: transform var(--duration-fast, 0.2s) var(--ease-out, ease);
}
.csj-gallery__facade:hover .csj-gallery__playicon { transform: translate(-50%, -50%) scale(1.06); }

/* ---- Stage controls -------------------------------------------------- */

.csj-gallery__nav {
  position: absolute; top: 50%; z-index: 2;
  transform: translateY(-50%);
  width: 42px; height: 42px;
  display: grid; place-items: center;
  color: var(--color-text, #2a1a0e);
  background: rgba(255, 255, 255, 0.9);
  border: none; border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--duration-fast, 0.2s) var(--ease-out, ease), background var(--duration-fast, 0.2s);
}
.csj-gallery__nav--prev { left: 14px; }
.csj-gallery__nav--next { right: 14px; }
.csj-gallery__nav:hover { background: #fff; }
.csj-gallery__nav:disabled { opacity: 0 !important; pointer-events: none; }
.csj-gallery__nav:focus-visible { opacity: 1; }
/* Only a mouse can hover, so only a mouse gets hover-reveal. On touch the
   arrows would otherwise sit there invisible but tappable. */
@media (hover: hover) {
  .csj-gallery__stage:hover .csj-gallery__nav { opacity: 1; }
}
@media (hover: none) {
  .csj-gallery__nav { opacity: 1; }
}

.csj-gallery__counter {
  position: absolute; bottom: 14px; left: 50%; z-index: 2;
  transform: translateX(-50%);
  margin: 0;
  padding: 4px 12px;
  font-family: var(--font-body, sans-serif);
  font-size: var(--text-xs, 0.6875rem);
  letter-spacing: var(--tracking-wide, 0.06em);
  color: var(--color-text, #2a1a0e);
  background: rgba(255, 255, 255, 0.85);
  border-radius: 99px;
}

/* ---- Thumbstrip ------------------------------------------------------ */

.csj-gallery__thumbs {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.csj-gallery__thumbs::-webkit-scrollbar { display: none; }

.csj-gallery__thumb {
  position: relative;
  flex: 0 0 auto;
  width: 72px; height: 72px;
  padding: 0;
  border: 1.5px solid var(--color-border, #e8d4bf);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: none;
  transition: border-color var(--duration-fast, 0.2s) var(--ease-out, ease);
}
.csj-gallery__thumb.is-active { border: 2px solid var(--color-terra-500, #b85440); }
.csj-gallery__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.csj-gallery__thumbplay {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: #fff;
  background: rgba(26, 14, 8, 0.35);
}

/* PhotoSwipe sits above the mobile sticky bar. */
.pswp { --pswp-bg: #1a0e08; z-index: 600; }

@media (max-width: 820px) {
  .csj-gallery__nav { display: none; }
  .csj-gallery__thumb { width: 60px; height: 60px; }
}
