.gallery-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
}

.gallery-modal__content {
    position: relative;
    margin: auto;
    padding: 80px 0 20px;
    width: 90%;
    max-width: 1200px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.gallery-modal__nav-mobile {
    display: none;
    justify-content: center;
    gap: 40px;
    margin-top: 20px;
}

.gallery-modal__prev-mobile,
.gallery-modal__next-mobile {
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    font-size: 30px;
    padding: 12px 16px;
    border-radius: 50%;
    cursor: pointer;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-modal__prev-mobile:hover,
.gallery-modal__next-mobile:hover {
    background: rgba(0, 0, 0, 0.9);
}

.gallery-modal__image {
    max-width: 100%;
    max-height: calc(80vh - 100px);
    object-fit: contain;
}

.gallery-modal__close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
}

.gallery-modal__close:hover {
    color: #bbb;
}

.gallery-modal__prev,
.gallery-modal__next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: white;
    font-size: 60px;
    cursor: pointer;
    padding: 16px;
    user-select: none;
    z-index: 1001;
}

.gallery-modal__prev {
    left: 20px;
}

.gallery-modal__next {
    right: 20px;
}

.gallery-modal__prev:hover,
.gallery-modal__next:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.gallery-modal__info {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    text-align: center;
    padding: 16px 20px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    max-width: 80%;
    z-index: 1002;
}

.gallery-modal__title {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: bold;
}

.gallery-modal__description {
    margin: 0;
    font-size: 14px;
    color: #ccc;
}

@media (max-width: 768px) {
    .gallery-modal__content {
        width: 95%;
        padding: 0;
        justify-content: center;
    }
    
    .gallery-modal__image {
        max-height: 50vh;
        max-width: 90%;
    }
    
    .gallery-modal__prev,
    .gallery-modal__next {
        display: none;
    }
    
    .gallery-modal__nav-mobile {
        display: flex;
    }
    
    .gallery-modal__close {
        font-size: 25px;
        top: 20px;
        right: 20px;
        position: fixed;
    }
    
    .gallery-modal__info {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        margin-bottom: 20px;
        padding: 12px 16px;
        max-width: 90%;
    }
    
    .gallery-modal__title {
        font-size: 16px;
        margin-bottom: 6px;
    }
    
    .gallery-modal__description {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .gallery-modal__image {
        max-height: 45vh;
    }
    
    .gallery-modal__close {
        font-size: 22px;
        top: 15px;
        right: 15px;
    }
    
    .gallery-modal__info {
        margin-bottom: 15px;
        padding: 10px 12px;
        max-width: 95%;
    }
    
    .gallery-modal__title {
        font-size: 14px;
        margin-bottom: 4px;
    }
    
    .gallery-modal__description {
        font-size: 12px;
    }
    
    .gallery-modal__prev-mobile,
    .gallery-modal__next-mobile {
        font-size: 24px;
        width: 50px;
        height: 50px;
        padding: 8px;
    }
    
    .gallery-modal__nav-mobile {
        gap: 30px;
        margin-top: 15px;
    }
}
/*
.works__grid_page {
    display: flex;
    flex-wrap: wrap;
    margin-top: 100px;
}
.works__grid_page .works__caption{
    font-weight: 400;
    font-size: 18px;
}
.works__grid_page .works__img{
    aspect-ratio: 1/1;
    margin-bottom:0;
}
.works__grid_page .works__card.works__card_empty{

}
.works__grid_page .works__card.odd{

}
.works__grid_page .works__card_row {
    display: flex;
    width: 100%;
    height: 588px;
    position: relative;
}
.works__grid_page .works__card_row.odd {
    flex-direction: row-reverse;
}
.works__grid_page .works__card_row .works__card.odd picture {
position: absolute;
top: -110px;
}
.works__grid_page .works__card_row .works__card{
    position: relative;
}
.works__grid_page .works__card{
    display: flex;
    flex-direction: column;
    flex: 0 0 50%;
    padding: 0 24px;
}*/
/* Основные стили для сетки */
.works__grid_page {
    display: flex;
    flex-direction: column;
    position: relative;
    margin-top: 100px;
}

/* Стили для рядов */
.works__card_row {
    display: flex;
    position: relative;
    z-index: 1;
}

/* Ряды с классом odd - реверсируем направление */
.works__card_row.odd {
    flex-direction: row-reverse;
}

/* Карточки внутри ряда */
.works__card {
    flex: 1;
    position: relative;
}

/* ЧЕТНЫЕ карточки (обычные) - отступ справа */
.works__card:not(.works__card_empty):not(.odd) {
    margin-right: 90px;
    margin-left: 0;
}

/* НЕЧЕТНЫЕ карточки (с классом odd) - отступ слева */
.works__card.odd:not(.works__card_empty) {
    margin-left: 90px;
    margin-right: 0;
}

/* Пустые карточки - без отступов */
.works__card_empty {
    min-height: 200px;
}

/* Стили для изображений */
.works__img {
    width: 100%;
    height: auto;
    display: block;
}

/* Ключевые стили для перекрытия */
.works__card_row:not(:first-child) {
    margin-top: -180px;
}

/* Для рядов с классом odd добавляем дополнительный z-index */
.works__card_row.odd {
    z-index: 2;
}

/* Обеспечиваем, чтобы картинки были выше пустых блоков */
.works__card:not(.works__card_empty) {
    position: relative;
    z-index: 3;
}

/* Стили для подписей */
.works__caption {
    padding: 15px;
    text-align: center;
    background: #fff;
    position: relative;
    z-index: 4;
}

/* Медиа-запрос для мобильных устройств */
@media (max-width: 768px) {
    .works__grid_page {
        gap: 20px;
    }

    .works__card_row {
        flex-direction: column !important;
        margin-top: 0 !important;
        gap: 20px;
    }

    .works__card_row:not(:first-child) {
        margin-top: 0 !important;
    }

    /* Убираем все боковые отступы на мобильных */
    .works__card:not(.works__card_empty),
    .works__card.odd:not(.works__card_empty) {
        margin-right: 0 !important;
        margin-left: 0 !important;
        width: 100%;
    }

    /* Скрываем пустые блоки на мобильных */
    .works__card_empty {
        display: none !important;
    }
}