/* Program cards (Something For Everyone) — YMCA Midsize 2026, Option B (purple).
   Purple section bg; white eyebrow + heading; intro copy to the right of the
   title. 3-col grid of vertical white cards: photo on top (16px top radius),
   white body with an "IDEAL FOR" label, purple title, body copy and a cyan
   "Explore" button pinned to the bottom. Footer: white "Load more" link + a
   white "All programs" button. */

/* Band = vertical gradient purple-md -> purple-dk (comp Rectangle 52 fill),
   painted over the block's primary-dk background class. */
:where(.bmg-program-cards) {
    background-image: linear-gradient(180deg, var(--purple-md) 0%, var(--purple-dk) 100%);
}

/* ---- header: title left, intro copy right (vertically centered so the
   intro doesn't hang off the top beside the tall heading) ---- */
.bmg-program-cards__head {
    align-items: center;
}

.bmg-program-cards__head-title {
    flex: 0 1 auto;
    max-width: 56%;
}

.bmg-program-cards__intro {
    flex: 0 1 608px;
    max-width: 608px;
}

.bmg-program-cards__intro:not(.has-body-font-family) {
    font-size: 16px;
    line-height: 1.31;
}

/* ---- card grid ---- */
.bmg-program-cards__grid {
    align-items: stretch;
    row-gap: 40px;
}

.bmg-program-card {
    position: relative;
    width: calc((100% - 48px) / 3);
    border-radius: 16px;
    overflow: hidden;
    background: var(--white);
}

/* photo sits flush to the top; radius handled inline on the figure */
.bmg-program-card__photo {
    margin: 0;
    width: 100%;
}

.bmg-program-card__photo img {
    display: block;
    width: 100%;
}

/* white body fills the rest so the cyan button can pin to the bottom and every
   card in a row matches height */
.bmg-program-card__panel {
    flex: 1;
    border-radius: 0 0 16px 16px;
}

.bmg-program-card__ages:not(.has-heading-font-family) {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.28;
    letter-spacing: -0.04em;
    text-transform: uppercase;
    margin: 0;
}

.bmg-program-card__body:not(.has-body-font-family) {
    font-size: 16px;
    line-height: 1.31;
}

/* the explore button keeps the body height consistent across the row */
.bmg-program-card__panel .wp-block-buttons:not(.bmg-program-card__actions--native) {
    margin-top: auto;
    padding-top: 14px;
}

/* longer labels were wrapping to two lines, so button heights varied by card */
.bmg-program-card__panel .wp-block-button__link {
    white-space: nowrap;
}

/* Hover contrast. The section carries has-primary-dk-background-color, so the
   global dark-bg hover kicked in — but these buttons sit on WHITE cards, where
   that hover (white fill) made them vanish. Use the white-context hover instead
   (same pairing as defaults.css's white-background-group rule). The extra
   `section` type out-specifies the dark-bg selectors regardless of load order. */
section.bmg-program-cards .bmg-program-card .wp-block-button.is-style-bmg-primary .wp-block-button__link:hover {
    background: var(--purple-md);
    color: var(--white);
}

/* "All programs" (bmg-white) sits on the purple band itself; its shared hover
   fills purple-dk — invisible against the band's dark end. Hover cyan instead. */
section.bmg-program-cards .bmg-program-cards__foot .wp-block-button.is-style-bmg-white .wp-block-button__link:hover {
    background: var(--primary-lt);
    border-color: var(--primary-lt);
    color: var(--black);
}

/* ---- footer: load more + all programs on one centered row ---- */
.bmg-program-cards__foot {
    align-items: center;
}

/* white "Load more" text link + white caret (the shared link is purple; on this
   purple band it needs to read white) */
.bmg-program-cards .bmg-load-more-link {
    margin: 0;
}

.bmg-program-cards .bmg-load-more-link a {
    color: var(--white);
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -0.04em;
    text-decoration: none;
}

.bmg-program-cards .bmg-load-more-link a::after {
    content: "";
    display: inline-block;
    margin-left: 10px;
    width: 14px;
    height: 9px;
    background-image: url("../../icons/sub_menu_icon.png");
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
    vertical-align: middle;
}

/* cards revealed by the "Load more" link (load-more.js) */
.bmg-program-card.fade-in {
    animation: bmg-card-fade-in 0.35s ease;
}

@keyframes bmg-card-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* ---- editor-only: keep the dark band + white type legible in Gutenberg ---- */
.editor-styles-wrapper .bmg-program-card__panel {
    border-radius: 0 0 16px 16px;
}

.editor-styles-wrapper .bmg-program-cards .bmg-load-more-link a {
    color: var(--white);
}

/* ---- mobile (out of 2026 desktop scope — keep usable) ---- */
@media (max-width: 1100px) {
    .bmg-program-card {
        width: calc((100% - 24px) / 2);
    }

    .bmg-program-cards__head {
        flex-wrap: wrap;
        gap: 20px;
    }

    .bmg-program-cards__head-title,
    .bmg-program-cards__intro {
        max-width: 100%;
        flex-basis: 100%;
    }

    .bmg-program-cards__grid {
        gap: 20px;
    }
}

@media (max-width: 700px) {
    .bmg-program-card {
        width: 100%;
    }

    .bmg-program-cards__foot {
        flex-wrap: wrap;
        justify-content: center;
    }

    .bmg-program-cards .bmg-load-more-link {
        width: 100%;
        text-align: center;
    }
}
