/* Dev-only: modern homepage category tiles (#custom-categories). */

#custom-categories.bm-cat-grid {
  /* Bleed a bit into content padding so tiles read larger */
  width: calc(100% + 2.5rem);
  max-width: none;
  margin: 1.25rem -1.25rem 1.75rem;
}

#custom-categories.bm-cat-grid .woocommerce {
  margin: 0;
  max-width: none;
  width: 100%;
}

#custom-categories .bm-cat-grid__list,
#custom-categories ul.products {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  /* Equal row + column spacing */
  /* gap shorthand disabled — row/column set separately */
  column-gap: 1rem;
  row-gap: 1rem;
  list-style: none;
  margin: 0 !important;
  padding: 0 !important;
  float: none !important;
  width: 100% !important;
}

#custom-categories ul.products::before,
#custom-categories ul.products::after {
  display: none !important;
  content: none !important;
}

#custom-categories li.product.bm-cat-card,
#custom-categories li.bm-cat-card {
  width: 100% !important;
  max-width: none !important;
  float: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent;
  min-height: 0;
  box-sizing: border-box;
}

#custom-categories .bm-cat-card__link {
  position: relative;
  display: block;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 12px;
  aspect-ratio: 1 / 1;
  min-height: 250px;
  text-decoration: none !important;
  color: #fff;
  box-shadow: 0 6px 18px rgba(20, 40, 45, 0.12);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
  background: #1a3a40;
}

#custom-categories .bm-cat-card__link:hover,
#custom-categories .bm-cat-card__link:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(20, 40, 45, 0.18);
  z-index: 2;
}

#custom-categories .bm-cat-card__media {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background-color: #1a3a40;
  background-size: cover;
  background-position: center 78%;
  background-repeat: no-repeat;
  transform: scale(1);
  transition: transform 0.5s ease;
}

#custom-categories .bm-cat-card__link:hover .bm-cat-card__media,
#custom-categories .bm-cat-card__link:focus-visible .bm-cat-card__media {
  transform: scale(1.04);
}

#custom-categories .bm-cat-card__link::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(12, 28, 32, 0.1) 0%,
    rgba(12, 28, 32, 0.08) 45%,
    rgba(12, 28, 32, 0.78) 100%
  );
  pointer-events: none;
  z-index: 1;
}

#custom-categories .bm-cat-card__label {
  position: absolute;
  left: 0.7rem;
  right: 0.7rem;
  bottom: 2.35rem;
  z-index: 2;
  margin: 0;
  font-family: "PlutoLight", "DM Sans", Arial, Helvetica, sans-serif;
  font-size: clamp(0.75rem, 1.1vw, 0.95rem);
  font-weight: normal;
  letter-spacing: 0.06em;
  line-height: 1.25;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

#custom-categories .bm-cat-card__cta {
  position: absolute;
  left: 0.7rem;
  bottom: 0.65rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  padding: 0.32rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #1f6f64;
  font-family: "DM Sans", "PlutoSansLight", Arial, Helvetica, sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#custom-categories .bm-cat-card__link:hover .bm-cat-card__cta,
#custom-categories .bm-cat-card__link:focus-visible .bm-cat-card__cta {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 978px) {
  #custom-categories.bm-cat-grid {
    width: calc(100% + 1.5rem);
    margin-left: -0.75rem;
    margin-right: -0.75rem;
  }

  #custom-categories .bm-cat-grid__list,
  #custom-categories ul.products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    /* gap shorthand disabled — row/column set separately */
    column-gap: 1rem;
    row-gap: 1rem;
  }

  #custom-categories .bm-cat-card__link {
    min-height: 200px;
  }

  #custom-categories .bm-cat-card__cta {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 520px) {
  #custom-categories.bm-cat-grid {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  #custom-categories .bm-cat-grid__list,
  #custom-categories ul.products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    /* gap shorthand disabled — row/column set separately */
    column-gap: 1rem;
    row-gap: 1rem;
  }

  #custom-categories .bm-cat-card__link {
    min-height: 160px;
    border-radius: 10px;
  }

  #custom-categories .bm-cat-card__label {
    bottom: 2.1rem;
    font-size: 0.65rem;
  }
}

/* Kill WooCommerce column gutters that widen horizontal spacing */
#custom-categories ul.products li.product {
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  max-width: none !important;
}

/* Override theme Woo product gutters inside homepage category grid */
#custom-categories ul.products li.product,
#custom-categories ul.products li.product:nth-child(2n),
#custom-categories ul.products li.product.first,
#custom-categories ul.products li.product.last,
#custom-categories ul.products li.product + li.product,
#indexDefault #custom-categories ul.products li.product {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  margin-bottom: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  float: none !important;
  clear: none !important;
}

/* Show baked-in orange banner for selected tiles (e.g. FR Tortues) */
#custom-categories .bm-cat-card--show-banner .bm-cat-card__media {
  background-position: center top;
}
/* Bottom label uses the same size as other tiles (no show-banner override) */
