/* ================================================================
   SeeThru — Product Gallery (left media stack)
   Scoped under .stx-pdp--gallery. Masonry of the product media, each
   item keeping the natural aspect ratio of the source image / video.
   ================================================================ */

.stx-pdp--gallery { display: block; }

/* Large lead image on top, the rest in a masonry grid below. */
.stx-gallery { display: block; }

.stx-gallery__item {
  position: relative;
  border-radius: var(--stx-r-3);
  overflow: hidden;
  border: 1px solid var(--stx-ink-800);
  background: var(--stx-ink-900);
  line-height: 0; /* kill descender gap under media */
}

/* The lead — large, full width. */
.stx-gallery__item.is-lead { display: block; margin-bottom: 12px; }

/* Masonry for the remaining media — column gap + row gap. */
.stx-gallery__grid {
  column-count: 2;
  column-gap: 12px;
}
.stx-gallery__grid .stx-gallery__item {
  break-inside: avoid;
  margin: 0 0 12px; /* vertical (row) gap between stacked images */
}

/* Media inherits the source's aspect ratio. */
.stx-gallery__media { display: block; }
.stx-gallery__img,
.stx-gallery__video {
  display: block;
  width: 100%;
  height: auto; /* natural ratio */
}

/* Iframe embeds (YouTube/Vimeo) have no intrinsic ratio → 16:9 box. */
.stx-gallery__embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
}
.stx-gallery__iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---------- Corner tag ---------- */
.stx-gallery__tag {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 2;
  line-height: 1;
  font-family: var(--stx-font-mono);
  font-size: 10px;
  letter-spacing: var(--stx-ls-wide);
  text-transform: uppercase;
  color: var(--stx-ink-100);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 6px 10px;
  border-radius: var(--stx-r-pill);
}

/* ---------- Caption ---------- */
.stx-gallery__caption {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  z-index: 2;
  margin: 0;
  line-height: 1.45;
  color: var(--stx-ink-50);
  font-size: 13px;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.7);
}
.stx-gallery__caption .k {
  display: block;
  margin-bottom: 4px;
  font-family: var(--stx-font-mono);
  font-size: 10px;
  letter-spacing: var(--stx-ls-wide);
  text-transform: uppercase;
  color: var(--stx-ink-200);
}

/* ---------- Editor empty state ---------- */
.stx-gallery__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--stx-s-7);
  color: var(--stx-ink-400);
  font-size: 13px;
  line-height: 1.5;
}

/* Subtle swap transition on the lead item. */
.stx-gallery__item.is-lead .stx-gallery__img { transition: opacity var(--stx-dur-base) var(--stx-ease-out); }
.stx-pdp--gallery.is-swapping .stx-gallery__item.is-lead .stx-gallery__img { opacity: 0.35; }

/* ================================================================
   Responsive — horizontal swipe carousel on phones.
   ================================================================ */
@media (max-width: 600px) {
  /* `display: contents` lifts the grid items up so the lead + every photo
     become direct flex children of one horizontal scroller; each is an
     equal-width slide that snaps. The 80% basis leaves the next photo peeking,
     signalling there's more to swipe. */
  .stx-pdp--gallery .stx-gallery {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 12px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .stx-pdp--gallery .stx-gallery::-webkit-scrollbar { display: none; }
  .stx-pdp--gallery .stx-gallery__grid { display: contents; }
  .stx-pdp--gallery .stx-gallery__item.is-lead,
  .stx-pdp--gallery .stx-gallery__grid .stx-gallery__item {
    flex: 0 0 80%;
    margin: 0;
    scroll-snap-align: start;
  }
  .stx-gallery__caption { font-size: 12px; }
}
