/* 1. FORZAR EL HEADER AZUL DESDE EL INICIO */
.main-header {
    background-color: #001A51 !important;
}

/* 2. ESTRUCTURA GENERAL (Centrado exacto en 1 pantalla) */
.maquinaria-page {
    width: 100%;
    min-height: 100vh; /* Obliga a ocupar una pantalla completa */
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: center; /* Centra el bloque verticalmente */
    padding-top: 100px; 
    padding-bottom: 40px;
    box-sizing: border-box;
    font-family: 'Roboto', sans-serif;
}

/* ENCABEZADO */
.maquinaria-header {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 30px auto; /* Redujimos el margen inferior para que quepa mejor */
    padding: 0 20px;
}

.titulo-maquinaria {
    color: #001A51;
    font-size: 38px;
    font-weight: 700;
    margin-bottom: 10px;
}

.subtitulo-maquinaria {
    color: #555555;
    font-size: 16px;
    line-height: 1.6;
    font-weight: 300;
}

/* 3. GRID DE MAQUINARIA (Bordes y distribución) */
.maquinaria-container {
    width: 85%; /* Aleja las imágenes de los bordes laterales */
    max-width: 1100px; /* Las agrupa de forma más compacta y elegante */
    margin: 0 auto;
}

.maquinaria-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr); /* 5 columnas exactas = 2 filas de 5 */
    gap: 15px; /* Espacio limpio entre cada foto */
    width: 100%;
}

/* RESPONSIVE DEL GRID (Para que no se vea minúsculo en celulares) */
@media (max-width: 1024px) {
    .maquinaria-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 768px) {
    .maquinaria-grid { grid-template-columns: repeat(2, 1fr); }
    .maquinaria-container { width: 95%; } /* En celulares sí aprovechamos más el borde */
}

/* TARJETAS CON EFECTO DINÁMICO */
.maquinaria-item {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    cursor: pointer;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
}

.maquinaria-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

/* Capa amarilla inicial oculta */
.maquinaria-item::after {
    content: "";
    position: absolute;
    inset: 0;
    background-color: rgba(244, 157, 0, 0);
    transition: background-color 0.4s ease;
    z-index: 1;
}

/* Texto de "Ver Detalles" oculto */
.hover-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -30%);
    opacity: 0;
    z-index: 2;
    background-color: #001A51;
    color: #ffffff;
    padding: 10px 25px;
    border-radius: 30px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.4s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 26, 81, 0.4);
}

/* Flechita dentro del botón */
.hover-text::after {
    content: "→"; 
    font-size: 18px;
    transition: transform 0.3s ease;
}

/* ==========================================
   ACCIONES AL PASAR EL MOUSE (CONSOLIDADAS) 
   ========================================== */

/* 1. Sombra de la tarjeta completa */
.maquinaria-item:hover {
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.2);
}

/* 2. La imagen SÓLO hace zoom (ya no necesita recuperar color) */
.maquinaria-item:hover img {
    transform: scale(1.1); 
}

/* 3. Aparece el fondo amarillo translúcido */
.maquinaria-item:hover::after {
    background-color: rgba(244, 157, 0, 0.6); 
}

/* 4. El botón "Ver Detalles" sube y se hace visible */
.maquinaria-item:hover .hover-text {
    opacity: 1;
    transform: translate(-50%, -50%); 
}

/* 5. La flechita se mueve ligeramente a la derecha */
.maquinaria-item:hover .hover-text::after {
    transform: translateX(4px); 
}

/* ====== MODAL DINÁMICO MEJORADO ====== */
.modal-maq {
    display: none; /* Cambia a flex por JS */
    position: fixed;
    inset: 0;
    background: rgba(0, 26, 81, 0.7); /* Azul oscuro corporativo con opacidad */
    justify-content: center;
    align-items: center;
    z-index: 999999;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.4s ease;
}

/* Clase para activar la transición del fondo */
.modal-maq.active {
    opacity: 1;
}

.modal-maq-content {
    background: #f49d00;
    width: 100%;
    max-width: 1100px;
    max-height: 90vh;
    border-radius: 20px;
    display: flex;
    gap: 40px;
    padding: 40px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow-y: auto;
    
    /* Estado inicial para la animación de entrada */
    transform: translateY(40px) scale(0.95);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Clase para activar la tarjeta amarilla */
.modal-maq-content.active {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.modal-maq-content img {
    width: 45%;
    object-fit: cover;
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.modal-maq-text {
    flex: 1;
    color: #001A51;
}

.modal-maq-text h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 20px;
    margin-top: 0;
    line-height: 1.2;
}

.modal-maq-text p, .modal-maq-text ul {
    font-size: 16px;
    line-height: 1.7;
    font-weight: 400;
    margin-bottom: 15px;
}

.modal-maq-text ul {
    padding-left: 20px;
    margin-top: 10px;
}

.modal-maq-text li {
    margin-bottom: 8px;
}

.modal-maq-text strong {
    font-weight: 700;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 36px;
    color: #001A51;
    cursor: pointer;
    line-height: 1;
    transition: transform 0.2s;
}

.close-btn:hover {
    transform: scale(1.2);
}

.close-btn-mobile {
    display: none;
}

/* ANIMACIÓN REVEAL (Al hacer scroll en la página) */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* ====== RESPONSIVE ====== */
@media (max-width: 900px) {
    .modal-maq-content {
        flex-direction: column;
        padding: 30px;
        gap: 25px;
    }
    .modal-maq-content img {
        width: 100%;
        max-height: 350px;
    }
    .modal-maq-text h2 {
        font-size: 26px;
    }
}

@media (max-width: 768px) {
    .titulo-maquinaria { font-size: 30px; }
    
    .modal-maq { padding: 15px; }
    
    .modal-maq-content {
        padding: 20px;
        border-radius: 15px;
    }
    
    .close-btn { display: none; } /* Ocultamos la X superior en móviles */
    
    .close-btn-mobile {
        display: block;
        background: #001A51;
        color: #ffffff;
        border: none;
        padding: 12px;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 600;
        width: 100%;
        cursor: pointer;
        margin-top: 10px;
    }
}

.maquinaria-grid .maquinaria-item:nth-child(1) { transition-delay: 0.1s; }
.maquinaria-grid .maquinaria-item:nth-child(2) { transition-delay: 0.2s; }
.maquinaria-grid .maquinaria-item:nth-child(3) { transition-delay: 0.3s; }
.maquinaria-grid .maquinaria-item:nth-child(4) { transition-delay: 0.4s; }
.maquinaria-grid .maquinaria-item:nth-child(5) { transition-delay: 0.5s; }
.maquinaria-grid .maquinaria-item:nth-child(6) { transition-delay: 0.1s; }
.maquinaria-grid .maquinaria-item:nth-child(7) { transition-delay: 0.2s; }
.maquinaria-grid .maquinaria-item:nth-child(8) { transition-delay: 0.3s; }
.maquinaria-grid .maquinaria-item:nth-child(9) { transition-delay: 0.4s; }
.maquinaria-grid .maquinaria-item:nth-child(10) { transition-delay: 0.5s; }