.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(275px, 1fr));
    gap: 1rem;
    list-style: none;
    margin: auto;
    width: calc(100% - 2rem);
}

/* adding the class fit to the html will allow each grid child to grow to fill its space */
.cards.fit {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
.card__header-img {
    display: block;
    max-width: 250px;
    object-fit: contain;
    margin: 1rem auto 2rem;
}
.card {
    box-shadow: var(--box-shadow);
    transition: box-shadow 0.3s ease;
    height: 100%;
    width: 100%;
    /* background-color: hsl(var(--clr-mediumYellow) / 25%); */

}

.card:hover {
    box-shadow: var(--box-shadow-hover);
}


.card__link {
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.card__link p.link {
    border-color: transparent !important;
}

.card__link:hover .card__cta p.link {
    background:hsl(var(--clr-darkRed));
    color: #fff !important;
}
.card__link:hover .card__cta p.link::after {
    color: #fff !important;
}

.card__header img {
    width: 100%;
    max-height: 300px;
    max-width: 100%;
    object-fit: cover;
    object-position: top;
}
.card__body {
    text-wrap: balance;
    padding: 0.8rem;
}
.card__body h3 {
    margin: .75rem 0;
}
.card__cta {
    margin-top: auto;
    padding: 0.8rem;
}

.card__cta p {
    margin-bottom: 0;
}

a.card__btn {
    margin-top: 2rem !important;
}

/* Keyboard users get the same lift as hover, plus an outline */
.card:focus-within {
    box-shadow: var(--box-shadow-hover);
}
.card__link:focus-visible {
    outline: 3px solid hsl(var(--clr-darkRed));
    outline-offset: 3px;
}

/* Resource type label above a card title */
.card__type {
    display: inline-block;
    margin: 0 0 0.75rem;
    padding: 0.2em 0.6em;
    font-size: var(--fs-300);
    font-weight: 700;
    letter-spacing: var(--ls-2);
    text-transform: uppercase;
    color: hsl(var(--clr-darkBlue));
    background: hsl(var(--clr-mediumTurq));
}

.landing-card .card__body :is(h2, h3, h4) {
    margin-bottom: 0.75rem;
}

/* Keep cards a similar height when excerpts vary */
.card__excerpt {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
}

/* Resource type filters */
.resource-filters__list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin: var(--sml, 1rem) 0 0;
    padding: 0;
    list-style: none;
}
/* Scoped under .resource-filters to beat the global `a`, `a:hover` and
   `a.no-line` rules, which otherwise recolour/remove the bottom border */
.resource-filters a.resource-filters__link {
    display: inline-block;
    padding: 0.4em 1em;
    border: 2px solid hsl(var(--clr-darkRed));
    border-radius: 999px;
    font-weight: var(--fw-700);
    letter-spacing: var(--ls-1);
    color: hsl(var(--clr-darkRed));
    background: transparent;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.resource-filters a.resource-filters__link:hover,
.resource-filters a.resource-filters__link:focus,
.resource-filters a.resource-filters__link[aria-current="page"] {
    border-color: hsl(var(--clr-darkRed));
    background: hsl(var(--clr-darkRed));
    color: hsl(var(--clr-white));
}
.resource-filters a.resource-filters__link:focus-visible {
    outline: 3px solid hsl(var(--clr-darkRed));
    outline-offset: 2px;
}

/* Meta lines under a card title (date, author, audience...) */
.card__meta {
    margin: 0 0 0.75rem;
    padding: 0;
    list-style: none;
    font-size: var(--fs-300);
    color: hsl(var(--clr-darkBlue) / 75%);
}
.card__meta li + li {
    margin-top: 0.25rem;
}
.card__meta i {
    width: 1.25em;
    margin-right: 0.35em;
    color: hsl(var(--clr-darkRed));
}

/* fit: 'contain' — show the whole image (objects, documents) on a neutral
   panel instead of cropping. scale-down = contain, but never enlarges small
   uploads (they'd go soft). Extra class to beat .landing-card .landing-card__image img */
.landing-card.landing-card--contain .landing-card__image img {
    object-fit: scale-down;
    padding: 1rem;
}

/* show_image: false — text-only cards get a coloured top edge in place of the image */
.landing-card--text {
    border-top: 4px solid hsl(var(--clr-darkRed));
}
