/**
 * Homepage category cards: rhythmic grid with in-photo labels.
 *
 * Sizes are POSITIONAL, not per-term: slots 1-2 are big, 3-5 small, 6+ medium
 * rows of two. The editor picks the "big" categories simply by ordering the
 * terms (taxonomy drag & drop); a new category takes the size of its slot and
 * an orphan last card stretches full width, so the grid can never break.
 * Selector chains mirror the legacy style.css depth to win the cascade.
 */

.wrapper-product-categories .home-product-categories-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}

/* --- Positional sizes. */
.wrapper-product-categories .home-product-categories-grid .home-product-categories--item {
  position: relative;
  min-height: 0;
}

.wrapper-product-categories .home-product-categories-grid .home-product-categories--item:nth-child(-n+2) {
  grid-column: span 3;
  height: 280px;
}

.wrapper-product-categories .home-product-categories-grid .home-product-categories--item:nth-child(n+3):nth-child(-n+5) {
  grid-column: span 2;
  height: 210px;
}

.wrapper-product-categories .home-product-categories-grid .home-product-categories--item:nth-child(n+6) {
  grid-column: span 3;
  height: 240px;
}

/* Orphan: from slot 6 cards pair up (6-7, 8-9, ...); when the last one lands
   alone on an even slot it stretches across the row. */
.wrapper-product-categories .home-product-categories-grid .home-product-categories--item:nth-child(n+6):nth-child(even):last-child {
  grid-column: span 6;
}

/* --- Card: photo full-bleed, scrim, in-photo label. */
.wrapper-product-categories .home-product-categories-grid .home-product-categories--item .catcard {
  position: absolute;
  inset: 0;
  display: block;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(0, 47, 133, 0.08);
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
}

.wrapper-product-categories .home-product-categories-grid .home-product-categories--item:hover .catcard {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(0, 47, 133, 0.18);
}

.wrapper-product-categories .home-product-categories-grid .home-product-categories--item .catcard__media,
.wrapper-product-categories .home-product-categories-grid .home-product-categories--item .catcard__media .field--name-field-prodcat-image {
  position: absolute;
  inset: 0;
}

.wrapper-product-categories .home-product-categories-grid .home-product-categories--item .catcard__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.25s ease-out;
}

.wrapper-product-categories .home-product-categories-grid .home-product-categories--item:hover .catcard__media img {
  transform: scale(1.05);
}

/* Local scrim: bottom band only, the scene stays clean above. */
.wrapper-product-categories .home-product-categories-grid .home-product-categories--item .catcard__scrim {
  position: absolute;
  inset: auto 0 0 0;
  height: 62%;
  background: linear-gradient(to top, rgba(6, 11, 24, 0.78) 0%, rgba(6, 11, 24, 0.38) 48%, rgba(6, 11, 24, 0) 100%);
  pointer-events: none;
}

.wrapper-product-categories .home-product-categories-grid .home-product-categories--item .catcard__label {
  position: absolute;
  left: 22px;
  right: 18px;
  bottom: 18px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  color: #fff;
}

.wrapper-product-categories .home-product-categories-grid .home-product-categories--item .catcard__name,
.wrapper-product-categories .home-product-categories-grid .home-product-categories--item .catcard__name .field--name-name {
  font-family: "Parkinsans", system-ui, sans-serif;
  font-size: 23px;
  font-weight: 800;
  line-height: 1.18;
  color: #fff;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.35);
  text-wrap: balance;
}

.wrapper-product-categories .home-product-categories-grid .home-product-categories--item:nth-child(n+3):nth-child(-n+5) .catcard__name,
.wrapper-product-categories .home-product-categories-grid .home-product-categories--item:nth-child(n+3):nth-child(-n+5) .catcard__name .field--name-name {
  font-size: 18px;
  font-weight: 700;
}

.wrapper-product-categories .home-product-categories-grid .home-product-categories--item:nth-child(n+6) .catcard__name,
.wrapper-product-categories .home-product-categories-grid .home-product-categories--item:nth-child(n+6) .catcard__name .field--name-name {
  font-size: 20px;
}

.wrapper-product-categories .home-product-categories-grid .home-product-categories--item .catcard__arrow {
  flex: 0 0 auto;
  margin-bottom: 3px;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.15s ease-out, transform 0.15s ease-out;
}

.wrapper-product-categories .home-product-categories-grid .home-product-categories--item:hover .catcard__arrow {
  opacity: 1;
  transform: none;
}

/* Keep the full-card link above everything. */
.wrapper-product-categories .home-product-categories-grid .home-product-categories--item .stretch-link {
  z-index: 3;
}

/* --- Mobile: two columns, big cards full width. */
@media (max-width: 767.98px) {
  .wrapper-product-categories .home-product-categories-grid {
    gap: 12px;
  }

  .wrapper-product-categories .home-product-categories-grid .home-product-categories--item:nth-child(-n+2) {
    grid-column: span 6;
    height: 200px;
  }

  /* Mirror the desktop pseudo-class count, or the desktop rules win the tie. */
  .wrapper-product-categories .home-product-categories-grid .home-product-categories--item:nth-child(n+3):nth-child(-n+5),
  .wrapper-product-categories .home-product-categories-grid .home-product-categories--item:nth-child(n+6):nth-child(n+6) {
    grid-column: span 3;
    height: 150px;
  }

  .wrapper-product-categories .home-product-categories-grid .home-product-categories--item:nth-child(n+3):last-child:nth-child(even) {
    grid-column: span 6;
  }

  .wrapper-product-categories .home-product-categories-grid .home-product-categories--item .catcard__name,
  .wrapper-product-categories .home-product-categories-grid .home-product-categories--item .catcard__name .field--name-name {
    font-size: 17px !important;
  }

  .wrapper-product-categories .home-product-categories-grid .home-product-categories--item .catcard__label {
    left: 16px;
    right: 14px;
    bottom: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wrapper-product-categories .home-product-categories-grid .home-product-categories--item .catcard,
  .wrapper-product-categories .home-product-categories-grid .home-product-categories--item .catcard__media img {
    transition: none;
  }

  .wrapper-product-categories .home-product-categories-grid .home-product-categories--item:hover .catcard {
    transform: none;
  }

  .wrapper-product-categories .home-product-categories-grid .home-product-categories--item:hover .catcard__media img {
    transform: none;
  }
}
