/* --- Estilos da Grade de Cartões --- */
.ghg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.hover-card {
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

/* Garante que o hover card e suas imagens não tenham estilos indesejados */
.hover-card img {
    width: 100%;
    max-width: 100% !important;
    height: auto;
    display: block;
    transition: transform .5s ease;
}

.card-content {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 20px;
    z-index: 2;
    transition: .4s;
}

.card-content h3 {
    color: #fff; margin: 0;
    text-shadow: 0 2px 10px rgba(0,0,0,0.6);
    font-family: "IBM Plex Sans Condensed", Sans-serif;
    font-size: 18px;
}

.overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.5), transparent);
    opacity: 0; transition: .4s; z-index: 3;
}

.hover-card:hover img { transform: scale(1.1); }
.hover-card:hover .overlay { opacity: 1; }

/* --- Estilos do Modal (Isolando do Elementor) --- */

/* Recipiente Principal do Modal */
#ghg-modal {
    position: fixed !important; 
    inset: 0;
    display: none; 
    z-index: 100000; /* Mais alto que a barra do admin */
    overflow: hidden; /* Evita rolagem dupla */
}

/* Fundo Escuro */
.ghg-backdrop {
    position: absolute !important; 
    inset: 0 !important;
    background: rgba(0,0,0,0.92) !important;
}

/* Container de Conteúdo do Modal (Onde fica a imagem) */
.ghg-content {
    position: absolute !important;
    top: 50% !important; 
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 90% !important; 
    max-width: 1000px !important;
    color: #fff !important; 
    text-align: center !important;
    box-sizing: border-box !important;
    cursor: grab;
}

/* AJUSTE CRÍTICO: Isola a Imagem do Modal de Estilos Globais */
#ghg-modal-img {
    display: block !important;
    margin: 0 auto !important;
    max-height: 70vh !important; /* Imagem ocupa no máximo 70% da altura da tela */
    width: auto !important; /* Ajusta largura proporcionalmente */
    max-width: 100% !important; /* Mas nunca maior que o container */
    object-fit: contain !important; /* Garante que a imagem não seja cortada */
    pointer-events: none; /* Deixa o drag funcionar */
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* Botão de Fechar (O "X") */
#ghg-close {
    position: absolute !important;
    top: -50px !important; 
    right: 0 !important;
    font-size: 50px !important; 
    color: #fff !important;
    cursor: pointer !important; 
    line-height: 1 !important;
    z-index: 100001 !important; /* Mais alto que tudo */
    padding: 10px !important;
}

/* Área de Texto no Modal */
.ghg-text {
    margin-top: 20px !important;
}

#ghg-modal-title {
    color: #fff !important;
    font-size: 24px !important;
    font-weight: bold !important;
    margin-bottom: 10px !important;
}

#ghg-modal-desc {
    color: #ccc !important;
    font-size: 16px !important;
}

/* --- Ajustes para Dispositivos Móveis --- */
@media (max-width: 768px) {
    .ghg-content { 
        top: 0 !important; 
        transform: translate(-50%, 0) !important; 
        padding-top: 80px !important; /* Espaço para o "X" no topo */
    }
    
    #ghg-modal-img { 
        max-height: 55vh !important; /* Imagem um pouco menor em pé */
    }
    
    #ghg-close {
        top: 10px !important;
        right: 10px !important;
    }
}