.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.card {
    position: relative;
    overflow: hidden;

    display: flex;
    flex-direction: column;
    height: 100%;

    background: #fff;

    border: 1px solid #e6ebef;
    border-radius: 12px;

    box-shadow:
        0 4px 8px rgba(17, 52, 86, 0.06),
        0 10px 24px rgba(17, 52, 86, 0.05);

    transition:
        transform .25s ease,
        box-shadow .25s ease;

    text-decoration: none;
    color: inherit;
}

.card:hover {
    /* No scale() here on purpose - scaling text via transform doesn't
       sub-pixel-render as cleanly as it does for shapes/images, so it
       can look soft/swimmy mid-transition no matter how the timing is
       tuned. A pure lift avoids that entirely. */
    transform: translateY(-3px);
    z-index: 10;

    box-shadow:
        0 4px 12px rgba(17,52,86,.10),
        0 20px 40px rgba(17,52,86,.14);
}

.card-image {
    position: relative;
}

.card-image img {
    display: block;
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.card-photo-credit {
    position: absolute;
    right: 0.6rem;
    bottom: 0.6rem;

    padding: 0.15rem 0.5rem;

    background: rgba(0, 0, 0, 0.55);
    border-radius: 4px;

    color: #fff;
    font-size: 0.7rem;
    line-height: 1.4;
}

.card-body {
    display: flex;
    flex-direction: column;
    flex: 1;

    padding: 1.5rem;
}

.card-title-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;

    margin-bottom: 0.5rem;
}

.card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;

    width: 2.25rem;
    height: 2.25rem;

    background: color-mix(in srgb, var(--color-primary) 12%, white);
    border-radius: 8px;
}

/* An icon-only card (no image) has no top visual, so its icon reads
   as the card's whole header - larger and standing on its own rather
   than sitting inline with the title. */
.card:not(.has-image) .card-icon {
    width: 2.75rem;
    height: 2.75rem;
    margin-bottom: 0.75rem;
}

.card:not(.has-image) .card-title-row {
    flex-direction: column;
    align-items: flex-start;
}

.card-icon i {
    font-size: 1.15rem;
    color: var(--color-primary);
}

.card:not(.has-image) .card-icon i {
    font-size: 1.35rem;
}

.card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.3;

    color: var(--color-secondary);
}

.card h4 {
    margin-bottom: 0.75rem;

    font-size: 0.95rem;
    font-weight: 500;

    color: #6b7684;
}

.card p {
    margin: 0 0 1.1rem;

    font-size: 0.95rem;
    line-height: 1.55;

    color: #5a6472;
}

.card-link {
    display: inline-flex;
    align-items: center;
    gap: .35rem;

    margin-top: auto;

    color: var(--color-secondary);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
}

.card:hover .card-link {
    color: var(--color-primary);
}

.card-link .arrow {
    font-size: 1.2em;
    line-height: 1;

    transition: transform .2s ease;
}

.card:hover .card-link .arrow {
    transform: translateX(4px);
}
