/* Секция галереи */
.gallery {
    background-color: white;
    width: 100%;
    max-width: 100vw;
    margin: 0 auto;
    padding: 60px 0;
    padding-bottom: 80px;
    overflow-x: hidden;
}

.gallery__container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Заголовок галереи */
.gallery__heading {
    color: var(--brand-primary);
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 5px;
}

/* Подзаголовок галереи */
.gallery__intro {
    color: var(--warm-gray);
    text-align: center;
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 55px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

/* Контейнер кнопок фильтра */
.gallery__filters {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 50px;
    flex-wrap: wrap;
}

/* Кнопки фильтра */
.gallery__filter {
    background-color: #f5f5f5;
    color: #8a8a8a;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.gallery__filter:hover {
    background-color: var(--brand-accent);
    color: white;
    transform: translateY(-2px);
}

.gallery__filter--active {
    background-color: var(--brand-accent);
    color: white;
}

/* Сетка галереи */
.gallery__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 60px;
}

/* Элемент галереи */
.gallery__item {
    position: relative;
    border-radius: 1.1rem;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #f0f0f0;
    aspect-ratio: 4/2.4;
    opacity: 1;
    transform: scale(1);
}

.gallery__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery__item:hover {
    transform: scale(1.025);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.gallery__item:hover .gallery__image {
    transform: scale(1.1);
}

/* Оверлей с описанием */
.gallery__overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    padding: 20px 15px 15px;
    opacity: 0;
    transition: opacity 0.3s ease;
    transform: translateY(10px);
}

.gallery__item:hover .gallery__overlay {
    opacity: 1;
    transform: translateY(0);
}

.gallery__caption {
    font-size: 0.9rem;
    margin: 0;
}

/* Секция призыва к действию */
.gallery__cta {
    text-align: center;
    margin-top: 60px;
}

.gallery__cta-heading {
    color: var(--brand-primary);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.gallery__cta-text {
    color: var(--warm-gray);
    font-size: 1.1rem;
    margin-bottom: 30px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.gallery__cta-button {
    background-color: var(--brand-accent);
    color: white;
    border: none;
    padding: 9px 30px;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-decoration: none;
}

.gallery__cta-button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(95, 157, 255, 0.3);
}

/* Адаптация для планшетов */
@media (max-width: 768px) {
    .gallery {
        padding: 40px 0;
    }
    
    .gallery__container {
        padding: 0 20px;
    }
    
    .gallery__heading {
        font-size: 2rem;
    }
    
    .gallery__intro {
        font-size: 1rem;
    }
    
    .gallery__filters {
        gap: 10px;
    }
    
    .gallery__filter {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .gallery__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .gallery__cta-heading {
        font-size: 1.7rem;
    }
    
    .gallery__cta-text {
        font-size: 1rem;
    }
}

/* Адаптация для мобильных устройств */
@media (max-width: 480px) {
    .gallery {
        padding: 30px 0;
    }
    
    .gallery__container {
        padding: 0 15px;
    }
    
    .gallery__heading {
        font-size: 1.8rem;
    }
    
    .gallery__intro {
        font-size: 0.95rem;
    }
    
    .gallery__filters {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    
    .gallery__filter {
        width: 100%;
        max-width: 200px;
        padding: 12px 20px;
    }
    
    .gallery__grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .gallery__cta-heading {
        font-size: 1.5rem;
    }
    
    .gallery__cta-text {
        font-size: 0.95rem;
    }
    
    .gallery__cta-button {
        padding: 12px 30px;
        font-size: 1rem;
    }
}

/* Модальное окно для галереи */
.gallery-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-modal--active {
    opacity: 1;
}

.gallery-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.gallery-modal__content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.gallery-modal--active .gallery-modal__content {
    transform: scale(1);
}

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

.gallery-modal__close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.gallery-modal__image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.gallery-modal__caption {
    color: white;
    text-align: center;
    margin-top: 20px;
    font-size: 1.1rem;
    font-weight: 500;
    max-width: 600px;
    line-height: 1.4;
}

/* Адаптация модального окна для мобильных устройств */
@media (max-width: 768px) {
    .gallery-modal__overlay {
        padding: 10px;
    }
    
    .gallery-modal__content {
        max-width: 95vw;
        max-height: 95vh;
    }
    
    .gallery-modal__close {
        top: -40px;
        width: 35px;
        height: 35px;
    }
    
    .gallery-modal__image {
        max-height: 70vh;
    }
    
    .gallery-modal__caption {
        font-size: 1rem;
        margin-top: 15px;
    }
}

@media (max-width: 480px) {
    .gallery-modal__close {
        top: -35px;
        width: 30px;
        height: 30px;
    }
    
    .gallery-modal__image {
        max-height: 60vh;
    }
    
    .gallery-modal__caption {
        font-size: 0.9rem;
        margin-top: 10px;
    }
}
