/* ───── Product Card (shared across home & shop) ───── */

.product-mockup-card,
.product-skeleton {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  max-width: 100%;
  gap: 0;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--colors-hairline);
  border-radius: var(--rounded-lg);
  background: var(--colors-surface-card);
  align-content: start;
  contain: paint;
}

.product-mockup-card {
  cursor: pointer;
  transition: border-color 160ms ease;
}

.product-mockup-card:hover {
  border-color: var(--colors-hairline-strong);
}

.product-mockup-card[hidden] {
  display: none;
}

.product-mockup-card.is-oos {
  opacity: 0.5;
}

.product-image,
.skeleton-image {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1.18;
  min-height: 0;
  overflow: hidden;
  border-bottom: 1px solid var(--colors-hairline);
  border-radius: var(--rounded-lg) var(--rounded-lg) 0 0;
  background: var(--colors-canvas-soft);
  contain: paint;
  isolation: isolate;
}

.product-image > img,
.bundle-image-carousel img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
  object-position: center;
  transform-origin: center center;
  transition: none;
}

.product-image img {
  padding: clamp(8px, 2vw, 14px);
}

.product-mockup-card:hover .product-image > img {
  transform: none;
}

.product-info {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-top: 0;
}

.product-info > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
  align-self: flex-start;
}

.product-info h3 {
  overflow-wrap: anywhere;
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--colors-ink);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 400;
  letter-spacing: -0.36px;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.product-info p,
.bundle-summary {
  margin: 0;
  color: var(--colors-muted);
  font-size: 12px;
  line-height: 1.5;
}

.bundle-summary {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
  gap: 2px;
  text-align: right;
}

.product-info strong,
.product-price-wrap strong,
.product-price-current {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--colors-ink);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.product-price-current.is-discounted,
.product-mockup-card[data-discounted="true"] .product-price-wrap strong {
  color: var(--colors-price-discount);
}

.product-price-current.is-bundle-price,
.product-mockup-card[data-bundle-id] .product-price-wrap strong {
  color: var(--colors-price-bundle);
}

.product-price-original {
  color: var(--colors-muted);
  font-size: 11px;
  font-weight: 400;
  text-decoration: line-through;
}

.product-price-save {
  color: var(--colors-semantic-error);
  font-size: 12px;
  font-weight: 500;
}

.discount-badge,
.out-of-stock-badge,
.preorder-badge {
  border-radius: var(--rounded-xs);
  box-shadow: none;
}

.discount-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 8px;
  border: none;
  background: var(--colors-semantic-error);
  color: var(--colors-on-primary);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  pointer-events: none;
  z-index: 2;
}

.out-of-stock-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 8px;
  background: var(--colors-ink);
  color: var(--colors-canvas);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  pointer-events: none;
  z-index: 2;
}

.preorder-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 8px;
  background: var(--colors-preorder-blue);
  color: var(--colors-on-primary);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  pointer-events: none;
  z-index: 2;
}

.color-swatch-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.color-swatch {
  display: inline-grid;
  width: 14px;
  height: 14px;
  place-items: center;
  border: 1px solid rgba(38, 37, 30, 0.18);
  border-radius: var(--rounded-xs);
  background: var(--swatch-color);
}

.color-swatch-more {
  display: inline-flex;
  min-height: 16px;
  align-items: center;
  color: var(--colors-muted);
  font-size: 12px;
  line-height: 16px;
}

/* ───── Product Grid ───── */

.product-grid,
.shop-product-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
  max-width: var(--container);
}

.product-grid {
  display: grid;
  margin-inline: auto;
}

.bundles-section .product-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
}

.product-grid-wide {
  max-width: none;
}

.product-grid-empty {
  grid-column: 1 / -1;
  padding: 48px 24px;
  border: 1px dashed var(--colors-hairline);
  border-radius: var(--rounded-md);
  color: var(--colors-muted);
  font-size: 15px;
  text-align: center;
}

/* ───── Scroll Carousel ───── */

.scroll-carousel {
  --carousel-fade: transparent;
  width: 100%;
}

.scroll-arrow {
  display: none;
}

/* ───── Variant OOS ───── */

.variant-option.is-oos,
.product-detail-swatch.is-oos {
  opacity: 0.3;
  cursor: not-allowed;
}

.size-option.is-oos,
.product-detail-size.is-oos {
  opacity: 0.3;
  cursor: not-allowed;
  color: var(--colors-muted);
}

.variant-option.is-low-stock,
.product-detail-swatch.is-low-stock {
}

.size-option.is-low-stock,
.product-detail-size.is-low-stock {
  color: var(--colors-semantic-error);
}

.low-stock-warning {
  color: var(--colors-primary);
  font-size: 12px;
  font-weight: 500;
}

.oos-message {
  color: var(--colors-muted);
  font-size: 14px;
  font-style: italic;
}

/* ───── Skeleton ───── */

.product-skeleton {
  background: var(--colors-surface-card);
}

.skeleton-image {
  background: linear-gradient(90deg, var(--colors-canvas-soft) 25%, var(--colors-canvas-soft-2) 50%, var(--colors-canvas-soft) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-line {
  height: 14px;
  border-radius: var(--rounded-xs);
  background: linear-gradient(90deg, var(--colors-canvas-soft) 25%, var(--colors-canvas-soft-2) 50%, var(--colors-canvas-soft) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-line-name {
  height: 18px;
  width: 75%;
  margin-bottom: 4px;
}

.skeleton-line-name + .skeleton-line-name {
  width: 55%;
}

.skeleton-line-brand {
  height: 12px;
  width: 40%;
}

.skeleton-line-swatches {
  display: flex;
  gap: 6px;
  height: auto;
  background: none;
  animation: none;
  border-radius: 0;
}

.skeleton-swatch-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--colors-canvas-soft-2);
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-line-original-price {
  height: 11px;
  width: 50px;
}

.skeleton-line-current-price {
  height: 16px;
  width: 65px;
}

.product-skeleton .product-info {
  pointer-events: none;
}

.product-skeleton .product-price-wrap {
  gap: 3px;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ───── Responsive ───── */

@media (max-width: 1100px) {
  .product-grid,
  .shop-product-grid,
  .bundles-section .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
  }
}

@media (max-width: 767px) {
  .product-grid,
  .shop-product-grid,
  .bundles-section .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .scroll-carousel .product-grid {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-snap-type: x mandatory;
  }

  .scroll-carousel .product-grid::-webkit-scrollbar {
    display: none;
  }

  .product-info {
    min-height: 98px;
    padding: 12px;
  }

  .scroll-carousel .product-mockup-card {
    flex: 0 0 min(190px, 64vw);
    scroll-snap-align: start;
  }

  .scroll-carousel .product-skeleton {
    flex: 0 0 min(190px, 64vw);
    scroll-snap-align: start;
  }

  .bundles-section .scroll-carousel .product-mockup-card {
    flex-basis: min(178px, 60vw);
  }
}

@media (max-width: 520px) {
  .product-grid,
  .shop-product-grid,
  .bundles-section .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .bundles-section .product-grid {
    display: flex;
    overflow-x: auto;
  }

  .bundles-section .product-mockup-card {
    flex: 0 0 168px;
  }

  .bundles-section .product-skeleton {
    flex: 0 0 168px;
  }

  .product-info h3 {
    font-size: 15px;
    letter-spacing: -0.24px;
  }

  .product-info p,
  .bundle-summary,
  .product-info strong,
  .product-price-wrap strong,
  .product-price-current {
    font-size: 12px;
  }
}

@media (max-width: 380px) {
  .shop-product-grid {
    grid-template-columns: 1fr;
  }
}
