/*------------------------------------*\

    Image cards

    Equal-height cards, images auto-cropped, copy left-aligned and buttons
    bottom-aligned in line with one another. Cards sit on the site's warm
    off-white (Avada color 2) rather than a cold grey, and only linked
    cards get a hover state.

    Below 768px the grid becomes a one-per-row slider (image-card-slider.js).

\*------------------------------------*/

.image-cards {
    background: var(--fx-cream);
}

.image-cards-slider {
    display: block;
    margin-inline: -0.5rem;
}

.image-card-slide {
    display: flex;
    flex: 0 0 auto;
    height: auto;
}

.image-card {
    background: var(--fx-white);
    border: 0.0625rem solid var(--fx-border-soft);
    border-radius: var(--fx-radius);
    color: var(--fx-text);
    display: flex;
    flex: 1;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    transition: transform var(--fx-transition), box-shadow var(--fx-transition), border-color var(--fx-transition);
    width: 100%;
}

.image-card__top {
    display: flex;
    flex: 1;
    flex-direction: column;
}

a.image-card:hover,
a.image-card:focus {
    color: var(--fx-text);
    text-decoration: none;
}

.image-card--link:hover,
.image-card--link:focus-within {
    border-color: rgba(61, 111, 66, 0.28);
    transform: translateY(-0.375rem);
}


/*------------------------------------*\
    Media
\*------------------------------------*/

.image-card__image {
    aspect-ratio: 3 / 2;
    background: var(--fx-cream);
    /* .image-card no longer clips (that also clipped its own box-shadow),
       so this rounds its own top corners to match the card's. */
    border-radius: var(--fx-radius) var(--fx-radius) 0 0;
    overflow: hidden;
    position: relative;
}

.image-card__image img {
    display: block;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s var(--fx-ease);
    width: 100%;
}

.image-card--link:hover .image-card__image img {
    transform: scale(1.05);
}


/*------------------------------------*\
    Copy
\*------------------------------------*/

.image-card__text {
    flex: 1;
    padding: 1.625rem 1.625rem 0.75rem;
    text-align: left;
}

.image-card__text > :first-child {
    margin-top: 0;
}

.image-card__text > :last-child {
    margin-bottom: 0;
}

.image-card__text h2,
.image-card__text h3,
.image-card__text h4 {
    color: var(--fx-heading-green);
    font-family: var(--fx-font-display);
    font-size: 1.375rem;
    line-height: 1.3;
    margin-block: 0 0.5rem;
    transition: color var(--fx-transition);
}

.image-card--link:hover .image-card__text h2,
.image-card--link:hover .image-card__text h3,
.image-card--link:hover .image-card__text h4 {
    color: var(--fx-green);
}

.image-card__text p {
    color: var(--fx-muted);
    font-size: 1rem;
    margin-bottom: 0.75em;
}

.image-card__bottom {
    margin-top: auto;
    padding: 0.75rem 1.625rem 1.75rem;
}


/*------------------------------------*\
    Slider (mobile)
\*------------------------------------*/

.image-cards-slider .slick-track {
    display: flex;
}

.image-cards-slider .slick-list {
    /* Room for the raised card and its larger hover shadow inside Slick's clip */
    padding-block: 1rem 2rem;
}

.image-cards-slider .slick-slide {
    display: flex;
    height: auto;
    margin-inline: 0.5rem;
}

.image-cards-slider .slick-slide > div,
.image-cards-slider .slick-slide .image-card-slide {
    height: 100%;
}

/* The slick-list already pads 2rem below the cards for the hover shadow */
.image-cards-slider + .fx-slider-nav {
    margin-top: 0;
}


/*------------------------------------*\
    Grid (tablet and up)
\*------------------------------------*/

@media (min-width: 768px) {
    .image-cards-slider {
        align-items: stretch;
        display: flex;
        flex-wrap: wrap;
        gap: 1.75rem;
        justify-content: center;
        margin-inline: 0;
    }

    .image-card-slide {
        flex: 0 1 calc((100% - 1.75rem) / 2);
    }
}

@media (min-width: 1200px) {
    .image-card-slide {
        flex-basis: calc((100% - 3.5rem) / 3);
    }
}
