/*
 * Maya adaptive wide layout.
 * Sections may keep full-width backgrounds, while their useful content remains
 * centred and product cards gain density instead of being stretched.
 */
:root {
  --maya-content-max: 1840px;
  --maya-content-gutter: clamp(16px, 2.5vw, 48px);
  --maya-wide-card-width: clamp(202px, 11vw, 216px);
}

body .maya-products-carousel {
  container-type: inline-size;
}

@media (min-width: 1281px) {
  body .maya-container,
  body .maya-section__head,
  body.maya20-active .container,
  body.maya20-active .container-fluid {
    box-sizing: border-box;
    width: min(calc(100% - var(--maya-content-gutter) - var(--maya-content-gutter)), var(--maya-content-max)) !important;
    max-width: var(--maya-content-max) !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  body .maya-home-style-mosaic .maya-container,
  body .maya-newsletter-block > .maya-container,
  body .maya-category-strip-wrap > .maya-container,
  body .maya-product-shelf > .maya-container,
  body .maya-home-products-feature > .maya-container {
    width: min(calc(100% - var(--maya-content-gutter) - var(--maya-content-gutter)), var(--maya-content-max)) !important;
  }

  body .maya-trilogy,
  body .maya-fashion-hero--fluid,
  body .maya-shop-by-style__head,
  body .maya-shop-by-style__rail,
  body .maya-chiarilu-service__head,
  body .maya-chiarilu-service__grid {
    box-sizing: border-box;
    width: min(calc(100% - var(--maya-content-gutter) - var(--maya-content-gutter)), var(--maya-content-max)) !important;
    max-width: var(--maya-content-max) !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
}

@container (min-width: 1600px) {
  body .maya-products-carousel[data-maya-slide-count="4"] { --maya-fill-card-width: calc(25% - 12px); }
  body .maya-products-carousel[data-maya-slide-count="5"] { --maya-fill-card-width: calc(20% - 12.8px); }
  body .maya-products-carousel[data-maya-slide-count="6"] { --maya-fill-card-width: calc(16.6667% - 13.333px); }
  body .maya-products-carousel[data-maya-slide-count="7"] { --maya-fill-card-width: calc(14.2857% - 13.714px); }
  body .maya-products-carousel[data-maya-slide-count="8"] { --maya-fill-card-width: calc(12.5% - 14px); }

  body .maya-products-carousel__viewport.swiper-initialized .maya-products-carousel__slide {
    width: var(--maya-wide-card-width) !important;
    max-width: var(--maya-wide-card-width) !important;
  }

  body .maya-products-carousel--home[data-maya-fill-row="1"] .maya-products-carousel__viewport.swiper-initialized .maya-products-carousel__slide {
    width: var(--maya-fill-card-width) !important;
    max-width: none !important;
  }

  body .maya-products-carousel[data-maya-wide-fill-active="1"] .maya-products-carousel__arrow {
    display: none !important;
  }

  body .maya-products-carousel--categories .maya-products-carousel__slide,
  body .maya-products-carousel--manufacturers .maya-products-carousel__slide {
    width: clamp(210px, 12vw, 232px) !important;
    max-width: clamp(210px, 12vw, 232px) !important;
  }

  body .maya-products-carousel--feedback .maya-products-carousel__slide {
    width: clamp(248px, 15vw, 278px) !important;
    max-width: clamp(248px, 15vw, 278px) !important;
  }

  body .maya-products-carousel__viewport.swiper:not(.swiper-initialized) .swiper-wrapper {
    display: flex !important;
    justify-content: center;
    gap: 16px;
  }

  body .maya-products-carousel__viewport.swiper:not(.swiper-initialized) .swiper-slide {
    display: block !important;
    flex: 0 0 var(--maya-wide-card-width);
    width: var(--maya-wide-card-width) !important;
    max-width: var(--maya-wide-card-width) !important;
  }

}

@media (min-width: 1900px) {
  body .maya-home-products-grid,
  body [data-maya-products-grid] {
    grid-template-columns: repeat(auto-fit, minmax(196px, 214px)) !important;
    justify-content: center;
    align-items: stretch;
  }

  body:not([data-maya-grid-mode="list"]) .maya-listing__grid {
    grid-template-columns: repeat(auto-fit, minmax(196px, 214px)) !important;
    justify-content: center;
    align-items: stretch;
  }

  body:not([data-maya-grid-mode="list"]) .maya-listing__grid .maya-listing-card,
  body .maya-products-carousel__slide > .maya-listing-card,
  body .maya-home-products-grid__item,
  body .maya-home-products-grid__item > * {
    min-width: 0;
    max-width: 214px;
    width: 100%;
  }

  body .maya-products-carousel--home[data-maya-fill-row="1"] .maya-products-carousel__slide > .maya-listing-card {
    max-width: none;
  }

  body .maya-shop-by-style__rail {
    justify-content: safe center;
    padding-left: 24px !important;
    padding-right: 24px !important;
  }

  body .maya-shop-by-style__item,
  body .maya-shop-by-style__item.is-active {
    flex-basis: clamp(260px, 17vw, 330px) !important;
  }
}

@media (min-width: 2400px) {
  :root {
    --maya-content-gutter: clamp(32px, 4vw, 96px);
  }
}

@media (prefers-reduced-motion: reduce) {
  body .maya-products-carousel__slide,
  body .maya-shop-by-style__item {
    transition: none !important;
  }
}
