/* ==========================================================================
   Section: before-after — proof gallery with a light lightbox
   ========================================================================== */

.sec-before-after {
    padding: 80px 0;
    background: var(--c-white);
}

.ba__inner {
    max-width: var(--content-max);
    margin-inline: auto;
    padding-inline: var(--pad-x);
}

.ba__head {
    max-width: 720px;
    margin: 0 auto 48px;
    text-align: center;
}

.ba__title {
    margin: 0;
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: clamp(32px, 3.4vw, 48px);
    line-height: 1.2;
    color: var(--c-black);
}

.ba__text {
    margin: 16px 0 0;
    font-size: 18px;
    line-height: 1.5;
    color: var(--c-text);
}

/* Grid --------------------------------------------------------------------- */
.ba__grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.ba__thumb {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.ba__img {
    display: block;
    width: 100%;
    height: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.ba__thumb:hover .ba__img,
.ba__thumb:focus-visible .ba__img {
    transform: scale(1.04);
}

.ba__caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 20px 14px 10px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.55) 100%);
    color: #fff;
    font-size: 14px;
    line-height: 1.3;
    text-align: left;
}

/* Lightbox ----------------------------------------------------------------- */
.ba__lightbox[hidden] {
    display: none;
}

.ba__lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.ba__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
}

.ba__dialog {
    position: relative;
    margin: 0;
    max-width: 92vw;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ba__full {
    display: block;
    max-width: 92vw;
    max-height: 82vh;
    border-radius: 8px;
}

.ba__figcaption {
    margin-top: 12px;
    color: #fff;
    font-size: 15px;
    text-align: center;
}

.ba__figcaption:empty {
    display: none;
}

.ba__close {
    position: absolute;
    top: -44px;
    right: 0;
    display: inline-flex;
    padding: 6px;
    border: 0;
    background: none;
    color: #fff;
    cursor: pointer;
    line-height: 0;
}

.ba__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    padding: 10px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    cursor: pointer;
    line-height: 0;
}

.ba__nav:hover,
.ba__nav:focus-visible {
    background: rgba(255, 255, 255, 0.3);
}

.ba__nav--prev {
    left: -60px;
}

.ba__nav--next {
    right: -60px;
}

/* Responsive --------------------------------------------------------------- */
@media (max-width: 1023px) {
    .ba__grid {
        gap: 16px;
    }
}

@media (max-width: 639px) {
    .sec-before-after {
        padding: 48px 0;
    }

    .ba__head {
        margin-bottom: 32px;
    }

    .ba__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Arrows overlap the image on small screens */
    .ba__nav--prev {
        left: 4px;
    }

    .ba__nav--next {
        right: 4px;
    }

    .ba__nav {
        background: rgba(0, 0, 0, 0.4);
    }
}
