/* Основные стили галереи */
.gallery-section {
    width: 100%;
    min-height: 100vh;
    background-color: #111;
    padding: 20px 0;
    position: relative;
    scroll-snap-align: start;
    scroll-margin-top: 20px;
    overflow: hidden;
}

/* Параллакс-эффект для фона */
.gallery-parallax-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 110%;
    height: 110%;
    background: linear-gradient(45deg, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.9));
    background-size: cover;
    background-position: center;
    transform: translateZ(-1px) scale(1.1); /* Эффект глубины */
    z-index: -1;
    animation: parallaxMove 20s linear infinite; /* Анимация движения */
}

@keyframes parallaxMove {
    0% {
        transform: translateZ(-1px) scale(1.1) translateY(0);
    }
    50% {
        transform: translateZ(-1px) scale(1.1) translateY(-5%);
    }
    100% {
        transform: translateZ(-1px) scale(1.1) translateY(0);
    }
}

/* Контейнер галереи */
.gallery-container {
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Контейнер для прокрутки */
.gallery-scroll {
    display: flex;
    height: 100%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-behavior: smooth;
    touch-action: pan-y;
}

.gallery-scroll::-webkit-scrollbar {
    display: none;
}

/* Каждый элемент галереи */
.gallery-item {
    flex: 0 0 100vw;
    min-width: 100vw;
    height: 100%;
    scroll-snap-align: center;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0; /* Начальная прозрачность */
    transform: scale(0.9) translateY(20px); /* Начальное смещение */
    transition: opacity 0.8s ease, transform 0.8s ease; /* Анимация */
    transition-delay: 0.2s; /* Задержка анимации */
}

.gallery-item.active {
    opacity: 1; /* Полная видимость */
    transform: scale(1) translateY(0); /* Нормальный масштаб и положение */
}

.gallery-item img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    background-color: #111;
    border-radius: 10px;
    transition: all 0.5s ease;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1); /* Лёгкая подсветка */
}

.gallery-item.active img {
    transform: scale(1.05); /* Легкое увеличение */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    filter: brightness(1.1) contrast(1.1); /* Яркость и контраст */
}

/* Размытие фона при увеличении изображения */
.gallery-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px); /* Размытие */
    z-index: -1;
    border-radius: 10px;
}

/* Эффект тиснения для активного изображения */
.gallery-item.active img {
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.7)) 
            grayscale(0.1) 
            brightness(1.1) 
            contrast(1.1);
}

/* Подсветка краёв активного изображения */
.gallery-item.active::after {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    animation: glow 2s infinite alternate; /* Анимация подсветки */
}

@keyframes glow {
    0% {
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    }
    100% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.6);
    }
}

/* Навигация */
.gallery-nav {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    transform: translateY(-50%);
    z-index: 100;
    pointer-events: none;
}

.gallery-nav button {
    pointer-events: all;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gallery-nav button:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.1);
}

/* Адаптация для мобильных */
@media (max-width: 768px) {
    .gallery-nav button {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .gallery-item img {
        max-width: 100%;
        max-height: 100%;
    }
    
    .gallery-scroll {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
    }
}

/* Фикс для iOS */
@supports (-webkit-touch-callout: none) {
    .gallery-scroll {
        -webkit-overflow-scrolling: touch;
    }
}