/* ===== Category hero banner ===== */
.nh-cat-hero {
  position: relative;
  border-radius: var(--nh-radius-xl);
  overflow: hidden;
  min-height: 22rem;
  padding: 3.6rem 4rem;
  display: flex;
  align-items: center;
}

.nh-cat-hero--tint-sage {
  background: var(--nh-sage-tint);
}

.nh-cat-hero--tint-blush {
  background: var(--nh-blush);
}

.nh-cat-hero--tint-sand {
  background: var(--nh-sand);
}

.nh-cat-hero__content {
  position: relative;
  z-index: 1;
  max-width: 56rem;
}

.nh-cat-hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--nh-white);
  color: var(--nh-ink);
  font-size: 1.25rem;
  font-weight: 700;
  padding: 0.7rem 1.4rem;
  border-radius: var(--nh-radius-pill);
  margin-bottom: 1.6rem;
}

.nh-cat-hero__badge svg {
  width: 1.4rem;
  height: 1.4rem;
  color: var(--nh-sage);
}

.nh-cat-hero__title {
  font-size: 3.2rem;
  font-weight: 900;
  margin: 0 0 1.2rem;
  letter-spacing: -0.02em;
  color: var(--nh-charcoal);
}

.nh-cat-hero__description {
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.8;
  color: var(--nh-body);
  margin: 0;
}

.nh-cat-hero__art {
  position: absolute;
  bottom: 2rem;
  inset-inline-end: 4rem;
  color: rgba(43, 39, 34, 0.18);
  z-index: 0;
}

.nh-cat-hero__art svg {
  width: 9rem;
  height: 9rem;
}

@media screen and (max-width: 749px) {
  .nh-cat-hero {
    padding: 3rem 2.4rem;
    min-height: unset;
  }

  .nh-cat-hero__content {
    text-align: start;
    margin-inline-start: 0;
  }

  .nh-cat-hero__title {
    font-size: 2.4rem;
  }

  .nh-cat-hero__art {
    display: none;
  }
}

/* ===== Filter bar ===== */
.nh-cat-filter__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.6rem;
  margin: 2.4rem 0 1.2rem;
}

.nh-cat-filter__sort {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.nh-cat-filter__sort-select {
  appearance: none;
  background: var(--nh-white);
  border: 1px solid var(--nh-border);
  border-radius: var(--nh-radius-md);
  /* Room for the arrow on its side (inline-end), in either direction. */
  padding-block: 1rem;
  padding-inline: 1.4rem 3.6rem;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--nh-ink);
  font-family: inherit;
  cursor: pointer;
}

.nh-cat-filter__sort svg {
  position: absolute;
  inset-inline-end: 1.4rem;
  width: 1rem;
  height: 1rem;
  color: var(--nh-muted);
  pointer-events: none;
}

.nh-cat-filter__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.nh-cat-filter__pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.9rem 1.6rem;
  border-radius: var(--nh-radius-pill);
  border: 1px solid var(--nh-border);
  background: var(--nh-white);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--nh-body);
  cursor: pointer;
  font-family: inherit;
}

.nh-cat-filter__pill.is-active {
  background: var(--nh-sand);
  border-color: var(--nh-amber);
  color: var(--nh-amber-deep);
}

.nh-cat-filter__count {
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--nh-muted);
  margin: 0 0 2rem;
}

/* ===== Product grid =====
   Every Nahleh product grid (collection, homepage, search, related products). A grid track, not a
   flex row: a lone card on the last row keeps its column's width and sits at the start.
   --nh-cols / --nh-cols-mobile carry a section's column settings. */
.nh-cat-grid {
  display: grid;
  grid-template-columns: repeat(var(--nh-cols, 4), minmax(0, 1fr));
  gap: 1.8rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Without this, iPhone Safari refuses to shrink a grid item below its
   image's intrinsic width (500-1000px), blowing one card up to fill the
   whole screen. Chrome clamps this on its own; WebKit needs it explicit. */
.nh-cat-grid > li {
  display: flex;
  min-width: 0;
}

@media screen and (max-width: 989px) {
  .nh-cat-grid {
    grid-template-columns: repeat(var(--nh-cols-mobile, 2), minmax(0, 1fr));
  }
}

@media screen and (max-width: 480px) {
  .nh-cat-grid {
    gap: 1.2rem;
  }
}

/* ===== Product card =====
   One card everywhere (themes/nahleh/sections/ProductCard.tsx). Cards in a row line up: the card fills
   its row's height, the rating row is reserved even when empty, the title is always two lines tall,
   and the footer (cart button + price) sits at the bottom. */
.nh-cat-card {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--nh-white);
  border: 1px solid var(--nh-border);
  border-radius: var(--nh-radius-xl);
  overflow: hidden;
  transition: transform 0.18s ease;
}

.nh-cat-card:hover {
  transform: translateY(-3px);
}

.nh-cat-card__media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  padding: 2rem;
  /* One neutral backdrop for every card (it used to rotate sand / blush / sage by position). */
  background: var(--nh-cream);
}

/* height: auto + the image's own aspect-ratio instead of height: 100% —
   WebKit resolves a percentage height against the aspect-ratio parent
   unreliably and can render the image at its intrinsic size instead. */
.nh-cat-card__media img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
}

.nh-cat-card__media svg {
  width: 6rem;
  height: 6rem;
  color: var(--nh-amber-deep);
  opacity: 0.75;
}

.nh-cat-card__badge {
  position: absolute;
  top: 1.2rem;
  inset-inline-start: 1.2rem;
  font-size: 1.15rem;
  font-weight: 800;
  padding: 0.4rem 1rem;
  border-radius: var(--nh-radius-pill);
  color: var(--nh-white);
}

.nh-cat-card__badge--new {
  background: var(--nh-sage);
}

.nh-cat-card__badge--sale {
  background: var(--nh-coral);
}

.nh-cat-card__badge--soldout {
  background: var(--nh-charcoal);
}

.nh-cat-card__body {
  flex: 1 1 auto;
  padding: 1.6rem 1.8rem 1.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.nh-cat-card__rating {
  display: flex;
  align-items: center;
  min-height: 1.8rem;
  gap: 0.4rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--nh-ink);
}

.nh-cat-card__rating svg {
  width: 1.2rem;
  height: 1.2rem;
  color: var(--nh-amber-gold);
}

.nh-cat-card__rating span {
  color: var(--nh-muted);
  font-weight: 500;
}

.nh-cat-card__title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--nh-charcoal);
  text-decoration: none;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  /* Exactly two lines tall, also for a one-line title. */
  min-height: calc(1.4em * 2);
}

.nh-cat-card__footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.8rem;
  margin-block-start: auto;
  padding-block-start: 0.4rem;
}

/* The old price, then the current one: each on one line ("15.000 د.أ" never splits), a clear gap
   between them; on a phone they stack, the struck-through price above. */
.nh-cat-card__price {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: flex-end;
  gap: 0.2rem 1rem;
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--nh-charcoal);
}

.nh-cat-card__was,
.nh-cat-card__now {
  white-space: nowrap;
}

.nh-cat-card__was {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--nh-muted);
}

@media screen and (max-width: 749px) {
  .nh-cat-card__price {
    flex-direction: column;
    align-items: flex-end;
  }
}

.nh-cat-card__cart {
  width: 3.6rem;
  height: 3.6rem;
  border-radius: var(--nh-radius-md);
  border: 1px solid var(--nh-amber);
  background: var(--nh-white);
  color: var(--nh-amber-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.nh-cat-card__cart svg {
  width: 1.6rem;
  height: 1.6rem;
}

.nh-cat-card__cart.is-loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ===== Promo card ===== */
.nh-cat-promo {
  background: var(--nh-charcoal);
  border-radius: var(--nh-radius-xl);
  padding: 2.4rem 2.2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  min-height: 20rem;
}

.nh-cat-promo__badge {
  width: 3.6rem;
  height: 3.6rem;
  border-radius: 50%;
  background: rgba(235, 177, 52, 0.15);
  color: var(--nh-amber-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 1.6rem;
}

.nh-cat-promo__heading {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--nh-cream);
  margin: 0 0 0.8rem;
}

.nh-cat-promo__text {
  font-size: 1.3rem;
  font-weight: 500;
  line-height: 1.7;
  color: rgba(251, 248, 243, 0.65);
  margin: 0 0 1.6rem;
}

.nh-cat-promo__link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--nh-amber-gold);
  text-decoration: none;
}

.nh-cat-promo__link .icon-arrow {
  width: 1.2rem;
}

/* Homepage grids (featured collection): a card that would sit alone in the last row is left out, so the
   rows stay full — 5 products in 2 columns show as 4. Collection pages keep every product. */
@media screen and (min-width: 990px) {
  .nh-cat-grid--no-orphan[data-cols="2"] > li:nth-child(2n+1):last-child:not(:first-child),
  .nh-cat-grid--no-orphan[data-cols="3"] > li:nth-child(3n+1):last-child:not(:first-child),
  .nh-cat-grid--no-orphan[data-cols="4"] > li:nth-child(4n+1):last-child:not(:first-child),
  .nh-cat-grid--no-orphan[data-cols="5"] > li:nth-child(5n+1):last-child:not(:first-child),
  .nh-cat-grid--no-orphan[data-cols="6"] > li:nth-child(6n+1):last-child:not(:first-child) {
    display: none;
  }
}

@media screen and (max-width: 989px) {
  .nh-cat-grid--no-orphan[data-cols-mobile="2"] > li:nth-child(2n+1):last-child:not(:first-child) {
    display: none;
  }
}
