/*** ---------- Product grid ---------- ***/
.wpb-woocommerce-product-loop { container-name: products; container-type: inline-size;
    .woocommerce-info { grid-column: 1/-1; }
    .all-results-info { display: flex; justify-content: center; margin-top: 1.8rem; }

    @media (min-width: 992px) {
        .all-results-info { margin-top: 3.2rem; }
    }
}

.woocommerce :is(.products ul, ul.products) { --gc: 2; list-style: none; display: grid; grid-template-columns: repeat(var(--gc), minmax(0, 1fr)); column-gap: .9rem; row-gap: 1.4rem; }

@container products (width > 992px) {
    .woocommerce :is(.products ul, ul.products):is(.columns-2, .columns-3, .columns-4, .columns-5) { --gc: 3; }
}
@container products (width > 1400px) {
    .woocommerce :is(.products ul, ul.products):is(.columns-4, .columns-5) { --gc: 4; }
}
@container products (width > 1600px) {
    .woocommerce :is(.products ul, ul.products).columns-5 { --gc: 5; }
}

@media (max-width: 575.98px) {
    /* Edge to edge on mobile; sliders keep their own track spacing. */
    .woocommerce :is(.products ul, ul.products:not(.blaze-track)) { gap: 0!important; margin-left: -1.6rem; width: calc(100% + 3.2rem);
        .wpb-card.wpb-card--product { border-radius: 0; border: none; border-top: .1rem solid var(--clr-border);
            &:nth-child(2n) { border-left: .1rem solid var(--clr-border); }
        }
    }
}


/*** ---------- Stock indicator ---------- ***/
.prd-stock-info { margin-bottom: .8rem; 

    .prd-delivery { line-height: 1; display: flex; align-items: center; column-gap: .5rem; color: var(--clr); font-size: 1.2rem; font-weight: 600; 
        .prd-delivery__indicator { display: flex; width: 4.4rem; column-gap: .1rem; 
            span { width: 100%; height: .4rem; border-radius: 1.4rem; background-color: var(--clr); }
        }
    }
    
    .prd-stock-info__days { font-weight: 400; margin-top: .25rem; line-height: 1; display: flex; align-items: center; column-gap: .5rem; color: var(--clr); font-size: 1.2rem; font-weight: 600; 
        .icon:where(.icon--theme) { font-size: 1rem; color: var(--clr); }
    }

    &.--green { --clr: var(--clr-green); }
    &.--orange { --clr: var(--clr-orange); 
        /* Darker than --clr-orange (3.8:1) so the text meets WCAG 1.4.3; the indicator bars keep the brand orange. */
        :is(.prd-delivery, .prd-stock-info__days) { color: #8f5e00; }
        .prd-delivery .prd-delivery__indicator span:nth-of-type(3) { background-color: #DDDFE3; }
    }
    &.--low { --clr: var(--clr-green); 
        .prd-delivery .prd-delivery__indicator span:nth-of-type(3) { background-color: #DDDFE3; }
    }
    &.--red { --clr: var(--clr-red); 
        .prd-delivery .prd-delivery__indicator {
            span:nth-of-type(2), span:nth-of-type(3) { background-color: #DDDFE3; }
        }
    }

    @media (max-width: 767.98px) {
        margin-bottom: .6rem;
    }
}


/*** ---------- Product cards: small & wide ---------- ***/
/* Variants of .wpb-card (components/cards.css). The base card spacing, radii and
   header layout are reset here, these cards use their own outer padding. */
.wpb-card:is(.wpb-card--product-small, .wpb-card--product-wide) { width: 100%; padding: 1.2rem; z-index: auto; container-name: productCards; container-type: inline-size;
    > * + * { margin-top: 1em; }

    .wpb-card__header { display: block; overflow: visible; border-radius: 0; }
    .wpb-card__labels { display: flex; justify-content: space-between; align-items: center; }
    .wpb-card__image { max-height: 16rem; aspect-ratio: 3 / 2; object-fit: contain; border-radius: 0; }
    .wpb-card__body { padding: 0; flex-grow: 1; }
    .wpb-card__heading { font-size: 1.4rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

    .wpb-card__footer { padding: 0; border-radius: 0; display: flex; flex-wrap: wrap; column-gap: 1.6rem; row-gap: 1rem; align-items: center;
        .btn { flex-grow: 1; }

        .price { line-height: 1;
            strong { display: block; font-size: 2rem; line-height: 1.1; color: var(--clr-headings);
                &.is-sale { color: var(--clr-red); }
            }
            > strong.is-sale .is-original { font-size: 14px; font-weight: 500!important; color: var(--clr-text); text-decoration: line-through;
                .amount bdi { font-weight: 500!important; }
            }
            > small, > small * { font-size: 1.2rem; line-height: 1.2; color: var(--clr-headings); }

            &.is-placeholder { display: flex; flex-direction: column; row-gap: .3rem;
                :is(.large-price-placeholder, .small-price-placeholder) { border-radius: .3rem; background-color: var(--clr-border); display: inline-block; }
                .large-price-placeholder { width: 10rem; height: 2.2rem; }
                .small-price-placeholder { width: 8rem; height: 1.4rem; }
            }
        }
    }

    @media (max-width: 767.98px) {
        .wpb-card__image { max-height: 9rem; }
        .wpb-card__heading { white-space: normal; }
        .prd-attributes { padding: .9rem; }
        .prd-sku { font-size: 1.1rem; }
        .wpb-card__footer { margin-top: .8rem;
            .price strong { font-size: 1.6rem!important; }
        }
    }

    @media (max-width: 575.98px) {
        border-radius: 0; border-top: .1rem solid var(--clr-border);
        &:nth-child(2n) { border-left: .1rem solid var(--clr-border); }
        .prd-attributes { grid-template-columns: 1fr; margin-inline: 0; padding-inline: 0; }
    }

    @media (min-width: 576px) {
        border: 1px solid var(--clr-border);
    }

    @media (min-width: 992px) {
        padding: 1.6rem;
        .wpb-card__image { transition: .12s ease; }
        &:hover .wpb-card__image { transform: scale(1.04); }
        .wpb-card__heading { font-size: 1.8rem; }
    }
}

.wpb-card.wpb-card--product-small {
    .wpb-card__labels .badge-group { z-index: 2; }

    .wpb-card__labels .badge-group.prd-attributes { right: var(--side-spacing);
        > span { height: 24px; width: 24px; border-radius: 3px; background-color: var(--clr-dark); display: flex; align-items: center; justify-content: center;
            .icon--theme { font-size: 18px; }

            &.prd-esd { background-color: var(--clr-accent);
                .icon--theme { color: var(--clr-text); width: calc(5em / 3); }
            }
            &.prd-voedselgeschikt { background-color: var(--clr-green); }
        }
        > .btn { padding: .5rem; margin-right: -.5rem; }
    }

    /* Bookmark toggle */
    .wpb-card__labels .btn { color: var(--clr-text); font-size: 1.4rem; margin-left: auto;
        i, .icon { font-size: 1.6rem; color: var(--clr-text); }

        .icon--solid { display: none!important; }

        &.selected {
            .icon--regular { display: none!important; }
            .icon--solid { display: block!important; }
        }
        &:hover i, &:hover .icon { color: var(--clr-headings); }
    }

    @media (max-width: 575.98px) {
        .wpb-card__labels .badge-group { --side-spacing: 0; }
        .wpb-card__labels .badge-group.prd-attributes { gap: 0; padding-right: 4px; }
    }

    @media (min-width: 768px) {
        .wpb-card__footer { margin-top: 1rem; }
    }

    @media (min-width: 992px) {
        .wpb-card__labels .badge-group { --side-spacing: 2rem; }
        .wpb-card__heading { font-size: 1.6rem; }
    }
}

.wpb-card.wpb-card--product-wide { border: 1px solid var(--clr-border); padding: 1.4rem;
    .wpb-card__header { position: relative; }
    .wpb-card__labels { position: absolute; top: 0; left: 0; z-index: 1; }

    .prd-attributes { display: flex; gap: .6rem; margin-top: 1.4rem;
        .prd-attribute { border: .1rem solid var(--clr-border); line-height: 1.2; border-radius: .4rem; padding: .6rem 1rem .5rem 1rem; display: flex; align-items: center; column-gap: .8rem; }
        .prd-attribute__info { line-height: 1;
            small { display: block; width: 100%; font-size: 1rem; line-height: 1; }
            span { font-size: 1.2rem; font-weight: 600; line-height: 1; }
        }
    }

    @media (max-width: 575.98px) {
        border-left: none; border-right: 0;
    }
}

/* Compact footer: icon-only button when the card gets narrow. */
@container productCards (width < 290px) {
    .wpb-card:is(.wpb-card--product-small, .wpb-card--product-wide) .wpb-card__footer {
        .btn { margin-left: auto; flex-grow: 0; border: none; min-height: unset; padding: 0; --color: var(--clr-headings); --bg-color: transparent; --border: none; --hover-bg-color: transparent; --hover-color: var(--clr-headings); --hover-border: none; 
            .btn__text { display: none; }
            .wpb-icon-wrapper { --w: 2.2rem; --h: 2.2rem; }
        }
        .price > small, .price > small * { font-size: 1.1rem; }
    }
}

/* .card-container (components/cards.css) wraps a single wide card. */
@container cardContainer (width > 600px) {
    .wpb-card.wpb-card--product-wide { display: grid; grid-template-columns: 20rem 1fr auto; column-gap: 2rem; align-items: end;
        .wpb-card__heading { font-size: 2rem; }
    }
}
