/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
}

.modal-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    z-index: 2001;
}

.modal-close:hover {
    color: #bbb;
    transform: scale(1.1);
}

.modal-close:focus-visible {
    outline: 2px solid white;
    outline-offset: 4px;
    border-radius: 4px;
}

.modal-close:active {
    transform: scale(0.95);
    transition: all 0.05s ease;
}

.modal-controls {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 20px;
    z-index: 21;
}

.modal-prev, .modal-next {
    background-color: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 30px;
    font-weight: bold;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-prev:hover, .modal-next:hover {
    background-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.modal-prev:focus-visible, .modal-next:focus-visible {
    outline: 2px solid white;
    outline-offset: 3px;
    background-color: rgba(255, 255, 255, 0.4);
}

.modal-prev:active, .modal-next:active {
    transform: scale(0.95);
    transition: all 0.05s ease;
}

body.modal-open {
    overflow: hidden;
}

@media (max-width: 768px) {
    .modal-close {
        top: 15px;
        right: 20px;
        font-size: 35px;
    }
    
    .modal-prev, .modal-next {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
    
    .modal-image {
        max-width: 95%;
        max-height: 85%;
    }
}