/* ============================================================
   Before / After Diagonal Carousel  —  Frontend Styles
   ============================================================ */

/* ── Wrapper ─────────────────────────────────────────────── */
.ba-carousel-wrapper {
    width: 100%;
    overflow: hidden;
    position: relative;
}

/* ── Track ───────────────────────────────────────────────── */
.ba-track {
    display: flex;
    will-change: transform;
    gap: 20px;
}

/* ── Card ────────────────────────────────────────────────── */
.ba-card {
    flex: 0 0 calc(33.333% - 14px);
    flex-shrink: 0 !important;
    max-width: calc(33.333% - 14px);
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    cursor: none;
}

.ba-card img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
    pointer-events: none;
    user-select: none;
}

.ba-clip-after,
.ba-clip-before {
    width: 100%;
    height: 100%;
}

/* ── Диагональные слои ───────────────────────────────────── */
.ba-clip-after {
    position: absolute;
    inset: 0;
    z-index: 1;
}
.ba-clip-before {
    position: absolute;
    inset: 0;
    z-index: 2;
    clip-path: polygon(0 0, 100% 0, 0 100%);
}
/* Режим галереи - скрываем before слой */
.ba-carousel-wrapper[data-carousel-mode="gallery"] .ba-clip-before {
    display: none;
}
/* ── Labels (карусель) ───────────────────────────────────── */
.ba-label {
    position: absolute;
    z-index: 4;
    font-family: 'Segoe UI', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    padding: 5px 11px;
    border-radius: 6px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    pointer-events: none;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.ba-label:empty { display: none; }
.ba-label-before { top: 14px; left: 14px; }
.ba-label-after  { bottom: 14px; right: 14px; }

/* ── Лупа-курсор ─────────────────────────────────────────── */
.ba-magnify-icon {
    position: fixed;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--ba-icon-bg, #000);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.18s ease;
}
.ba-magnify-icon.ba-visible { opacity: 1; }

/* ============================================================
   MODAL
   ============================================================ */
.ba-modal-root {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100000;
}
.ba-modal-root.ba-open {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ba-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 5, 8, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* контейнер модали — размер ставит JS по натуральным размерам фото */
.ba-modal-content {
    position: relative;
    z-index: 2;
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}

/* ── Кнопка закрыть — правый верхний угол ────────────────── */
.ba-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 20;
    background: var(--ba-icon-bg, #000);
    border: none;
    color: #fff;
    font-size: 24px;
    line-height: 1;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.2s;
    padding: 0;
}
.ba-modal-close:hover {
    opacity: 0.8;
}

/* ── Вьюпорт ─────────────────────────────────────────────── */
.ba-modal-viewport {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* «После» — полный размер вьюпорта, нижний слой, прижат к правому краю */
.ba-modal-after {
    position: absolute;
    inset: 0;
    z-index: 1;
}
.ba-modal-after img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: right center;
    display: block;
    pointer-events: none;
    user-select: none;
}

/*
   «До» — контейнер обрезает справа (overflow:hidden + width = pct%).
   Изображение внутри имеет ТОЧНО тот же размер, что и вьюпорт,
   так что при обрезании контейнера картинка просто «срезается» справа,
   а не масштабируется.
*/
.ba-modal-before {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 50%;           /* JS обновляет */
    overflow: hidden;
    z-index: 2;
}
.ba-modal-before img {
    position: absolute;
    top: 0;
    left: 0;
    /* width и height = размер вьюпорта в px, ставит JS */
    object-fit: cover;
    object-position: left center;
    display: block;
    pointer-events: none;
    user-select: none;
}

/* ── Разделитель ─────────────────────────────────────────── */
.ba-modal-divider {
    position: absolute;
    top: 0;
    height: 100%;
    width: 0;
    z-index: 10;
    transform: translateX(-50%);
    cursor: ew-resize;
}
/* В режиме галереи скрываем разделитель */
.ba-modal-root[data-mode="gallery"] .ba-modal-divider {
    display: none;
}
.ba-modal-root[data-mode="gallery"] .ba-modal-before {
    display: none;
}
.ba-modal-divider-line {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 100%;
    background: #fff;
    box-shadow: 0 0 8px rgba(0,0,0,0.4);
}

.ba-modal-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 3px 14px rgba(0,0,0,0.38);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #222;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ba-modal-divider:hover .ba-modal-handle {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 4px 18px rgba(0,0,0,0.48);
}
.ba-modal-divider.ba-dragging .ba-modal-handle {
    transform: translate(-50%, -50%) scale(1.18);
    box-shadow: 0 6px 24px rgba(0,0,0,0.55);
}

.ba-handle-icon { display: block; }

/* ── Modal labels ────────────────────────────────────────── */
.ba-modal-label {
    position: absolute;
    z-index: 15;
    font-family: 'Segoe UI', sans-serif;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 6px 14px;
    border-radius: 8px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    pointer-events: none;
    user-select: none;
}
.ba-modal-label:empty { display: none; }

/* Before — верхний левый */
.ba-modal-label-before {
    top: 18px;
    left: 18px;
}
/* After — нижний правый */
.ba-modal-label-after {
    bottom: 18px;
    right: 18px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .ba-modal-content {
        max-width: 95vw;
        max-height: 90vh;
    }
}
