/* Gallery page */

.gallery-group {
    margin-bottom: 3.5rem;
}

.gallery-group:last-of-type {
    margin-bottom: 0;
}

.gallery-group-title {
    font-weight: 800;
    color: var(--ink);
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--brand-light);
}

.gallery-card {
    position: relative;
    margin: 0;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.gallery-card img {
    width: 100%;
    height: 260px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.gallery-card:hover img {
    transform: scale(1.05);
}

.gallery-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    padding: 1rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0) 55%);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.gallery-card:hover .gallery-overlay,
.gallery-card:focus-within .gallery-overlay {
    opacity: 1;
}

.gallery-overlay span {
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Before / After badges */
.ba-card .ba-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 2;
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-xs);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.ba-before {
    background: var(--ink);
}

.ba-after {
    background: var(--brand);
}

/* Touch devices have no hover: show captions permanently and skip hover motion */
@media (hover: none) {
    .gallery-overlay {
        opacity: 1;
    }

    .gallery-card:hover img {
        transform: none;
    }
}

/* Before/After pairs: proportional box so the full structure shows on small screens */
@media (max-width: 991.98px) {
    .ba-card img {
        height: auto;
        aspect-ratio: 4 / 3;
    }
}

/* Single-column gallery on phones/small tablets: proportional crop, not a thin slab */
@media (max-width: 767.98px) {
    .gallery-card img {
        height: auto;
        aspect-ratio: 4 / 3;
    }

    .gallery-group {
        margin-bottom: 2.5rem;
    }
}
