/*
|--------------------------------------------------------------------------
| Pattern: Product Card
|--------------------------------------------------------------------------
|
| Scaffolding: assets/css/template-parts/block-productCard.css
*/

/* ── Carousel overrides ── */
/* Catalog: two 600px cards within the existing 1224px desktop container. */
.product-catalog-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
}
.product-catalog-card {
    width: 100%;
    min-width: 0;
    height: 100%;
    padding: 24px;
    box-shadow: inset 0 0 0 1px var(--color-grey-2);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.product-catalog-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 32px;
}
.product-catalog-card__icon {
    font-size: 32px;
    line-height: 32px;
    color: var(--color-secondary);
}
.product-catalog-card__badge {
    margin-left: auto;
    padding: 4px 8px;
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
    color: var(--color-secondary-dark);
    background: var(--color-grey-3);
    overflow-wrap: anywhere;
}
.product-catalog-card__content {
    display: flex;
    flex-direction: column;
    gap: 24px;
    flex: 1;
}
.product-catalog-card__text { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.product-catalog-card__description { margin-top: 4px; overflow-wrap: anywhere; }
.product-catalog-card__price { display: flex; flex-direction: column; gap: 8px; }
.product-catalog-card__actions { margin-top: auto; }
@media (min-width: 1024px) {
    .product-catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 768px) {
    .product-catalog-card__content { flex-direction: row; align-items: center; }
    .product-catalog-card__price { flex: 0 0 135px; overflow-wrap: anywhere; }
}
/* The shared Load More rules start hiding cards only after catalog JS boot. */
[data-product-catalog] [data-catalog-trigger][hidden] { display: none; }
/* Aligning is now managed by utility classes directly on the element */

/* Solo nel carousel Promo ogni slide mantiene la larghezza della card
   featured: 712px su tablet e 808px su desktop. */
@media (min-width: 768px) {
    [data-product-card-promo-carousel="1"] .product-card-carousel > .swiper-wrapper > .swiper-slide {
        flex-basis: 712px !important;
        min-width: 712px !important;
        max-width: 712px !important;
        width: 712px !important;
    }
}

@media (min-width: 1280px) {
    [data-product-card-promo-carousel="1"] .product-card-carousel > .swiper-wrapper > .swiper-slide {
        flex-basis: 808px !important;
        min-width: 808px !important;
        max-width: 808px !important;
        width: 808px !important;
    }
}

@media (max-width: 1023.98px) {
    [data-product-card-block] {
        overflow-x: clip;
    }

    [data-product-card-block] .product-card-carousel.swiper {
        overflow: visible;
    }
}

/* Align mixed promo badges across sibling product cards. */
[data-product-card-block] .product-card {
    --product-card-badge-offset: 0px;
}

[data-product-card-block]:has(.product-card [data-product-card-badge]:not([hidden])) .product-card:not(:has([data-product-card-badge]:not([hidden]))) {
    margin-top: var(--product-card-badge-offset);
}

[data-product-card-block]:has(.product-card [data-product-card-badge]:not([hidden])) :is(.swiper-slide, [data-loadmore-card]) .product-card:not(:has([data-product-card-badge]:not([hidden]))) {
    height: calc(100% - var(--product-card-badge-offset)) !important;
}

/* ── LoadMore: card hidden on mobile only ─────────────────────────────
 * Cards at index ∈ [mobileInitial, desktopInitial) are marked with
 * data-loadmore-mobile-only. They are hidden on mobile while collapsed
 * and revealed when the grid switches to data-loadmore-expanded="true".
 * On md+ the attribute has no effect (rule is scoped under max-width:767). */
.product-card-loadmore__item:not(.hidden) {
    display: flex;
}

@media (max-width: 767px) {
    [data-loadmore-card][data-loadmore-mobile-only] {
        display: none;
    }

    [data-loadmore-grid][data-loadmore-expanded="true"] [data-loadmore-card][data-loadmore-mobile-only] {
        display: flex;
    }
}
