y/* =========================================
   Модальное окно с фоновой картинкой
   Файл: fonticons.css (обновлённый)
   ========================================= */

/* Оверлей (затемнённый фон) */
.modal-overlay-fi {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay-fi.active {
    opacity: 1;
    visibility: visible;
}

/* Окно модального окна */
.modal-window-fi {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: visible;
    
    transform: scale(0.95) translateY(10px);
    transition: transform 0.3s ease;
    
    /* Ширина: 2/3 viewport, высота: авто */
    width: 66.66vw;
    max-width: 1100px;
    height: auto; /* ИЗМЕНЕНО: авто вместо фиксированной высоты */
    max-height: 90vh; /* Ограничение максимальной высоты */
    
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay-fi.active .modal-window-fi {
    transform: scale(1) translateY(0);
}

/* Контейнер для картинки с кнопкой */
.modal-image-container-fi {
    position: relative;
    width: 100%;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ссылка с фоновой картинкой */
.modal-image-link-fi {
    display: block;
    width: 100%;
    /* Убираем фиксированную высоту */
    min-height: 200px; /* Минимальная высота */
    background-image: url('go.jpg');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #667eea;
    cursor: pointer;
    border-radius: 16px;
    position: relative;
    
    /* Аспект соотношения сторон (опционально) */
    /* aspect-ratio: 16/9; */ /* Раскомментируйте если нужно фиксированное соотношение */
}

/* Кнопка закрытия */
.modal-close-fi {
    position: absolute;
    top: -15px;
    right: -15px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    font-size: 28px;
    color: #333;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
    line-height: 1;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.modal-close-fi:hover {
    background: white;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

.modal-close-fi:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Эффект при наведении на картинку */
.modal-image-link-fi::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
    border-radius: 16px;
}

.modal-image-link-fi:hover::before {
    background: rgba(0, 0, 0, 0.15);
}

.modal-image-link-fi:active::before {
    background: rgba(0, 0, 0, 0.25);
}

/* Блокировка скролла */
body.modal-open-fi {
    overflow: hidden;
}

/* Учёт админ-бара WordPress */
@media (max-width: 782px) {
    .modal-overlay-fi {
        top: 46px;
        height: calc(100% - 46px);
    }
}

@media (min-width: 783px) {
    .modal-overlay-fi {
        top: 32px;
        height: calc(100% - 32px);
    }
}

/* Адаптив для мобильных */
@media (max-width: 768px) {
    .modal-window-fi {
        width: 95%;
        max-height: 85vh;
        padding: 0;
    }

    .modal-close-fi {
        top: -12px;
        right: -12px;
        font-size: 24px;
        width: 36px;
        height: 36px;
    }
    
    .modal-image-link-fi {
        min-height: 150px;
    }
}