/**
 * Shop / product taxonomy critical CSS — mobile-first, design-parity.
 * Blocking on is_shop + is_product_taxonomy only.
 *
 * CLS: before Swiper boots, .cate-slider can stack/overflow then collapse.
 * LCP: reserve banner height; keep first cate cards in flow.
 * Mask: replace 381KB PNG with ~22KB WebP (PSI shop desktop High-pri competitor).
 */

/* --- Banner: stable first paint --- */
.page-product-cate .banner.second {
  min-height: 28rem;
  overflow: hidden;
  /* Compressed mask — overrides common.css banner-crop.png */
  -webkit-mask-image: url(../../../template/assets/images/banner-crop.webp);
  mask-image: url(../../../template/assets/images/banner-crop.webp);
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: cover;
  mask-size: cover;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

@media screen and (min-width: 768px) {
  .page-product-cate .banner.second {
    min-height: 41.6666666667vw;
  }
}

.page-product-cate .banner-br {
  z-index: 0;
}

.page-product-cate .banner-br img,
.page-product-cate .banner-br picture {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}

.page-product-cate .banner-br img {
  object-fit: cover;
}

.page-product-cate .banner-content {
  position: relative;
  z-index: 1;
}

/* --- Cate slider: pre-Swiper lock (2 / 3 / 4 visible) --- */
.page-product-cate .cate-slider {
  overflow: hidden;
}

.page-product-cate .cate-slider .swiper:not(.swiper-initialized) {
  overflow: hidden;
}

.page-product-cate .cate-slider .swiper:not(.swiper-initialized) .swiper-wrapper {
  display: flex;
  gap: 1rem;
}

.page-product-cate .cate-slider .swiper:not(.swiper-initialized) .swiper-slide {
  width: calc(50% - 0.5rem);
  flex-shrink: 0;
  box-sizing: border-box;
}

/* Hide off-viewport slides so height matches post-Swiper carousel. */
.page-product-cate .cate-slider .swiper:not(.swiper-initialized) .swiper-slide:nth-child(n + 3) {
  display: none;
}

@media screen and (min-width: 768px) {
  .page-product-cate .cate-slider .swiper:not(.swiper-initialized) .swiper-slide {
    width: calc(33.333% - 0.667rem);
  }

  .page-product-cate .cate-slider .swiper:not(.swiper-initialized) .swiper-slide:nth-child(n + 3) {
    display: block;
  }

  .page-product-cate .cate-slider .swiper:not(.swiper-initialized) .swiper-slide:nth-child(n + 4) {
    display: none;
  }
}

@media screen and (min-width: 1200px) {
  .page-product-cate .cate-slider .swiper:not(.swiper-initialized) .swiper-slide {
    width: calc(25% - 0.75rem);
  }

  .page-product-cate .cate-slider .swiper:not(.swiper-initialized) .swiper-slide:nth-child(n + 4) {
    display: block;
  }

  .page-product-cate .cate-slider .swiper:not(.swiper-initialized) .swiper-slide:nth-child(n + 5) {
    display: none;
  }
}

/* Child taxonomy: sibling chips — reserve square thumbs */
.page-product .pro-cate-img {
  aspect-ratio: 1 / 1;
}

.page-product .pro-cate-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
