/* ============================================================
   Розділ «До / Після» — публічна частина
   ============================================================ */

.ba-subtitle {
    position: relative;
    z-index: 2;
    text-align: center;
    color: hsla(0, 0%, 100%, .85);
    font-family: 'Montserrat', sans-serif;
    font-weight: 300;
    letter-spacing: .04em;
    margin-top: .6rem;
}

/* Сітка робіт — 3 в ряд на ПК, 2 на планшеті, 1 на телефоні */
.ba-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.75rem;
    max-width: 1200px;
    margin: 0 auto;
}

.ba-item {
    display: flex;
    flex-direction: column;
}

/* Слайдер порівняння */
.ba-compare {
    --pos: 50%;
    position: relative;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border-radius: 16px;
    background: #2a2226;
    margin: 0;
    cursor: ew-resize;
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y;
    box-shadow: 0 10px 30px rgba(50, 20, 34, .12);
}

/* Кожне фото + його підпис — окремий шар, який обрізається повзунком,
   тож підпис «До» видно лише там, де видно фото «До» (і навпаки). */
.ba-layer {
    position: absolute;
    inset: 0;
}

.ba-layer--after {
    z-index: 1;
    clip-path: inset(0 0 0 var(--pos));
    /* видно праву частину (Після) */
}

.ba-layer--before {
    z-index: 2;
    clip-path: inset(0 calc(100% - var(--pos)) 0 0);
    /* видно ліву частину (До) */
}

.ba-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    -webkit-user-drag: none;
    user-select: none;
}

.ba-divider {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--pos);
    width: 2px;
    background: hsla(0, 0%, 100%, .9);
    transform: translateX(-50%);
    z-index: 3;
    pointer-events: none;
}

.ba-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: hsla(0, 0%, 100%, .96);
    color: #cf65a5;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .35);
}

.ba-knob svg {
    width: 14px;
    height: 14px;
    margin: 0 -2px;
}

/* Підписи До / Після */
.ba-tag {
    position: absolute;
    bottom: 16px;
    z-index: 4;
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: clamp(1.4rem, 2.6vw, 2rem);
    letter-spacing: .04em;
    text-shadow: 0 2px 12px rgba(0, 0, 0, .9);
    display: flex;
    flex-direction: column;
    pointer-events: none;
    max-width: 55%;
}

.ba-tag small {
    font-weight: 400;
    font-size: clamp(.8rem, 1.3vw, .98rem);
    letter-spacing: .01em;
    opacity: .92;
    margin-top: 3px;
}

.ba-tag--before {
    left: 16px;
    align-items: flex-start;
    text-align: left;
}

.ba-tag--after {
    right: 16px;
    align-items: flex-end;
    text-align: right;
}

/* Порожній стан */
.ba-empty {
    max-width: 640px;
    margin: 1rem auto 0;
    text-align: center;
    color: #8a7a80;
    background: #fff;
    border: 1px dashed #e3d4db;
    border-radius: 16px;
    padding: 3rem 1.5rem;
    font-family: 'Montserrat', sans-serif;
}

/* Планшет / малий ноут — 2 в ряд */
@media (max-width: 1000px) {
    .ba-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.4rem;
    }
}

/* Телефон — 1 в ряд, великий блок на всю ширину */
@media (max-width: 640px) {
    .ba-grid {
        grid-template-columns: 1fr;
        gap: 1.4rem;
    }
}
