/* ============================================================
   SD CATALOG CATEGORY SIZE SETTINGS V133

   Desktop:
   - width is controlled by site setting in px
   - height is controlled by site setting in px
   - never more than 4 cards in one row
   - incomplete rows are centered
   ============================================================ */

.catalog-page .catalog-folders-v129 .catalog-folder-grid-v129{
    display:flex!important;
    flex-wrap:wrap!important;
    justify-content:center!important;
    align-items:flex-start!important;
    align-content:flex-start!important;

    width:calc(100% - 56px)!important;
    max-width:var(--sd-cat-grid-max,1454px)!important;

    gap:18px!important;

    margin-left:auto!important;
    margin-right:auto!important;
    padding:0!important;
}

.catalog-page .catalog-folder-grid-v129 > .catalog-flip-card-v129{
    flex:0 0 var(--sd-cat-card-width,350px)!important;

    width:var(--sd-cat-card-width,350px)!important;
    min-width:var(--sd-cat-card-width,350px)!important;
    max-width:var(--sd-cat-card-width,350px)!important;

    height:var(--sd-cat-card-height,480px)!important;
    min-height:var(--sd-cat-card-height,480px)!important;
    max-height:var(--sd-cat-card-height,480px)!important;

    margin:0!important;
}

/* Heading follows the same centered width as the cards. */
.catalog-page .catalog-folders-v129 .section-head{
    width:calc(100% - 56px)!important;
    max-width:var(--sd-cat-grid-max,1454px)!important;
    margin-left:auto!important;
    margin-right:auto!important;
}

/* Reverse-side CTA keeps its current behavior, only the label changed. */
.catalog-page .catalog-flip-open-v129{
    text-align:left!important;
}

/* ------------------------------------------------------------
   Responsive: settings remain the desired desktop size, while cards are
   allowed to shrink when the viewport physically cannot fit them.
   ------------------------------------------------------------ */

@media(max-width:1180px){
    .catalog-page .catalog-folders-v129 .catalog-folder-grid-v129{
        width:calc(100% - 40px)!important;
        max-width:none!important;
        gap:16px!important;
    }

    .catalog-page .catalog-folders-v129 .section-head{
        width:calc(100% - 40px)!important;
        max-width:none!important;
    }

    .catalog-page .catalog-folder-grid-v129 > .catalog-flip-card-v129{
        flex-basis:min(var(--sd-cat-card-width,350px),calc((100% - 32px) / 3))!important;
        width:min(var(--sd-cat-card-width,350px),calc((100% - 32px) / 3))!important;
        min-width:0!important;
        max-width:min(var(--sd-cat-card-width,350px),calc((100% - 32px) / 3))!important;
    }
}

@media(max-width:820px){
    .catalog-page .catalog-folders-v129 .catalog-folder-grid-v129{
        width:calc(100% - 28px)!important;
        gap:12px!important;
    }

    .catalog-page .catalog-folders-v129 .section-head{
        width:calc(100% - 28px)!important;
    }

    .catalog-page .catalog-folder-grid-v129 > .catalog-flip-card-v129{
        flex-basis:min(var(--sd-cat-card-width,350px),calc((100% - 12px) / 2))!important;
        width:min(var(--sd-cat-card-width,350px),calc((100% - 12px) / 2))!important;
        max-width:min(var(--sd-cat-card-width,350px),calc((100% - 12px) / 2))!important;
    }
}

@media(max-width:560px){
    .catalog-page .catalog-folders-v129 .catalog-folder-grid-v129{
        width:calc(100% - 20px)!important;
        gap:9px!important;
    }

    .catalog-page .catalog-folders-v129 .section-head{
        width:calc(100% - 20px)!important;
    }

    .catalog-page .catalog-folder-grid-v129 > .catalog-flip-card-v129{
        flex-basis:calc((100% - 9px) / 2)!important;
        width:calc((100% - 9px) / 2)!important;
        min-width:0!important;
        max-width:calc((100% - 9px) / 2)!important;

        /* Keep mobile usable even if desktop height is very large. */
        height:min(var(--sd-cat-card-height,480px),320px)!important;
        min-height:min(var(--sd-cat-card-height,480px),320px)!important;
        max-height:min(var(--sd-cat-card-height,480px),320px)!important;
    }
}
