.bsw-gallery-grid {
    background: #f8f7f4;
    padding-top: 64px;
    padding-bottom: 80px;
}

.bsw-gallery-grid__heading {
    font-family: var(--wp--preset--font-family--cormorant);
    font-style: italic;
    font-weight: 400;
    font-size: 42px;
    color: var(--wp--preset--color--taupe);
    line-height: 1.2;
    margin-bottom: 40px;
}

.bsw-gallery-grid__tiles {
    display: grid;
    grid-template-columns: 392fr 530fr 392fr;
    gap: 20px;
    padding: 0;
}

.bsw-gallery-grid__col {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 0;
    margin: 0;
}

.bsw-gallery-grid__img--sm,
.bsw-gallery-grid__img--lg {
    overflow: hidden;
    margin: 0;
    display: block;
    line-height: 0;
}

.bsw-gallery-grid__img--sm {
    height: 420px;
}

.bsw-gallery-grid__img--lg {
    height: 593px;
}

.bsw-gallery-grid__img--sm:hover img,
.bsw-gallery-grid__img--lg:hover img {
    transform: scale(1.05);
}

/* Pull button out of WordPress constrained-layout grid columns and center it */
.bsw-gallery-grid .wp-block-buttons {
    grid-column: 1 / -1;
    display: flex !important;
    justify-content: center !important;
    margin-top:60px !important;
}

/* Gallery CTA button */
.bsw-gallery-grid__cta .wp-block-button__link {
    font-family: var(--wp--preset--font-family--cardo, 'Cardo', serif) !important;
    font-size: 18px !important;
    font-weight: 400 !important;
    color: #8c857b !important;
    background: transparent !important;
    border: 1.5px solid #d7a3ac !important;
    border-radius: 0 !important;
    min-height: 61px;
    min-width: 331px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.bsw-gallery-grid__cta .wp-block-button__link:hover {
    background: #d7a3ac !important;
    color: #fff !important;
}

.bsw-gallery-grid__img--sm img,
.bsw-gallery-grid__img--lg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease-in-out;
    cursor: pointer;
}

@media (max-width: 767px) {
    .bsw-gallery-grid {
        padding-top: 66px;
        padding-bottom: 60px;
        /* Tiles sit on 24px gutters in the mobile design (392px on a 440 canvas) */
        padding-inline: 24px;
    }

    .bsw-gallery-grid__heading {
        font-size: 38px;
        margin-bottom: 26px;
        margin-top:0;
    }

    .bsw-gallery-grid__tiles {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .bsw-gallery-grid__col {
        gap: 10px;
    }

    /* Each tile keeps its desktop crop, scaled to full width — the mobile
       design crops exactly like desktop (392-wide columns keep 392:420 /
       392:593; the 530-wide centre column scales to 530:593 / 530:420) */
    .bsw-gallery-grid__img--sm,
    .bsw-gallery-grid__img--lg {
        height: auto;
    }

    .bsw-gallery-grid__img--sm {
        aspect-ratio: 392 / 420;
    }

    .bsw-gallery-grid__img--lg {
        aspect-ratio: 392 / 593;
    }

    .bsw-gallery-grid__col--center .bsw-gallery-grid__img--lg {
        aspect-ratio: 530 / 593;
    }

    .bsw-gallery-grid__col--center .bsw-gallery-grid__img--sm {
        aspect-ratio: 530 / 420;
    }

    /* Button full-width on mobile */
    .bsw-gallery-grid__cta .wp-block-button__link {
        min-width: 0 !important;
        width: 100%;
        max-width: 331px;
        box-sizing: border-box;
    }

    .bsw-gallery-grid .wp-block-buttons {
        margin-top:40px !important;
    }
}
