/*
 * Home promise strip (template-parts/home-promise-marquee.php): pill badges sliding right-to-left in a loop.
 * The track holds two identical groups and moves by exactly one group (-50%), so the loop is seamless.
 * Edges fade out; hover pauses; prefers-reduced-motion shows a still, wrapped row instead.
 */

/* The strip opens the band, so the band needs little space above it. */
.home-catalog {
  padding-top: var(--space-4);
}

/* Products under the strip: one row only (4 cards on desktop); smaller screens swipe sideways for the rest. */
.home-catalog .product-grid {
  grid-auto-flow: column;
  grid-template-columns: none;
  grid-auto-columns: calc((100% - 3 * var(--space-5)) / 4);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-block: var(--space-2) var(--space-4); /* room for the hover lift and shadow */
  margin-block: calc(-1 * var(--space-2)) calc(-1 * var(--space-4));
}

.home-catalog .product-grid::-webkit-scrollbar {
  display: none;
}

.home-catalog .product-grid > li {
  scroll-snap-align: start;
}

@media (max-width: 899px) {
  .home-catalog .product-grid {
    grid-auto-columns: calc((100% - 2 * var(--space-5)) / 3);
  }
}

/* Phones: two cards and a peek of the next one, so it is clear the row scrolls. */
@media (max-width: 599px) {
  .home-catalog .product-grid {
    grid-auto-columns: 44%;
    gap: var(--space-3);
  }
}

.promise-marquee {
  overflow: hidden;
  margin-bottom: var(--space-4);
  padding-block: var(--space-1);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.promise-marquee__track {
  display: flex;
  width: max-content;
  animation: promise-marquee-slide 36s linear infinite;
}

.promise-marquee:hover .promise-marquee__track {
  animation-play-state: paused;
}

.promise-marquee__group {
  display: flex;
  gap: var(--space-3);
  margin: 0;
  padding: 0 var(--space-3) 0 0; /* same gap after the last badge as between badges */
  list-style: none;
}

.promise-marquee__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.3rem var(--space-3) 0.3rem 0.3rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  color: var(--color-text);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
}

.promise-marquee__icon {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0.28rem;
  border-radius: 50%;
  background: var(--color-primary-soft);
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@keyframes promise-marquee-slide {
  to {
    transform: translateX(-50%);
  }
}

/* No motion: one still, centred, wrapping row (the duplicate copies are hidden). */
@media (prefers-reduced-motion: reduce) {
  .promise-marquee {
    mask-image: none;
  }

  .promise-marquee__track {
    width: auto;
    animation: none;
  }

  .promise-marquee__group {
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    padding: 0;
  }

  .promise-marquee__group[aria-hidden='true'],
  .promise-marquee__badge:nth-child(n + 5) {
    display: none;
  }
}
