/* ============================================================================
   Product card + grid
   Measured: card 290x421, image box 268x268, title 14.4px, add-to-cart
   11.52px/700 uppercase with 2px #3b1f11 border.
   ========================================================================= */

/* The source row carries -10px side margins, so 4 cards span 1160px inside the
   1140px row and each card measures 290px. */
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin: 0 -10px;
}
.product-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.product-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.product-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }

.product-card {
  padding: 0 9.8px 19.6px;   /* measured on the source card */
  text-align: center;
  display: flex;
  flex-direction: column;
}

/* Flatsome's .box — the 1px border that frames the image and text block. */
.product-box {
  border: 1px solid #ccc;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

.product-media {
  position: relative;
  display: block;
  overflow: hidden;
  background: #f7f7f7;
  aspect-ratio: 1 / 1;
}
.product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--t-slow), opacity var(--t);
}
.product-card:hover .product-media img { transform: scale(1.04); }

/* Second image fades in on hover, as in the source theme */
.product-media .img-alt {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--t);
}
.product-card:hover .product-media .img-alt { opacity: 1; }

.product-body {
  padding: 10.08px 10px 20.16px;   /* measured from .box-text */
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

/* The source reserves two lines in a wrapper while the link itself is one line. */
.product-title-wrap {
  display: block;
  line-height: 18.72px;   /* the strut must match the link, or line boxes grow */
  min-height: 40.32px;    /* two-line slot, as measured on the source */
}
.product-title {
  display: inline;
  font-size: var(--fs-product);
  font-weight: 400;
  line-height: 18.72px;
  color: var(--ink);
  margin: 1.44px 0;
  transition: color var(--t-fast);
}
.product-title:hover { color: var(--primary); }

.product-price {
  font-size: var(--fs-product);
  line-height: 1;
  margin-top: 4px;
  color: var(--ink);
  font-weight: 400;
}
/* The amount itself is the red, bold part — measured: #ff0000, 16px, 700 */
.product-price .amount {
  color: var(--price);
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
}
.product-price del {
  color: var(--muted);
  font-weight: 400;
  margin-right: .3em;
  font-size: .9em;
}
.product-price.is-empty { color: var(--muted); font-weight: 400; }

.product-actions { margin-top: auto; padding-top: 11.52px; }

/* Source add-to-cart: no vertical padding, height driven by line-height. */
.product-actions .btn {
  padding: 0 13.824px;
  line-height: 25.2288px;
  height: 29.2px;
}

/* Out-of-stock band across the photo, exactly as the source renders it:
   a translucent white strip with centred uppercase text. */
.ribbon-out {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  background: rgba(255, 255, 255, .82);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: center;
  padding: 7px 0;
}

/* Badges */
.badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 3px 8px;
  color: #fff;
  background: var(--price);
}
.badge.out { background: var(--ink-3); }

/* ------------------------------------------------------------- responsive */

@media (max-width: 1100px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 849px) {
  /* Source uses small-columns-2 on mobile and keeps the same 9.8px gutters.
     Measured on the source at 390px: card 205x347, image 183, title 13.6px,
     price 13.6px (amount stays 16px), button 10.88px.

     The -10px row margin only works when the container keeps its own gutter;
     on mobile the product sections drop it, so the grid ran 20px wider than
     the viewport and clipped the right-hand card. Give the container a 10px
     gutter here so content and row margin cancel out exactly. */
  .product-grid, .product-grid.cols-3, .product-grid.cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .product-card { padding: 0 9.8px 19.6px; }
  .product-title { font-size: 13.6px; line-height: 17.68px; margin: 1.36px 0; }
  .product-title-wrap { line-height: 17.68px; min-height: 38.08px; }
  .product-price { font-size: 13.6px; }
  .product-price .amount { font-size: 16px; }
  .product-body { padding: 9.52px 9.8px 19.04px; }
  .product-actions { padding-top: 10.88px; }
  .product-actions .btn {
    padding: 0 13.056px;
    font-size: 10.88px;
    letter-spacing: .3264px;
    line-height: 23.8272px;
    height: 27.8px;
    white-space: normal;
  }
}

/* ------------------------------------------------------------- carousel -- */

.carousel { position: relative; margin: 0 -10px; }

.carousel-track {
  display: flex;
  gap: 0;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track > .product-card {
  flex: 0 0 25%;
  max-width: 25%;
}

.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--line);
  color: var(--primary);
  display: grid;
  place-items: center;
  z-index: 6;
  opacity: 0;
  transition: opacity var(--t-fast), background var(--t-fast);
  box-shadow: var(--shadow-sm);
}
.carousel:hover .carousel-nav { opacity: 1; }
.carousel-nav:hover { background: #fff; }
.carousel-nav.prev { left: 0; }
.carousel-nav.next { right: 0; }
.carousel-nav[disabled] { opacity: 0 !important; pointer-events: none; }

@media (max-width: 849px) {
  .carousel-track > .product-card { flex: 0 0 50%; max-width: 50%; }
  .carousel-nav { display: none; }
}
