/* ============================================================
   KLEAN KOSMETICS — TRENDING NOW  (trending.css)
   Mobile-first. Link AFTER style.css, hero.css, best-sellers.css, about.css:
     <link rel="stylesheet" href="assets/css/trending.css">

   Scoped to .trending. Cards are still rendered by home.js / engine.js into
   #trending-row; this file only lays out the row and restyles the cards inside it.

   Markup contract (index.html):
   <section class="section trending">
     <div class="container">
       <header class="trending__head reveal">
         <div>
           <span class="section__eyebrow">AI powered</span>
           <h2 class="trending__title"><span>Trending</span><span>now</span></h2>
         </div>
         <a class="trending__all" href="/shop">See all</a>
       </header>
       <div class="trending__row" id="trending-row"></div>
     </div>
   </section>

   Colours: only var(--clr-purple) / var(--clr-ink). Never hardcode the brand colour.
   ============================================================ */

.trending { background: var(--clr-bg); }

/* ── HEADER ──────────────────────────────────────────────────── */
.trending__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.trending__title {
  margin: 0;
  font-family: var(--ff-display);
  font-weight: 400;
  font-size: clamp(3.2rem, 15vw, 4.4rem);
  line-height: .88;
  letter-spacing: .01em;
  text-transform: uppercase;
  color: var(--clr-ink);
}
.trending__title span { display: block; }
/* Same stepped second line as the other section headlines. */
.trending__title span + span { padding-left: .5em; }

.trending__all {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 20px;
  border: 2px solid var(--clr-ink);
  border-radius: var(--radius-full);
  font-family: var(--ff-condensed);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: .03em;
  color: var(--clr-ink);
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.trending__all:active { transform: scale(.97); }
.trending__all:focus-visible { outline: 2px solid var(--clr-purple); outline-offset: 3px; }
@media (hover: hover) {
  .trending__all:hover { background: var(--clr-ink); color: #fff; }
}

/* ── SWIPE ROW ───────────────────────────────────────────────── */
/* On phones the row runs edge to edge and the next card peeks in, so it reads as swipeable. */
.trending__row {
  --edge: clamp(16px, 4vw, 48px);
  display: flex;
  gap: 12px;
  margin-inline: calc(-1 * var(--edge));
  padding: 0 var(--edge) 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--edge);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.trending__row::-webkit-scrollbar { display: none; }

/* Loading / empty / error messages that home.js drops in as a plain div. */
.trending__row > div:not(.product-card) { flex: 1 0 100%; }

/* ── CARD ────────────────────────────────────────────────────── */
.trending .product-card {
  flex: 0 0 62%;
  scroll-snap-align: start;
  background: transparent;
  border: 0;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
}
.trending .product-card:hover {
  transform: none;
  box-shadow: none;
  border-color: transparent;
}

.trending .product-card__image-wrap {
  border-radius: var(--radius-lg);
  background: #ececec;
}

.trending .product-card__add {
  width: 44px;
  height: 44px;
  min-height: 44px;
  bottom: 10px;
  right: 10px;
  background: var(--clr-purple);
  box-shadow: 0 4px 16px rgba(0,0,0,.28);
}

.trending .product-card__info { padding: 12px 2px 0; }

/* Everything here is trending, and ratings default to 5 stars, so both add noise.
   The green sale badge is not in .product-card__badges, so sales still show. */
.trending .product-card__badges,
.trending .product-card__rating { display: none; }

.trending .product-card__brand { margin-bottom: 2px; }
.trending .product-card__name {
  font-size: .95rem;
  line-height: 1.3;
  margin-bottom: 6px;
}
.trending .product-card__price { font-size: 1.2rem; }

/* ── LARGER SCREENS ──────────────────────────────────────────── */
@media (min-width: 640px) {
  .trending__row { gap: 16px; }
  .trending .product-card { flex-basis: 220px; }
}

@media (min-width: 900px) {
  .trending__head { margin-bottom: 36px; }
  .trending__title { font-size: clamp(4.5rem, 7vw, 6.5rem); }
  /* Inside the container again: no bleed, four cards visible, the rest scroll. */
  .trending__row {
    gap: 20px;
    margin-inline: 0;
    padding-inline: 0;
    scroll-padding-inline: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--clr-border) transparent;
  }
  .trending__row::-webkit-scrollbar { display: block; height: 4px; }
  .trending__row::-webkit-scrollbar-thumb { background: var(--clr-border); border-radius: 2px; }
  .trending .product-card { flex-basis: calc((100% - 60px) / 4); }
}

/* ── REDUCED MOTION ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .trending .reveal { opacity: 1; transform: none; transition: none; }
  .trending__all { transition: none; }
  .trending__row { scroll-behavior: auto; }
}
