/* ==========================================================================
   Product grid · product cards · filter bar · empty state · scroll reveal
   Desktop: 4 cards per row (see .product-grid) · Mobile: 2 cards per row
   ========================================================================== */

.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.7rem 0.8rem;
}

@media (min-width: 640px) {
  .product-grid { gap: 2rem 1rem; }
}

@media (min-width: 768px) {
  .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1100px) {
  .product-grid { gap: 2.5rem 1.5rem; }
}

/* ---------- card ---------- */
.product-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.product-card__media {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: var(--radius);
  background: radial-gradient(85% 75% at 50% 30%, #ffffff 0%, var(--tile) 62%, #ebeae7 100%);
}
.product-card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(15, 15, 17, 0.06);
  pointer-events: none;
  transition: box-shadow var(--t) ease;
}
.product-card:hover .product-card__media::after { box-shadow: inset 0 0 0 1px rgba(15, 15, 17, 0.18); }

.product-card:hover .bottle { transform: translateY(-8px) rotate(-1.6deg); }

/* a search suggestion was picked: ring + lift for a moment (same ring as the tile hover) */
.product-card__media { transition: box-shadow 0.45s ease, transform 0.45s var(--ease); }
.product-card.is-highlight .product-card__media {
  box-shadow: 0 0 0 4px #fff, 0 0 0 6px var(--ink), 0 30px 46px -26px rgba(15, 15, 17, 0.6);
  transform: translateY(-4px);
}

/* ---------- photos (js/images.js) ----------
   A photo fades in over the CSS-drawn fallback art; the art then fades out.
   If the file is missing the <img> is removed and the art simply stays. */
.media-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.media-img.is-loaded { opacity: 1; }

.media-img--product {
  object-fit: cover;                 /* square studio shots fill the card edge to edge */
  transition: opacity 0.5s ease, transform 0.6s var(--ease);
}
.product-card:hover .media-img--product { transform: scale(1.05); }

.media-img--cover { object-fit: cover; }

.has-img > .bottle,
.has-img > .gift {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0s linear 0.5s;
}

.product-card__sale {
  position: absolute;
  top: 10px;
  inset-inline-start: 10px;
  z-index: 2;
  padding: 0.25rem 0.6rem;
  letter-spacing: 0.08em;
}

.product-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.2rem;
  padding: 0.95rem 0.1rem 0;
}

.product-card__brand {
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.product-card__name {
  min-height: 2.8em;               /* keep two-line names aligned across a row */
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink);
}

/* one-line scent profile; wraps on narrow cards, never taller than three lines */
.product-card__desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--muted);
}

.product-card__price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.1rem 0.6rem;
  margin-top: auto;                /* prices line up along the bottom of every row */
  padding-top: 0.5rem;
}

.price { font-size: 1rem; font-weight: 700; color: var(--ink); }
.price--old { font-size: 0.8rem; font-weight: 400; color: var(--muted); text-decoration: line-through; }

.product-card__add { margin-top: 0.95rem; padding: 0.8rem 0.9rem; font-size: 0.84rem; }

/* Arabic scent line and labels */
html[lang="ar"] .product-card__desc { font-size: 0.8rem; line-height: 1.65; }
html[lang="ar"] .product-card__add { font-size: 0.9rem; }
html[lang="ar"] .product-card__sale { font-size: 0.74rem; }

/* ---------- filter bar (search / collection) ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-top: clamp(1.6rem, 4vw, 2.6rem);
  padding: 0.75rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 28px;
  font-size: 0.85rem;
  color: var(--muted);
}
.filter-bar strong { font-weight: 600; color: var(--ink); }
.filter-bar__clear {
  font-weight: 500;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.filter-bar__clear:hover { text-decoration-thickness: 2px; }

/* ---------- empty state ---------- */
.empty-state {
  padding: clamp(3rem, 8vw, 5rem) 1rem;
  text-align: center;
}
.empty-state__title { font-size: 1.25rem; font-weight: 600; color: var(--ink); }
.empty-state__text { margin: 0.5rem auto 1.5rem; max-width: 40ch; font-size: 0.9rem; color: var(--muted); }

/* ---------- scroll reveal (only when JS is running) ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.8s var(--ease);
  transition-delay: calc(var(--i, 0) * 70ms);
}
.js .reveal.is-in { opacity: 1; transform: none; }
