.categories {
  position: relative;
  z-index: 3;
  margin-top: 0;
  padding: clamp(55px, 6vw, 88px) 0;
  border-radius: 0;
  background: linear-gradient(
    180deg,
    #17191c 0%,
    #1c1f23 150px,
    #202327 100%
  );
  color: #f3f1ec;
  box-shadow: none;
}

.categories::before {
  position: absolute;
  top: 20px;
  left: 50%;
  width: 45px;
  height: 3px;
  border-radius: 999px;
  background-color: rgba(23, 25, 28, 0.22);
  content: "";
  transform: translateX(-50%);
}

.categories__container {
  width: min(100% - 48px, 1440px);
  margin-inline: auto;
}

.categories__heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 35px;
  margin-bottom: clamp(28px, 4vw, 46px);
}

.categories__eyebrow {
  margin-bottom: 16px;
  color: #e0555d;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.categories h2 {
  max-width: 750px;
  font-size: clamp(2.7rem, 5vw, 5.4rem);
  font-weight: 620;
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.categories h2 span {
  display: block;
  color: #aeb2b7;
}

.categories__all {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
  color: #f3f1ec;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.categories__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.category-card {
  overflow: hidden;
  border: 1px solid rgba(23, 25, 28, 0.12);
  background-color: #ffffff;
  color: #17191c;
  transition:
    transform 220ms ease,
    box-shadow 220ms ease;
}

.category-card:hover {
  box-shadow: 0 22px 55px rgba(30, 32, 34, 0.12);
  transform: translateY(-5px);
}

.category-card__visual {
  position: relative;
  aspect-ratio: 4 / 3;
  min-height: 200px;
  overflow: hidden;
  background-color: #222529;
}

.category-card__number {
  position: absolute;
  top: 24px;
  left: 25px;
  z-index: 2;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
}

.category-card__surface {
  position: absolute;
  inset: 0;
  transition: transform 600ms ease;
}

.category-card:hover .category-card__surface {
  transform: scale(1.035);
}

/* Admin-uploaded card image (HomeProductGroups.ImageUrl) — fills the same box as the CSS
   surface artwork, cropped from the centre, with a soft top shade so the number stays legible. */
.category-card__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 600ms ease;
}

.category-card__visual:has(.category-card__image)::after {
  position: absolute;
  inset: 0 0 auto;
  z-index: 1;
  height: 90px;
  background: linear-gradient(rgba(0, 0, 0, 0.45), transparent);
  content: "";
  pointer-events: none;
}

.category-card:hover .category-card__image {
  transform: scale(1.035);
}

.category-card--ceramic .category-card__surface {
  background:
    linear-gradient(
      125deg,
      transparent 20%,
      rgba(255, 255, 255, 0.48) 48%,
      transparent 68%
    ),
    linear-gradient(145deg, #111418, #626970);
}

.category-card--wax .category-card__surface {
  background:
    radial-gradient(
      circle at 70% 45%,
      rgba(255, 255, 255, 0.3),
      transparent 9%
    ),
    linear-gradient(135deg, #080a0c, #34383d);
}

.category-card--wash .category-card__surface {
  background:
    radial-gradient(
      circle at 65% 50%,
      transparent 0 18%,
      rgba(190, 224, 235, 0.26) 18.5% 19%,
      transparent 19.5% 29%,
      rgba(190, 224, 235, 0.17) 29.5% 30%,
      transparent 30.5%
    ),
    linear-gradient(145deg, #172229, #45545d);
}

.category-card--surface .category-card__surface {
  background:
    linear-gradient(
      110deg,
      transparent 25%,
      rgba(255, 255, 255, 0.2) 49%,
      transparent 70%
    ),
    linear-gradient(145deg, #25282c, #777b7f);
}

.category-card__content {
  display: flex;
  min-height: 145px;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  padding: 25px;
}

.category-card h3 {
  margin-bottom: 8px;
  overflow: hidden;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.category-card__description {
  max-width: 410px;
  overflow: hidden;
  color: #686c70;
  font-size: 0.92rem;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.category-card__description p {
  margin: 0;
}

.category-card__arrow {
  display: grid;
  min-width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid #c6c7c5;
  border-radius: 50%;
  transition:
    color 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease;
}

.category-card:hover .category-card__arrow {
  border-color: #17191c;
  background-color: #17191c;
  color: #ffffff;
}

.categories.motion-ready .categories__heading,
.categories.motion-ready .category-card {
  opacity: 0;
  transform: translateY(35px);
}

.categories.motion-ready.is-visible .categories__heading,
.categories.motion-ready.is-visible .category-card {
  opacity: 1;
  transform: translateY(0);
}

.categories__heading,
.category-card {
  transition:
    opacity 650ms ease,
    transform 650ms cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 220ms ease;
}

.categories.is-visible .category-card:nth-child(1) { transition-delay: 100ms; }
.categories.is-visible .category-card:nth-child(2) { transition-delay: 180ms; }
.categories.is-visible .category-card:nth-child(3) { transition-delay: 260ms; }
.categories.is-visible .category-card:nth-child(4) { transition-delay: 340ms; }

.categories.motion-ready.is-visible .category-card:hover {
  transform: translateY(-5px);
}

@media (max-width: 760px) {
  .categories {
    margin-top: 0;
    padding: 48px 0 54px;
    border-radius: 0;
  }

  .categories__container {
    width: min(100% - 32px, 620px);
  }

  .categories__heading {
    display: grid;
    align-items: start;
  }

  .categories h2 {
    font-size: clamp(2.65rem, 12vw, 4rem);
  }

  .categories__all {
    width: max-content;
  }

  .categories__grid {
    grid-template-columns: 1fr;
  }

  .category-card__visual {
    min-height: 240px;
  }

  .category-card__content {
    min-height: 135px;
    padding: 21px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .category-card,
  .category-card__surface,
  .category-card__image,
  .category-card__arrow {
    transition: none;
  }
}
