/*
 * components/repeater.css
 * Repeater (blog post list) component.
 * Migrated verbatim from the live site (sources: repeater.css).
 */

/* repeater.css */
.wmc_repeater {
    --height: min-content;
    --repeaterPaddingDesktop: 0px;
    --repeaterRowGapDesktop: 0px;
    --repeaterColumnGapDesktop: 0px;
    --repeaterJustifyContentDesktop: normal;
    --repeaterItemsPerRowDesktop: 3;

    --repeaterPadding: var(--repeaterPaddingDesktop);
    --repeaterRowGap: var(--repeaterRowGapDesktop);
    --repeaterColumnGap: var(--repeaterColumnGapDesktop);
    --repeaterJustifyContent: var(--repeaterJustifyContentDesktop);
    --repeaterItemsPerRow: var(--repeaterItemsPerRowDesktop);

    & > .wml_repeater {
        min-height: unset;

        & > .wms_repeater {
            display: flex;
            flex-wrap: wrap;
            flex-direction: row;
            align-items: stretch;
            padding: var(--repeaterPadding);
            row-gap: var(--repeaterRowGap);
            column-gap: var(--repeaterColumnGap);
            justify-content: var(--repeaterJustifyContent);

            & > .wmc_repeaterItem {
                display: flex;
                align-items: stretch;
                justify-items: stretch;

                & > .wml_repeaterItem {
                    --marginLeft: 0px;
                    --marginTop: 0px;
                    --marginRight: 0px;
                    --marginBottom: 0px;
                }
            }
        }
    }

    &:is(.wmcM_containerSizeFull, .wmcM_containerSizeFull--tablet, .wmcM_containerSizeFull--mobile) > .wml_repeater > .wms_repeater {
        justify-content: start;

        & > .wmc_repeaterItem {
            flex: 0 0 calc((100% - (var(--repeaterColumnGap) * (var(--repeaterItemsPerRow) - 1))) / var(--repeaterItemsPerRow));
            max-width: calc((100% - (var(--repeaterColumnGap) * (var(--repeaterItemsPerRow) - 1))) / var(--repeaterItemsPerRow));

            & > .wml_repeaterItem {
                width: 100%;
                max-width: none;
                min-width: 0;
            }
        }
    }
}

@media all and (width < 1040px) {
    .wmc_repeater {
        --repeaterPaddingTablet: var(--repeaterPaddingDesktop);
        --repeaterRowGapTablet: var(--repeaterRowGapDesktop);
        --repeaterColumnGapTablet: var(--repeaterColumnGapDesktop);
        --repeaterJustifyContentTablet: var(--repeaterJustifyContentDesktop);
        --repeaterItemsPerRowTablet: var(--repeaterItemsPerRowDesktop);

        --repeaterPadding: var(--repeaterPaddingTablet);
        --repeaterRowGap: var(--repeaterRowGapTablet);
        --repeaterColumnGap: var(--repeaterColumnGapTablet);
        --repeaterJustifyContent: var(--repeaterJustifyContentTablet);
        --repeaterItemsPerRow: var(--repeaterItemsPerRowTablet);
    }
}

@media all and (width < 650px) {
    .wmc_repeater {
        --repeaterPaddingMobile: var(--repeaterPaddingTablet);
        --repeaterRowGapMobile: var(--repeaterRowGapTablet);
        --repeaterColumnGapMobile: var(--repeaterColumnGapTablet);
        --repeaterJustifyContentMobile: var(--repeaterJustifyContentTablet);
        --repeaterItemsPerRowMobile: var(--repeaterItemsPerRowTablet);

        --repeaterPadding: var(--repeaterPaddingMobile);
        --repeaterRowGap: var(--repeaterRowGapMobile);
        --repeaterColumnGap: var(--repeaterColumnGapMobile);
        --repeaterJustifyContent: var(--repeaterJustifyContentMobile);
        --repeaterItemsPerRow: var(--repeaterItemsPerRowMobile);
    }
}

.wmc_repeaterEmptyMessage {
    width: 100%;
}

.wmc_repeaterItem {
    & > .wml {
        .wmcM_dynamicHeight > .wml {
            --height: var(--minHeight);
            height: var(--minHeight);
            min-height: var(--minHeight);
            max-height: fit-content;
            padding-bottom: calc(var(--dynamicPaddingBottom, 0px) + var(--paddingBottom, 0px));
        }
    }
}

.wmc_repeater {
    /* mirrors --wm_columnsWidth: each item's share of the page content width;
       the viewport cancels out of the derivation, so the page gutter
       (viewport − contentWidth) lands distributed equally across the items */
    --wm_repeaterItemContentWidth: calc(
        (var(--contentWidthPage)
        - 2 * var(--repeaterPadding)
        - (var(--repeaterColumnGap) * (var(--repeaterItemsPerRow) - 1)))
        / var(--repeaterItemsPerRow)
    );
}

.wmc_repeaterItem > .wml_repeaterItem > .wms_content > .wmc {
    --contentWidthOverride: var(--wm_repeaterItemContentWidth);
}

@media all and (width < 650px) {
    /* core.css's own `--contentWidthOverride: unset` loses to the higher-specificity
       rule above, so the no-safe-zones-on-mobile rule must be restated here */
    .wmc_repeaterItem > .wml_repeaterItem > .wms_content > .wmc {
        --contentWidthOverride: unset;
    }
}
