.gallery-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1.25rem;
    margin: 1rem 0;
}

@media (min-width: 576px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 850px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.gallery-card {
    position: relative;
    border: 1px solid var(--documenter-border-color, #dee2e6);
    border-radius: 0.25rem;
    overflow: hidden;
}

.gallery-card-image {
    position: relative;
    width: 100%;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 0.5rem;
    background: var(--documenter-box-bg, #f5f5f5);
}

.gallery-card-image img {
    /* keep aspect ratio and fit inside the fixed-size container, no cropping */
    max-width: 100%;
    max-height: 100%;
}

.gallery-card-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: rgb(11, 117, 145);
    color: #fff;
    text-align: center;
    font-size: 0.85rem;
    padding: 0.75rem;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.gallery-card-overlay p {
    margin: 0;
}

.gallery-card:hover .gallery-card-overlay {
    opacity: 0.9;
}

.gallery-card-footer {
    min-height: 3.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.4rem 0.6rem;
}

.gallery-card:hover .gallery-card-footer {
    color: rgb(11, 117, 145);
}

.gallery-card-link {
    position: absolute;
    inset: 0;
    z-index: 1;
}
