/* Product gallery: thumbnail rail beside a large main image. */

.st-gallery {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 16px;
  align-items: start;
}

.st-gallery__thumbs {
  display: grid;
  gap: 10px;
}

.st-gallery__thumb {
  display: block;
  width: 92px;
  min-height: var(--st-h-touch);
  padding: 0;
  background: var(--st-surface-2);
  border: var(--st-border-width) solid var(--st-hairline);
  cursor: pointer;
  transition: border-color var(--st-transition);
}

.st-gallery__thumb:hover,
.st-gallery__thumb:active {
  border-color: var(--st-ink);
}

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

.st-gallery__main {
  position: relative;
  background: var(--st-surface-2);
  border: var(--st-border-width) solid var(--st-ink);
}

/* 27 of 30 seeded products have no image, and a product with none renders no
   thumbnail rail — which left the main image as the grid's FIRST item, sitting
   in the 92px thumbnail track. Measured: a 1000x1000 placeholder painted at
   88x88 inside a 92x92 box. With no rail there is nothing to sit beside, so
   span both tracks. */
.st-gallery__main:first-child {
  grid-column: 1 / -1;
}

.st-gallery__image {
  width: 100%;
  height: auto;
  object-fit: cover;
}

.st-gallery__badge {
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  z-index: 2;
}

@media (max-width: 899px) {
  /* Thumbnails move under the main image once the columns stack. */
  .st-gallery {
    grid-template-columns: 1fr;
  }

  .st-gallery__thumbs {
    grid-auto-flow: column;
    grid-auto-columns: 92px;
    overflow-x: auto;
    order: 2;
  }
}
