/* =====================================================================
   Before/After Gallery for Elementor
   Dark theme • comparison slider • filter bar • lightbox popup
   ===================================================================== */

/* --------------------------------------------------------------
   1. Gallery container
-------------------------------------------------------------- */
.ba-gallery {
    box-sizing: border-box;
    background-color: #0B0B0B;
    border-radius: 24px;
    color: #F1EDE3;
}
.ba-gallery *,
.ba-gallery *::before,
.ba-gallery *::after { box-sizing: border-box; }

/* --------------------------------------------------------------
   2. Filter bar
-------------------------------------------------------------- */
.ba-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 28px;
}
.ba-filter__btn {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    font: inherit;
    font-size: 16px;
    line-height: 1;
    padding: 16px 30px;
    border-radius: 999px;
    border: 1px solid rgba(219, 190, 130, 0.55);
    background-color: #100F0D;
    background-image: none;
    color: #F1EDE3;
    transition:
        background-color .25s ease,
        background-image .25s ease,
        color .25s ease,
        border-color .25s ease,
        transform .25s ease;
}
.ba-filter__btn:hover {
    border-color: #DEC48A;
    transform: translateY(-1px);
}
.ba-filter__btn:focus-visible {
    outline: 2px solid #C79C51;
    outline-offset: 2px;
}
.ba-filter__btn.is-active {
    background-color: transparent;
    background-image: linear-gradient(135deg, var(--ba-grad-1, #EACB87), var(--ba-grad-2, #C79C51));
    border-color: transparent;
    color: var(--ba-grad-text, #181206);
}

/* --------------------------------------------------------------
   3. Grid + cards
-------------------------------------------------------------- */
.ba-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}
.ba-card {
    margin: 0;
    background-color: #141311;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 22px;
    padding: 14px;
    animation: baFadeIn .5s ease both;
}
.ba-card.is-hidden { display: none; }

@keyframes baFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------
   4. Media containers
-------------------------------------------------------------- */
.ba-compare,
.ba-media {
    position: relative;
    overflow: hidden;
    border-radius: 14px;
    aspect-ratio: 4 / 3;
    background: #0e0d0c;
}
.ba-media img,
.ba-compare__base {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.ba-gallery[data-lightbox="yes"] .ba-media { cursor: zoom-in; }

/* --------------------------------------------------------------
   5. Comparison slider
   BEFORE image = clipped layer (left of divider)
   AFTER image  = base layer (right of divider)
-------------------------------------------------------------- */
.ba-compare {
    --ba-pos: 40%;
    cursor: ew-resize;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}
.ba-compare:focus-visible {
    outline: 2px solid #C79C51;
    outline-offset: 3px;
}
.ba-compare img {
    -webkit-user-drag: none;
    user-select: none;
}
.ba-compare__clip {
    position: absolute;
    inset: 0;
    clip-path: inset(0 calc(100% - var(--ba-pos)) 0 0);
    -webkit-clip-path: inset(0 calc(100% - var(--ba-pos)) 0 0);
    pointer-events: none;
}
.ba-compare__clip img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.ba-compare__divider {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--ba-pos);
    width: 2px;
    background: rgba(255, 255, 255, 0.9);
    transform: translateX(-50%);
    pointer-events: none;
}
.ba-compare__handle {
    position: absolute;
    top: 50%;
    left: var(--ba-pos);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #2F6BFF;
    transform: translate(-50%, -50%);
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .45);
}

/* --------------------------------------------------------------
   6. Badges (clickable)
   Click BEFORE → fully reveals the before image
   Click AFTER  → fully reveals the after image
-------------------------------------------------------------- */
.ba-badge {
    position: absolute;
    top: 14px;
    z-index: 2;
    padding: 9px 18px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    line-height: 1;
    pointer-events: auto;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: filter .2s ease, transform .2s ease;
}
.ba-badge:hover,
.ba-badge:focus-visible {
    filter: brightness(1.15);
    transform: translateY(-1px);
}
.ba-badge:focus-visible {
    outline: 2px solid #C79C51;
    outline-offset: 2px;
}
.ba-badge--before {
    left: 14px;
    background-color: #41434A;
    color: #FFFFFF;
}
.ba-badge--after {
    right: 14px;
    background-color: #D9B36A;
    color: #171207;
}

/* --------------------------------------------------------------
   7. Zoom (popup trigger) button
-------------------------------------------------------------- */
.ba-zoom {
    position: absolute;
    right: 14px;
    bottom: 14px;
    z-index: 4;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    padding: 0;
    cursor: zoom-in;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(8, 8, 8, 0.55);
    color: #fff;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    transition:
        background-color .25s ease,
        color .25s ease,
        border-color .25s ease,
        transform .25s ease;
}
.ba-zoom svg { display: block; }
.ba-zoom:hover,
.ba-zoom:focus-visible {
    background-color: #D9B36A;
    border-color: #D9B36A;
    color: #171207;
    transform: scale(1.07);
}
.ba-zoom:focus-visible {
    outline: 2px solid #C79C51;
    outline-offset: 2px;
}

/* --------------------------------------------------------------
   8. Caption
-------------------------------------------------------------- */
.ba-card__caption {
    margin: 16px 8px 6px;
    font-size: 17px;
    line-height: 1.55;
    color: #D9D5CD;
}

/* --------------------------------------------------------------
   9. Lightbox popup
-------------------------------------------------------------- */
body.ba-lb-open { overflow: hidden !important; }

.ba-lb {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.ba-lb[hidden] { display: none; }

.ba-lb__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 6, 6, 0.93);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    animation: baLbFade .3s ease;
}
.ba-lb__dialog {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 94vw;
    max-height: 92vh;
    animation: baLbIn .35s cubic-bezier(.2, .7, .3, 1);
}
@keyframes baLbFade { from { opacity: 0; } }
@keyframes baLbIn   { from { opacity: 0; transform: scale(.94) translateY(14px); } }

.ba-lb__stage { width: 100%; }
.ba-lb__stage .ba-compare {
    width: 100%;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.ba-lb__img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 76vh;
    margin: 0 auto;
    border-radius: 14px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.ba-lb__caption {
    margin-top: 16px;
    color: #D9D5CD;
    font-size: 15px;
    line-height: 1.6;
    text-align: center;
    max-width: 720px;
}
.ba-lb__counter {
    position: absolute;
    top: 30px;
    left: 28px;
    z-index: 3;
    color: rgba(241, 237, 227, .75);
    font-size: 13px;
    letter-spacing: .12em;
}
.ba-lb__close,
.ba-lb__nav {
    position: absolute;
    z-index: 3;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 19, 17, .85);
    border: 1px solid rgba(219, 190, 130, .45);
    color: #F1EDE3;
    transition:
        background .25s ease,
        color .25s ease,
        border-color .25s ease,
        transform .25s ease;
}
.ba-lb__close:hover,
.ba-lb__nav:hover {
    background-image: linear-gradient(135deg, #EACB87, #C79C51);
    color: #181206;
    border-color: transparent;
}
.ba-lb__close:focus-visible,
.ba-lb__nav:focus-visible {
    outline: 2px solid #C79C51;
    outline-offset: 2px;
}
.ba-lb__close { top: 20px; right: 20px; }
.ba-lb__prev  { left: 20px;  top: 50%; transform: translateY(-50%); }
.ba-lb__next  { right: 20px; top: 50%; transform: translateY(-50%); }
.ba-lb__prev:hover { transform: translateY(-50%) scale(1.07); }
.ba-lb__next:hover { transform: translateY(-50%) scale(1.07); }

/* --------------------------------------------------------------
   10. Mobile
-------------------------------------------------------------- */
@media (max-width: 767px) {
    .ba-grid { grid-template-columns: 1fr; }
    .ba-filter__btn { padding: 12px 20px; font-size: 14px; }
    .ba-badge { top: 10px; padding: 7px 13px; }
    .ba-badge--before { left: 10px; }
    .ba-badge--after { right: 10px; }
    .ba-zoom { right: 10px; bottom: 10px; width: 38px; height: 38px; }
    .ba-lb { padding: 12px; }
    .ba-lb__close { top: 12px; right: 12px; width: 40px; height: 40px; }
    .ba-lb__prev { left: 10px; width: 40px; height: 40px; }
    .ba-lb__next { right: 10px; width: 40px; height: 40px; }
    .ba-lb__counter { top: 22px; left: 18px; }
    .ba-lb__caption { font-size: 14px; }
}