/* ==========================================================================
   GALLERY PAGE (gallery.html) — 3D Photo Ring + DragScroll Video Carousel
   ========================================================================== */

/* Основной контейнер */
.gallery-container {
    position: relative;
    width: 100%;
    height: calc(100vh - 150px);
    min-height: 600px;
    background-color: var(--bg-main);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
}

/* Верхняя и нижняя половины */
.gallery-top,
.gallery-bottom {
    flex: 1;
    height: 50%;
    width: 100%;
    position: relative;
    border-bottom: 2px solid var(--color-border);
    overflow: hidden;
}

/* ---- 3D Ring (фото) ---- */
.stage,
.ring,
.img {
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    user-select: none;
}

.stage {
    overflow: hidden;
    background: var(--bg-main);
}

.stage div { position: absolute; }

.container-3d {
    perspective: 2000px;
    width: 300px;
    height: 350px;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
}

.img {
    background-size: cover;
    background-repeat: no-repeat;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
}

/* ---- DragScroll (видео) ---- */
.video-carousel {
    width: 100%;
    height: 100%;
    cursor: grab;
    position: relative;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.video-carousel.dragging { cursor: grabbing; }

.video-carousel--wrap {
    white-space: nowrap;
    height: 100%;
    display: flex;
    align-items: center;
    will-change: transform;
}

.video-carousel--item {
    display: inline-block;
    width: 40vw;
    padding: 2vw;
    user-select: none;
    position: relative;
    will-change: transform;
}

.video-carousel--item figure {
    position: relative;
    z-index: 1;
    display: block;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 */
    overflow: hidden;
    margin: 0;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    background: var(--bg-block);
    will-change: transform;
}

.video-carousel--item figure iframe,
.video-carousel--item figure video {
    position: absolute;
    z-index: 1;
    height: 100%;
    width: 100%;
    object-fit: contain;
    border: none;
    top: 0; left: 0;
}

/* Drag-оверлей поверх видео */
.video-drag-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 2;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.2);
    transition: background 0.3s, opacity 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.video-drag-overlay:hover { background: rgba(0, 0, 0, 0.05); }

.video-play-btn {
    width: 60px; height: 60px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    transition: transform 0.2s;
}

.video-drag-overlay:hover .video-play-btn { transform: scale(1.1); }

/* Прогресс-бар */
.video-carousel--progress {
    position: absolute;
    z-index: 10;
    pointer-events: none;
    bottom: 2vw;
    width: 20vw;
    left: 50%;
    transform: translateX(-50%);
    height: 2px;
    background: rgba(255, 255, 255, 0.2);
}

.video-carousel--progress-bar {
    position: absolute;
    z-index: 1;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.8);
    transform: scaleX(0);
    transform-origin: 0% 0%;
}

/* Подписи слайдов */
.slide-title {
    background: var(--bg-block);
    color: var(--color-heading);
    padding: 5px 10px;
    font-size: 0.9rem;
    text-align: center;
    width: 100%;
    pointer-events: none;
}

.video-carousel--item figure .slide-title {
    position: absolute;
    bottom: 20px; left: 20px;
    border-radius: 8px;
    width: auto;
    max-width: 80%;
    font-size: 1.2rem;
    z-index: 10;
    text-align: left;
    white-space: normal;
}

/* Бейдж секции (Photos / Videos) */
.section-badge {
    position: absolute;
    top: 20px; left: 20px;
    background: var(--btn-cta-bg);
    color: var(--btn-cta-text);
    padding: 5px 15px;
    font-weight: 600;
    border-radius: 5px;
    z-index: 100;
    text-transform: uppercase;
}

/* Модальное окно изображения */
.image-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.image-modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90%;
    position: relative;
    top: 50%;
    transform: translateY(-50%);
    object-fit: contain;
}

.image-modal-close {
    position: absolute;
    top: 20px; right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    z-index: 10;
}

/* Заглушка при отсутствии фото */
.empty-message {
    color: var(--color-text-muted);
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .video-carousel--item {
        width: 100vw;
        padding: 4vw;
        box-sizing: border-box;
    }

    .video-carousel--progress {
        width: 60vw;
        bottom: 6vw;
    }

    .video-carousel--item figure .slide-title {
        font-size: 0.7rem;
        bottom: 8px;
        left: 8px;
        max-width: 90%;
    }

    .image-modal-content {
        max-width: 100%;
        max-height: 100%;
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }

    .image-modal-close {
        top: 15px;
        right: 20px;
        font-size: 35px;
    }
}
