/* Gallery Block Component */
.gallery-block {
    padding: var(--spacing-xxl) var(--spacing-lg);
    background-color: var(--color-bg-primary);
}

.gallery-block__container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.gallery-block__header {
    text-align: center;
    margin-bottom: var(--spacing-xxl);
}

.gallery-block__title {
    font-family: var(--font-family-base);
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-md);
}

.gallery-block__subtitle {
    font-family: var(--font-family-base);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-relaxed);
    color: var(--color-text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Gallery Slider */
.gallery-block__slider-wrapper {
    position: relative;
    width: 100%;
}

.gallery-block__slider {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.gallery-block__track {
    display: flex;
    transition: transform 0.4s ease-in-out;
    gap: var(--spacing-md);
}

.gallery-block__slide {
    flex: 0 0 calc(20% - var(--spacing-md) * 0.8);
    min-width: 0;
}

.gallery-block__image-item {
    position: relative;
    width: 100%;
    background-color: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 4 / 3;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-block__image-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.gallery-block__image-item:hover .gallery-block__overlay {
    opacity: 1;
}

.gallery-block__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-block__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.gallery-block__zoom-icon {
    width: 48px;
    height: 48px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    backdrop-filter: blur(4px);
}

.gallery-block__zoom-icon svg {
    width: 24px;
    height: 24px;
}

/* Navigation Buttons */
.gallery-block__nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 48px;
    height: 48px;
    background-color: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    color: var(--color-text-primary);
}

.gallery-block__nav-button:hover {
    background-color: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.gallery-block__nav-button:active {
    transform: translateY(-50%) scale(0.95);
}

.gallery-block__nav-button:disabled,
.gallery-block__nav-button[hidden] {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.gallery-block__nav-button svg {
    width: 24px;
    height: 24px;
}

.gallery-block__nav-button--prev {
    left: -24px;
}

.gallery-block__nav-button--next {
    right: -24px;
}

/* Indicators */
.gallery-block__indicators {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: var(--spacing-xl);
}

.gallery-block__counter {
    font-family: var(--font-family-base);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-primary);
    background-color: rgba(255, 255, 255, 0.9);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Lightbox */
.gallery-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-lightbox.gallery-lightbox--active {
    display: flex;
    opacity: 1;
}

.gallery-lightbox__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(4px);
}

.gallery-lightbox__content {
    position: relative;
    width: 90%;
    max-width: 1400px;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.gallery-lightbox__image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-lightbox__preload-container {
    position: absolute;
    visibility: hidden;
    width: 0;
    height: 0;
    overflow: hidden;
    pointer-events: none;
}

.gallery-lightbox__preload-container img {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.gallery-lightbox__image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(0);
    opacity: 1;
    will-change: opacity, transform;
}

/* Анимация ухода влево (при переходе к следующему изображению) */
.gallery-lightbox__image.gallery-lightbox__image--slide-out-left {
    opacity: 0;
    transform: translateX(-100px);
}

/* Анимация ухода вправо (при переходе к предыдущему изображению) */
.gallery-lightbox__image.gallery-lightbox__image--slide-out-right {
    opacity: 0;
    transform: translateX(100px);
}

/* Анимация появления слева (для предыдущего изображения) */
.gallery-lightbox__image.gallery-lightbox__image--slide-in-from-left {
    opacity: 0;
    transform: translateX(-100px);
    animation: lightboxImageSlideInFromLeft 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Анимация появления справа (для следующего изображения) */
.gallery-lightbox__image.gallery-lightbox__image--slide-in-from-right {
    opacity: 0;
    transform: translateX(100px);
    animation: lightboxImageSlideInFromRight 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Старая анимация fade-in для первого открытия */
.gallery-lightbox__image.gallery-lightbox__image--fade-in {
    opacity: 0;
    transform: scale(0.95);
    animation: lightboxImageFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes lightboxImageSlideInFromRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes lightboxImageSlideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes lightboxImageFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.gallery-lightbox__close {
    position: absolute;
    top: -50px;
    right: 0;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
    color: white;
    z-index: 2;
}

.gallery-lightbox__close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.gallery-lightbox__close svg {
    width: 24px;
    height: 24px;
}

.gallery-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
    color: white;
    z-index: 2;
}

.gallery-lightbox__nav:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.gallery-lightbox__nav:disabled,
.gallery-lightbox__nav[hidden] {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.gallery-lightbox__nav svg {
    width: 24px;
    height: 24px;
}

.gallery-lightbox__nav--prev {
    left: -60px;
}

.gallery-lightbox__nav--next {
    right: -60px;
}

.gallery-lightbox__counter {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-medium);
    background-color: rgba(255, 255, 255, 0.1);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    backdrop-filter: blur(4px);
}

/* Tablet styles */
@media (max-width: 991px) {
    .gallery-block {
        padding: var(--spacing-xl) var(--spacing-md);
    }
    
    .gallery-block__title {
        font-size: var(--font-size-2xl);
    }
    
    .gallery-block__subtitle {
        font-size: var(--font-size-base);
    }
    
    .gallery-block__slide {
        flex: 0 0 calc(33.333% - var(--spacing-md) * 0.67);
    }
    
    .gallery-block__nav-button--prev {
        left: -16px;
    }
    
    .gallery-block__nav-button--next {
        right: -16px;
    }
    
    .gallery-lightbox__nav--prev {
        left: 10px;
    }
    
    .gallery-lightbox__nav--next {
        right: 10px;
    }
    
    .gallery-lightbox__close {
        top: 10px;
        right: 10px;
    }
    
    .gallery-lightbox__counter {
        bottom: 10px;
    }
}

/* Mobile styles */
@media (max-width: 767px) {
    .gallery-block {
        padding: var(--spacing-xl) var(--spacing-md);
    }
    
    .gallery-block__header {
        margin-bottom: var(--spacing-xl);
    }
    
    .gallery-block__title {
        font-size: var(--font-size-2xl);
        margin-bottom: var(--spacing-sm);
    }
    
    .gallery-block__subtitle {
        font-size: var(--font-size-base);
    }
    
    .gallery-block__slide {
        flex: 0 0 calc(50% - var(--spacing-md) * 0.5);
    }
    
    .gallery-block__nav-button {
        width: 40px;
        height: 40px;
    }
    
    .gallery-block__nav-button svg {
        width: 20px;
        height: 20px;
    }
    
    .gallery-block__nav-button--prev {
        left: -12px;
    }
    
    .gallery-block__nav-button--next {
        right: -12px;
    }
}

/* Small mobile styles */
@media (max-width: 480px) {
    .gallery-block {
        padding: var(--spacing-lg) var(--spacing-md);
    }
    
    .gallery-block__header {
        margin-bottom: var(--spacing-lg);
    }
    
    .gallery-block__title {
        font-size: var(--font-size-xl);
    }
    
    .gallery-block__subtitle {
        font-size: var(--font-size-sm);
    }
    
    .gallery-block__slide {
        flex: 0 0 calc(100% - var(--spacing-md));
    }
    
    .gallery-block__nav-button {
        width: 36px;
        height: 36px;
    }
    
    .gallery-block__nav-button svg {
        width: 18px;
        height: 18px;
    }
    
    .gallery-lightbox__content {
        width: 95%;
    }
    
    .gallery-lightbox__nav {
        width: 40px;
        height: 40px;
    }
    
    .gallery-lightbox__nav svg {
        width: 20px;
        height: 20px;
    }
}