/* --- VARIABLES Y ESTILOS GENERALES --- */
:root {
    --muni-azul-oscuro: #003E7A; 
    --muni-azul-claro: #43B0F9;
    --muni-verde: #BFDB23;
    --muni-rojo: #DB2F23;        
    --muni-gradiente: linear-gradient(90deg, var(--muni-azul-claro) 0%, var(--muni-verde) 100%);
    --texto-oscuro: #333;
    --blanco: #fff;
    --fuente-principal: 'Montserrat', sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0; font-family: var(--fuente-principal); color: var(--texto-oscuro);
    background-color: #f8f9fa; scroll-behavior: smooth; overflow-x: hidden;
}

h1, h2, h3, p { margin: 0; }
a { text-decoration: none; }

/* --- PORTADA SECPLAN --- */
.secplan-hero {
    position: relative; height: 70vh; display: flex; align-items: center;
    justify-content: center; text-align: center; color: var(--blanco); overflow: hidden;
}

.secplan-bg {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('https://images.unsplash.com/photo-1497366216548-37526070297c?q=80&w=2000&auto=format&fit=crop'); 
    background-size: cover; background-position: center;
    background-color: var(--muni-azul-oscuro); background-blend-mode: multiply; opacity: 0.85; z-index: 1;
}

.secplan-content { position: relative; z-index: 2; max-width: 900px; padding: 20px; }
.secplan-title { font-size: 4rem; font-weight: 800; margin-bottom: 20px; text-transform: uppercase; letter-spacing: 3px; }
.secplan-desc { font-size: 1.3rem; line-height: 1.6; margin-bottom: 30px; font-weight: 300; }
.linea-decorativa { width: 120px; height: 6px; background: var(--muni-rojo); margin: 0 auto 25px auto; border-radius: 3px; }

/* --- SECCIONES DE ESTADO (CON ANIMACIÓN SCROLL) --- */
.split-section {
    display: flex; flex-wrap: wrap; min-height: 600px;
    opacity: 0; transform: translateY(80px); transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}
.split-section.visible { opacity: 1; transform: translateY(0); }
.split-text {
    flex: 1; padding: 5rem; background: var(--blanco); color: var(--texto-oscuro);
    min-width: 400px; display: flex; flex-direction: column; justify-content: center;
    border-bottom: 4px solid var(--muni-azul-oscuro);
}
.split-image { flex: 1; min-height: 400px; background-size: cover; background-position: center; min-width: 400px; position: relative; }
.estado-badge { position: absolute; top: 30px; left: 30px; background: rgba(255,255,255,0.9); padding: 10px 20px; font-weight: 800; color: var(--muni-azul-oscuro); text-transform: uppercase; border-radius: 4px; box-shadow: 0 4px 10px rgba(0,0,0,0.2); }
.estado-titulo { color: var(--muni-azul-oscuro); font-size: 2.8rem; text-transform: uppercase; margin-bottom: 1.5rem; font-weight: 800; line-height: 1.1; }

.btn-ver {
    display: inline-block; margin-top: 30px; padding: 15px 35px; background-color: var(--muni-azul-oscuro);
    color: white; font-weight: 700; text-transform: uppercase; border-radius: 50px;
    transition: all 0.3s ease; width: fit-content; box-shadow: 0 5px 15px rgba(0, 62, 122, 0.3); cursor: pointer;
}
.btn-ver:hover { background: var(--muni-gradiente); transform: translateY(-3px); }
.split-section:nth-child(even) .split-text { order: 2; background: #f4f6f9; }
.split-section:nth-child(even) .split-image { order: 1; }

/* --- CARTERA Y FILTROS --- */
.proyectos-container { padding: 6rem 5%; background: #fff; }
.section-header { text-align: center; margin-bottom: 60px; }
.section-header h2 { font-size: 3rem; color: var(--muni-azul-oscuro); margin-bottom: 15px; font-weight: 800; }
.filtros-wrapper { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-bottom: 50px; }

.filter-btn {
    background: transparent; border: 2px solid #e0e0e0; padding: 10px 20px; border-radius: 30px;
    font-family: var(--fuente-principal); font-size: 0.85rem; font-weight: 600;
    color: #666; cursor: pointer; transition: all 0.3s ease; text-transform: uppercase;
}
.filter-btn:hover, .filter-btn.active { background: var(--muni-gradiente); color: white; border-color: transparent; transform: scale(1.05); }

/* --- GRID TARJETAS --- */
/* ==========================================
   5. GRID DE TARJETAS DE PROYECTOS (ACTUALIZADO)
   ========================================== */
.grid-proyectos { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 30px; }

.card-proyecto {
    position: relative; 
    height: 450px; 
    border-radius: 16px; 
    overflow: hidden;
    cursor: pointer; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.08); 
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Transición más rebotona y fluida */
    border: 4px solid transparent; /* Borde invisible preparado para aparecer */
}

.card-proyecto.hidden { display: none; }
.card-proyecto.show { animation: fadeInCard 0.5s ease forwards; }
@keyframes fadeInCard { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

/* EFECTO HOVER: Marco verde y zoom */
.card-proyecto:hover { 
    transform: scale(1.03) translateY(-8px); /* Zoom hacia adelante y hacia arriba */
    border-color: var(--muni-verde); /* El marco se pinta de verde institucional */
    box-shadow: 0 20px 40px rgba(191, 219, 35, 0.25); /* Brillo verde suave debajo */
}

.card-bg { width: 100%; height: 100%; background-size: cover; background-position: center; transition: transform 0.8s ease; }
.card-proyecto:hover .card-bg { transform: scale(1.10); /* La foto de adentro también hace zoom */ }
}
.card-proyecto.hidden { display: none; }
.card-proyecto.show { animation: fadeInCard 0.5s ease forwards; }
@keyframes fadeInCard { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.card-proyecto:hover { transform: translateY(-10px); box-shadow: 0 20px 40px rgba(0, 62, 122, 0.2); }
.card-bg { width: 100%; height: 100%; background-size: cover; background-position: center; transition: transform 0.8s ease; }
.card-proyecto:hover .card-bg { transform: scale(1.15); }

.card-overlay {
    position: absolute; bottom: 0; left: 0; width: 100%; height: 75%;
    background: linear-gradient(to top, rgba(0, 35, 70, 0.95) 10%, transparent 100%);
    padding: 30px; box-sizing: border-box; display: flex; flex-direction: column; justify-content: flex-end; color: white;
}
.card-eje { background-color: var(--muni-rojo); font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; padding: 6px 12px; border-radius: 4px; align-self: flex-start; margin-bottom: 15px; }
.card-titulo { font-size: 1.5rem; font-weight: 700; margin-bottom: 10px; line-height: 1.3; }
.card-subeje { font-size: 0.95rem; color: #eee; border-top: 1px solid rgba(255,255,255,0.3); padding-top: 10px; display: flex; align-items: center; }
.card-subeje::before { content: '•'; color: var(--muni-verde); font-size: 1.5rem; margin-right: 8px; line-height: 0; }

/* --- BOTÓN FLOTANTE Y PANEL LATERAL (TIMELINE) --- */
.btn-timeline-flotante {
    position: fixed; left: 0; top: 50%; transform: translateY(-50%);
    background-color: var(--muni-azul-oscuro); color: white; padding: 20px 10px;
    border-radius: 0 10px 10px 0; cursor: pointer; z-index: 998;
    box-shadow: 3px 3px 15px rgba(0,0,0,0.3); font-family: var(--fuente-principal);
    font-weight: 800; text-transform: uppercase; font-size: 0.9rem; letter-spacing: 2px;
    writing-mode: vertical-rl; text-orientation: mixed; transition: all 0.3s ease;
}
.btn-timeline-flotante:hover { background: var(--muni-rojo); padding-left: 15px; }

.sidebar-timeline {
    position: fixed; left: -450px; top: 0; width: 400px; max-width: 90vw; height: 100vh;
    background-color: white; z-index: 1001; box-shadow: 10px 0 20px rgba(0,0,0,0.2);
    transition: left 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); overflow-y: auto; padding: 40px 30px;
}
.sidebar-timeline.abierto { left: 0; }
.cerrar-sidebar { position: absolute; top: 20px; right: 25px; font-size: 35px; cursor: pointer; color: var(--muni-rojo); transition: 0.3s; }
.cerrar-sidebar:hover { transform: scale(1.1); }
.sidebar-timeline h2 { color: var(--muni-azul-oscuro); margin-bottom: 30px; font-size: 1.8rem; border-bottom: 3px solid var(--muni-gradiente); padding-bottom: 10px; }

.timeline-container { border-left: 3px solid var(--muni-azul-claro); padding-left: 25px; margin-left: 10px; }
.timeline-item { position: relative; margin-bottom: 25px; }
.timeline-item::before { content: ''; position: absolute; left: -33px; top: 0; width: 14px; height: 14px; background-color: var(--muni-verde); border-radius: 50%; border: 3px solid white; box-shadow: 0 0 5px rgba(0,0,0,0.3); }
.timeline-item h4 { color: var(--muni-azul-oscuro); margin-bottom: 5px; font-size: 1.1rem; }
.timeline-item p { font-size: 0.85rem; color: #666; line-height: 1.4; }

/* --- VENTANA MODAL (FICHA PROYECTO) --- */
.modal { display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,35,70,0.8); backdrop-filter: blur(5px); }
.modal-content { background-color: #fff; margin: 3% auto; padding: 0; width: 90%; max-width: 800px; border-radius: 12px; overflow: hidden; position: relative; box-shadow: 0 20px 50px rgba(0,0,0,0.5); animation: modalIn 0.4s ease-out; }
@keyframes modalIn { from { transform: translateY(-50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header { height: 350px; background-size: cover; background-position: center; position: relative; }
.close-btn { position: absolute; top: 15px; right: 20px; color: white; font-size: 35px; font-weight: bold; cursor: pointer; text-shadow: 0 2px 4px rgba(0,0,0,0.5); z-index: 10; transition: 0.3s; }
.close-btn:hover { color: var(--muni-rojo); transform: scale(1.1); }
.modal-body { padding: 40px; }
.modal-eje { color: var(--muni-rojo); font-weight: 800; text-transform: uppercase; font-size: 0.85rem; margin-bottom: 10px; display: inline-block; border-bottom: 2px solid var(--muni-rojo); }
.modal-titulo { color: var(--muni-azul-oscuro); font-size: 2.2rem; margin-bottom: 15px; font-weight: 800; }
.modal-desc { color: #555; line-height: 1.7; font-size: 1.1rem; margin-bottom: 30px; }
.modal-datos { display: flex; gap: 20px; border-top: 1px solid #eee; padding-top: 20px; background: #f8f9fa; padding: 20px; border-radius: 8px; }
.dato-item { flex: 1; }
.dato-item strong { color: var(--muni-azul-oscuro); display: block; margin-bottom: 5px; font-size: 0.9rem; text-transform: uppercase; }

/* Responsive */
@media (max-width: 768px) {
    .secplan-title { font-size: 2.5rem; }
    .split-text { padding: 3rem 2rem; }
    .grid-proyectos { grid-template-columns: 1fr; }
    .modal-datos { flex-direction: column; }
}

/* ==========================================
   8. BOTÓN VOLVER AL INICIO
   ========================================== */
.btn-volver {
    display: inline-flex; 
    align-items: center; 
    gap: 10px;
    background-color: var(--muni-verde); /* Fondo verde institucional */
    color: var(--muni-azul-oscuro); /* Letras azul oscuro */
    text-decoration: none;
    font-weight: 800; 
    padding: 12px 25px;
    border-radius: 30px; /* Bordes redondeados */
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    text-transform: uppercase;
    font-size: 0.95rem;
    width: fit-content;
    margin-bottom: 20px;
}

.btn-volver:hover { 
    transform: translateY(-3px); /* Se levanta un poco al pasar el mouse */
    box-shadow: 0 8px 20px rgba(191, 219, 35, 0.5); /* Brillo verde */
    background-color: var(--muni-azul-oscuro); /* Cambia a azul oscuro */
    color: var(--blanco); /* Letras blancas */
}

/* ==========================================
   9. ESTILOS ESPECIALES PARA PÁGINAS DE SECCIÓN (FONDO AZUL)
   ========================================== */

/* Esta clase se la pondremos al <body> de cierre.html, ejecucion.html, etc. */
.body-seccion-azul {
    /* Usamos el mismo degradado y foto de la ficha para dar continuidad */
    /* Ajusta 'img/fondo-ficha.jpg' si tu foto tiene otro nombre */
    background-image: 
        linear-gradient(135deg, rgba(0, 62, 122, 0.92) 0%, rgba(67, 176, 249, 0.92) 100%),
        url('img/fondo-ficha.jpg');
    background-attachment: fixed; /* El fondo se queda quieto al hacer scroll */
    background-size: cover;
    background-position: center;
    color: var(--blanco); /* Texto general blanco */
}

/* Hacemos transparente el contenedor que antes era blanco */
.body-seccion-azul .proyectos-container {
    background-color: transparent;
    padding-top: 2rem;
}

/* Ajustamos los títulos para que resalten en el fondo oscuro */
.body-seccion-azul .section-header h2 {
    color: var(--blanco);
    text-shadow: 0 4px 15px rgba(0,0,0,0.4); /* Sombra para más impacto */
}

.body-seccion-azul .section-header p {
    color: #e0e0e0; /* Un blanco un poco más suave para el subtítulo */
    font-weight: 600;
}

/* Rediseñamos los botones de filtro para fondo oscuro (Glassmorphism) */
.body-seccion-azul .filter-btn {
    background: rgba(255, 255, 255, 0.1); /* Fondo semitransparente */
    border-color: rgba(255,255,255,0.3);
    color: var(--blanco);
    backdrop-filter: blur(5px);
}

/* Al pasar el mouse o estar activo, se ponen verdes con texto azul */
.body-seccion-azul .filter-btn:hover, 
.body-seccion-azul .filter-btn.active {
    background: var(--muni-verde);
    border-color: transparent;
    color: var(--muni-azul-oscuro);
    font-weight: 800;
    box-shadow: 0 0 20px rgba(191, 219, 35, 0.6); /* Brillo verde intenso */
}