/* Стилизация галереи */
.wp-block-gallery-6,
.wp-block-gallery-second {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.wp-block-gallery-6 figure,
.wp-block-gallery-second .wp-block-image.size-large {
    margin: 0;
    cursor: pointer;
    overflow: hidden;
    border: 1px solid #eee;
    border-radius: 8px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.wp-block-gallery-6 figure:hover,
.wp-block-gallery-second .wp-block-image.size-large:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.wp-block-gallery-6 img,
.wp-block-gallery-second .wp-block-image.size-large img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.wp-block-gallery-6 figure:hover img,
.wp-block-gallery-second .wp-block-image.size-large:hover img {
    transform: scale(1.1);
}

/* Стилизация модального окна */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: grab;
}

.image-modal:target {
    opacity: 1;
    visibility: visible;
}

.image-modal img {
    max-width: 95vw;
    max-height: 95vh;
    width: auto;
    height: auto;
    object-fit: contain;
    transform: scale(0.8);
    transition: transform 0.4s ease;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

.image-modal:target img {
    transform: scale(1);
}

.image-modal img:active {
    cursor: grabbing;
}

/* Элементы управления */
.modal-controls {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    z-index: 10002;
    background: rgba(0, 0, 0, 0.7);
    padding: 15px 25px;
    border-radius: 50px;
    backdrop-filter: blur(10px);
}

.control-btn {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

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

.control-btn:active {
    transform: scale(0.95);
}

.zoom-display {
    color: white;
    font-size: 16px;
    font-weight: 600;
    min-width: 80px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Кнопка закрытия */
.modal-close {
    position: fixed;
    top: 20px;
    right: 30px;
    color: #fff;
    text-decoration: none;
    font-size: 40px;
    font-weight: bold;
    line-height: 1;
    z-index: 10001;
    opacity: 0.8;
    transition: opacity 0.2s;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
}

.modal-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.7);
}

/* Навигация между изображениями */
.modal-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    text-decoration: none;
    font-size: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 0.7;
    transition: opacity 0.3s ease;
    border-radius: 50%;
}

.modal-nav:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.7);
}

.modal-prev {
    left: 20px;
}

.modal-next {
    right: 20px;
}

/* Индикатор текущего изображения */
.image-counter {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 16px;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 20px;
    border-radius: 20px;
    z-index: 10001;
}

/* Адаптивность */
@media (max-width: 768px) {
    .modal-controls {
        bottom: 20px;
        padding: 12px 20px;
    }
    
    .control-btn {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    .modal-nav {
        width: 50px;
        height: 50px;
        font-size: 25px;
    }
    
    .modal-prev {
        left: 10px;
    }
    
    .modal-next {
        right: 10px;
    }
    
    .modal-close {
        top: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 35px;
    }
}

@media (max-width: 480px) {
    .modal-controls {
        flex-wrap: wrap;
        justify-content: center;
        bottom: 10px;
        padding: 10px 15px;
    }
    
    .control-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .zoom-display {
        min-width: 60px;
        font-size: 14px;
    }
}
