/* Product page. */

.product__breadcrumb {
  padding-top: var(--space-4);
}

.product {
  display: grid;
  gap: var(--space-6);
}

/* Gallery */

.product__gallery {
  margin-inline: calc(var(--gutter) * -1);
}

.gallery {
  position: relative;
}

.gallery__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}

.gallery__track::-webkit-scrollbar {
  display: none;
}

.gallery__slide {
  position: relative;
  aspect-ratio: 4 / 5;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  background: var(--surface-quiet);
  overflow: hidden;
}

.gallery__slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery__slide--preview {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 46%, var(--color-white) 0 42%, transparent 43%),
    var(--surface-brand);
}

.gallery__preview {
  width: 64%;
  filter: drop-shadow(0 1.25rem 1.5rem rgb(43 18 22 / 0.22));
}

/* The preview image keeps its own ratio; the generic slide image rule must not stretch it. */
.gallery__preview .tinted-bag__image {
  object-fit: contain;
}

.gallery__note {
  position: absolute;
  left: var(--space-5);
  bottom: var(--space-8);
  transform: rotate(-3deg);
}

.gallery__dots {
  position: absolute;
  inset: auto 0 var(--space-1);
  display: flex;
  justify-content: center;
  gap: 0;
  pointer-events: none;
}

/* The dot is small; the button around it is a full-size tap target. */
.gallery__dot {
  position: relative;
  width: 1.75rem;
  height: var(--tap-min);
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: auto;
}

.gallery__dot::after {
  content: '';
  position: absolute;
  inset: calc(50% - 0.25rem) calc(50% - 0.25rem);
  border-radius: 50%;
  background: rgb(255 255 255 / 0.7);
  box-shadow: 0 0 0 1px rgb(43 18 22 / 0.25);
  transition: transform var(--duration-fast) ease;
}

.gallery__dot[aria-current='true']::after {
  background: var(--color-coral-600);
  transform: scale(1.4);
}

/* Info column */

.product__info {
  display: grid;
  gap: var(--space-6);
  min-width: 0;
}

.product__head .badge {
  margin-bottom: var(--space-3);
}

.product__tagline {
  margin-top: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--text-lg);
}

.product__price {
  margin-top: var(--space-4);
  font-family: var(--font-display);
  font-size: var(--text-h2);
  line-height: 1;
}

.product__lead {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.product__addons {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.product__addons legend {
  padding: 0;
  margin-bottom: var(--space-3);
}

.product__actions {
  display: grid;
  gap: var(--space-3);
}

/* Sticky buy bar (phones and tablets) */

.buybar {
  position: fixed;
  inset: auto 0 0;
  z-index: var(--layer-buybar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--buybar-height);
  padding: var(--space-3) var(--gutter);
  padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border-subtle);
  background: var(--color-white);
  box-shadow: 0 -6px 18px rgb(43 18 22 / 0.08);
  animation: buybar-in var(--duration-base) var(--ease-out);
}

.buybar__summary {
  display: grid;
  min-width: 0;
}

.buybar__name {
  overflow: hidden;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.buybar__price {
  font-size: var(--text-lg);
}

@keyframes buybar-in {
  from {
    transform: translateY(100%);
  }
}

@media (min-width: 48rem) {
  .product__gallery {
    margin-inline: 0;
  }

  .gallery__track {
    border-radius: var(--radius-lg);
  }
}

@media (min-width: 64rem) {
  .product {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    align-items: start;
    gap: var(--space-9);
  }

  .product__gallery {
    position: sticky;
    top: calc(var(--header-height) + var(--space-5));
  }

  .product__actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .buybar {
    display: none;
  }
}

.product__title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.product__title-row .favorite-button {
  flex: none;
  margin-top: 0.1rem;
  background: var(--surface-quiet);
  box-shadow: none;
}
