/* --- css/gallery.css --- */

/* Стили галереи (оставлены без изменений) */
.gallery-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 15px;
}
.gallery-item {
    height: 300px; overflow: hidden; cursor: pointer; position: relative;
    border: 1px solid rgba(255, 145, 0, 0.2);
}
.gallery-item img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.5s ease;
    filter: grayscale(60%);
}
.gallery-item:hover img {
    transform: scale(1.1);
    filter: grayscale(0%);
}
.gallery-item::after {
    content: ''; 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: rgba(255, 145, 0, 0.1); 
    opacity: 0; 
    transition: 0.3s;
    /* КРИТИЧЕСКОЕ ИЗМЕНЕНИЕ: Позволяет кликам проходить сквозь этот элемент */
    pointer-events: none; 
}
.gallery-item:hover::after { opacity: 1; }

/* Добавьте также курсор, чтобы пользователь видел, что элемент кликабелен */
.gallery-item img {
    /* ... существующие стили ... */
    cursor: pointer; 
}
.gallery-item:hover::after { opacity: 1; }

/* --- НОВЫЕ СТИЛИ ДЛЯ ЛАЙТБОКСА (МОДАЛЬНОЕ ОКНО) --- */

.lightbox {
    display: none; /* Скрыто по умолчанию */
    position: fixed; 
    z-index: 2000;
    padding-top: 50px; 
    left: 0; top: 0;
    width: 100%; height: 100%;
    overflow: auto; 
    background-color: rgba(0, 0, 0, 0.95);
    transition: opacity 0.3s;
}

/* НОВЫЙ КЛАСС: Делает лайтбокс видимым */
.lightbox.is-visible {
    display: flex; 
    /* Используем flex для удобного центрирования содержимого */
} 
.lightbox-content-wrapper {
    position: relative;
    width: 90%; 
    max-width: 1200px;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.lightbox-img {
    margin: auto;
    display: block;
    width: auto;
    max-width: 95%; /* Максимальная ширина */
    max-height: 90vh; /* Максимальная высота от окна просмотра */
    animation: zoom 0.6s;
    border: 3px solid var(--accent-primary);
    box-shadow: 0 0 40px rgba(255, 145, 0, 0.5);
}

@keyframes zoom {
    from {transform: scale(0.1)} 
    to {transform: scale(1)}
}

/* Кнопка закрытия */
.lightbox-close {
    position: absolute;
    top: 20px; right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    text-shadow: 0 0 10px var(--accent-primary);
    z-index: 2001;
}
.lightbox-close:hover,
.lightbox-close:focus {
    color: var(--accent-primary);
}

/* Кнопки листания (Вперед/Назад) */
.lightbox-prev, .lightbox-next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px;
    margin-top: -50px;
    color: white;
    font-weight: bold;
    font-size: 20px;
    transition: 0.6s ease;
    border-radius: 0 3px 3px 0;
    user-select: none;
    background-color: rgba(0,0,0,0.5);
    z-index: 2001;
}
.lightbox-next {
    right: 0;
    border-radius: 3px 0 0 3px;
}
.lightbox-prev {
    left: 0;
    border-radius: 0 3px 3px 0;
}
.lightbox-prev:hover, .lightbox-next:hover {
    background-color: var(--accent-primary);
    color: #000;
}

@media only screen and (max-width: 700px){
    .lightbox-prev, .lightbox-next {
        padding: 8px;
        font-size: 14px;
    }
}