/* --- VARIABLES DE ESTILO (PALETA CARCIP) --- */
:root {
    --bg-color: #FAFAFA;
    --text-color: #333333;
    --accent-color: #642424; /* Burdeos extraído del logo CARCIP */
    --gold-color: #C5A059;    
    --white: #FFFFFF;
    --whatsapp-blue: #1B2631; /* Azul original conservado para botón WA */
}

/* --- BASES --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Lato', sans-serif; background-color: var(--bg-color); color: var(--text-color); line-height: 1.6; overflow-x: hidden; }
h1, h2, h3, h4 { font-family: 'Garamond', serif; color: var(--accent-color); font-weight: 600; }
a { text-decoration: none; color: inherit; transition: 0.3s; cursor: pointer; }
img { max-width: 100%; display: block; }
ul { list-style: none; }
html { scroll-behavior: smooth; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* --- ANIMACIONES SCROLL REVEAL --- */
.reveal { opacity: 0; transform: translateY(50px); transition: all 1s ease; }
.reveal.active { opacity: 1; transform: translateY(0); }

/* --- HEADER & NAVEGACIÓN --- */
header {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    padding: 15px 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
    transition: background-color 0.4s ease, box-shadow 0.4s ease, padding 0.4s ease;
}

header.scrolled {
    background-color: var(--white);
    background-image: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 10px 0;
}

nav { display: flex; justify-content: space-between; align-items: center; position: relative; }

.logo { 
    padding: 0; 
    height: 70px; 
    display: flex;
    align-items: center;
    z-index: 1001; 
    transition: 0.4s;
}

.logo img {
    height: 85px; 
    width: auto;
    transition: all 0.3s ease;
}

.nav-links { display: flex; gap: 15px; } 
.nav-links a { 
    font-size: 0.9rem; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    color: var(--white);  
    transition: 0.4s; 
    font-weight: 400; 
    white-space: nowrap;
}
header.scrolled .nav-links a { color: var(--text-color); }
.nav-links a:hover { color: var(--gold-color) !important; }

.hamburger { display: none; flex-direction: column; cursor: pointer; gap: 5px; z-index: 1001; }
.hamburger span { width: 25px; height: 2px; background-color: var(--white); transition: 0.4s; }
header.scrolled .hamburger span { background-color: var(--accent-color); }

/* --- SECCIONES GENERALES --- */
section { padding: 80px 0; }
.section-title { text-align: center; font-size: 2.5rem; margin-bottom: 50px; position: relative; }
.section-title::after { content: ""; display: block; width: 60px; height: 2px; background-color: var(--gold-color); margin: 20px auto 0; }

/* --- HERO SECTION --- */
#hero { 
    height: 100vh; 
    display: flex; align-items: center; justify-content: center; text-align: center; 
    position: relative; overflow: hidden; color: var(--white); background-color: #2C3E50; 
}
#hero::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-image: url('imagenes/fondo.jpg'); background-size: cover; background-position: center top; opacity: 0.65; z-index: 0; }
#hero::after { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.4)); z-index: 0; }

.hero-content { position: relative; z-index: 1; max-width: 1000px; }
.hero-content h1 { font-size: 3.5rem; margin-bottom: 20px; color: #FFFFFF; text-shadow: 2px 2px 15px rgba(0,0,0,0.8); line-height: 1.2; font-family: 'Garamond', 'Baskerville', 'Baskerville Old Face', 'Hoefler Text', 'Times New Roman', serif;}
.hero-content p { font-size: 1.5rem; font-style: italic; color: #F0F0F0; font-weight: 300; text-shadow: 1px 1px 10px rgba(0,0,0,0.8); }

/* ESTILOS DEL LOGO EN HERO */
.hero-logo {
    max-width: 180px;
    height: auto;
    margin-bottom: 30px;
    filter: brightness(0) invert(1); 
    opacity: 0.95;
    display: inline-block;
}

/* --- ACADEMIA --- */
.academy-intro p { font-size: 1.15rem; line-height: 1.9; color: #555; max-width: 800px; margin: 0 auto; text-align: center; }
.academy-values { display: flex; justify-content: center; gap: 50px; margin-top: 50px; text-align: center; }
.value-item h4 { font-size: 1rem; margin-bottom: 10px; color: var(--gold-color); text-transform: uppercase; letter-spacing: 1px; }
.value-item p { font-size: 0.9rem; color: #777; }

/* --- ABOUT --- */
.about-grid { display: grid; grid-template-columns: 1fr 1.5fr; gap: 50px; align-items: center; }
.director-img-container { position: relative; width: 100%; height: 400px; overflow: hidden; border-radius: 4px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); }
.director-img-container img { width: 100%; height: 100%; object-fit: cover; }
.bio-text p { margin-bottom: 20px; text-align: justify; }

/* --- STAFF / EQUIPO ACADÉMICO --- */
.staff-card {
    min-width: 300px; width: 300px; flex-shrink: 0; scroll-snap-align: center;
    background: #fff; border: 1px solid #eee; padding: 30px 20px; 
    text-align: center; transition: 0.3s; display: flex; flex-direction: column; align-items: center;
}
.staff-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.05); border-bottom: 2px solid var(--gold-color); }
.staff-photo {
    width: 120px; height: 120px; border-radius: 50%; object-fit: cover;
    margin-bottom: 20px; border: 3px solid #eee;
}
.staff-role { color: var(--gold-color); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; display: block; font-weight: bold; }
.staff-bio { font-size: 0.9rem; color: #666; margin-bottom: 20px; line-height: 1.5; }

/* --- PARTNERS --- */
#partners { background-color: #FAFAFA; border-top: 1px solid #eee; }
.partners-grid {
    display: flex; justify-content: center; align-items: center; gap: 60px; flex-wrap: wrap; margin-top: 40px;
}
.partner-logo {
    max-height: 80px; 
    width: auto;
    max-width: 220px; 
    object-fit: contain;
    filter: grayscale(100%); opacity: 0.6; transition: 0.4s; cursor: pointer;
}
.partner-logo:hover { filter: grayscale(0%); opacity: 1; transform: scale(1.05); }

/* --- CARDS GENERALES --- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; }
.news-card { background: var(--white); padding: 30px; border: 1px solid #eee; transition: 0.3s; display: flex; flex-direction: column; justify-content: space-between; }
.news-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.05); border-bottom: 2px solid var(--gold-color); }
.card-date { font-size: 0.85rem; color: #999; margin-bottom: 10px; display: block; }
.news-card h3 { margin: 15px 0; font-size: 1.3rem; }
.tag { font-size: 0.75rem; text-transform: uppercase; color: var(--gold-color); font-weight: bold; letter-spacing: 1px; }
.read-more-btn { color: var(--accent-color); font-weight: bold; font-size: 0.9rem; margin-top: 15px; border-bottom: 1px solid transparent; display: inline-block; cursor: pointer; }
.read-more-btn:hover { color: var(--gold-color); border-bottom-color: var(--gold-color); }
.view-all-container { text-align: center; margin-top: 50px; width: 100%; }
.btn-secondary { padding: 10px 30px; border: 1px solid #ccc; color: #666; font-size: 0.9rem; letter-spacing: 1px; transition: 0.3s; cursor: pointer; background: transparent; display: inline-block; }
.btn-secondary:hover { border-color: var(--accent-color); color: var(--accent-color); }
.hidden-item { display: none !important; }

/* --- CARRUSEL GENÉRICO --- */
.carousel-wrapper { position: relative; max-width: 100%; margin: 0 auto; }
.carousel-container { display: flex; gap: 20px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; padding-bottom: 20px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.carousel-container::-webkit-scrollbar { display: none; }

.video-card { min-width: 300px; width: 300px; flex-shrink: 0; scroll-snap-align: start; background: #fff; border: 1px solid #eee; padding: 15px; transition: 0.3s; cursor: pointer; }
.video-card:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(0,0,0,0.05); }
.video-thumb-container { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; background: #000; margin-bottom: 15px; border-radius: 4px; }
.video-thumb-container img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.8; transition: 0.3s; }
.video-card:hover .video-thumb-container img { opacity: 1; transform: scale(1.05); }
.play-icon { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 50px; height: 50px; background: rgba(27, 38, 49, 0.8); border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid var(--gold-color); transition: 0.3s; }
.play-icon::after { content: ""; display: block; width: 0; height: 0; border-style: solid; border-width: 8px 0 8px 14px; border-color: transparent transparent transparent #fff; margin-left: 4px; }
.video-card:hover .play-icon { background: var(--gold-color); border-color: #fff; transform: translate(-50%, -50%) scale(1.1); }
.video-title { font-family: 'Garamond', serif; font-size: 1.1rem; margin-bottom: 5px; color: var(--accent-color); }
.video-desc { font-size: 0.85rem; color: #777; }

.carousel-btn { position: absolute; top: 45%; transform: translateY(-50%); background: var(--white); border: 1px solid #eee; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; z-index: 10; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 10px rgba(0,0,0,0.1); transition: 0.3s; color: var(--accent-color); }
.carousel-btn:hover { background: var(--accent-color); color: var(--white); }
.prev-btn { left: -20px; }
.next-btn { right: -20px; }

/* --- MODAL --- */
.modal { display: none; position: fixed; z-index: 1100; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.7); overflow: auto; backdrop-filter: blur(5px); }
.modal-content { background-color: #fff; margin: 5% auto; padding: 50px; border: 1px solid #888; width: 80%; max-width: 900px; position: relative; box-shadow: 0 5px 15px rgba(0,0,0,0.3); animation: fadeIn 0.4s; max-height: 90vh; overflow-y: auto; }
.close-modal { color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer; transition: 0.3s; }
.close-modal:hover { color: var(--accent-color); }
.modal-body h2 { font-size: 2rem; margin-bottom: 10px; margin-top: 0; }
.modal-meta { color: var(--gold-color); font-size: 0.9rem; margin-bottom: 30px; display: block; font-weight: bold; }
.modal-text p { margin-bottom: 20px; font-size: 1.05rem; line-height: 1.8; color: #444; }
.modal-text img { max-width: 100%; height: auto; margin: 10px 0; border-radius: 4px; }

.modal-img-left { float: left; max-width: 40%; height: auto; margin-right: 30px; margin-bottom: 20px; border-radius: 4px; cursor: zoom-in; }
.modal-gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 30px; border-top: 1px solid #eee; padding-top: 30px; clear: both; }
.modal-gallery img { width: 100%; height: 250px; object-fit: cover; border-radius: 4px; transition: 0.3s; cursor: zoom-in; }
.modal-gallery img:hover { opacity: 0.9; transform: scale(1.02); }

/* LISTAS EN MODALES */
.modal-list { list-style: none; padding: 0; margin-top: 20px; }
.modal-list li { padding: 15px 0; border-bottom: 1px solid #eee; font-size: 1rem; display: flex; justify-content: space-between; align-items: center; }
.modal-list li:last-child { border-bottom: none; }
.modal-badge { font-size: 0.75rem; text-transform: uppercase; padding: 5px 10px; border-radius: 4px; background: #f0f0f0; color: #666; letter-spacing: 1px; }
.modal-badge.open { background: #e8f5e9; color: #2e7d32; }

/* --- LIGHTBOX --- */
#imageOverlay { display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.95); align-items: center; justify-content: center; }
#lightbox-content-wrapper { position: relative; max-width: 90%; max-height: 90vh; display: flex; justify-content: center; align-items: center; }
#expandedImg { max-width: 100%; max-height: 90vh; border: 2px solid #fff; box-shadow: 0 0 20px rgba(255,255,255,0.1); display: none; }
#expandedVideoFrame { width: 80vw; height: 45vw; max-width: 1000px; max-height: 562px; border: 2px solid #fff; display: none; }
.close-img-overlay { position: absolute; top: 20px; right: 30px; color: #fff; font-size: 40px; font-weight: bold; cursor: pointer; z-index: 2001; }

/* --- FORMACIÓN ACADÉMICA (ESTILO) --- */
.training-col { text-align: center; padding: 20px; }
.training-col h3 { margin-bottom: 15px; }
.btn-outline { display: inline-block; margin-top: 20px; padding: 10px 25px; border: 1px solid var(--accent-color); color: var(--accent-color); font-size: 0.9rem; letter-spacing: 1px; transition: 0.3s; }
.btn-outline:hover { background-color: var(--accent-color); color: var(--white); cursor: pointer; }

/* --- CONTACTO --- */
#contact { background-color: var(--white); }
form { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; max-width: 800px; margin: 0 auto; }
.full-width { grid-column: span 2; }
.form-group { position: relative; }

/* Input Styles */
input, select, textarea { width: 100%; padding: 15px 0; border: none; border-bottom: 1px solid #ddd; background: transparent; font-family: 'Lato', sans-serif; font-size: 1rem; outline: none; transition: 0.3s; }
input:focus, select:focus, textarea:focus { border-bottom-color: var(--accent-color); }

label { font-size: 0.85rem; color: #888; text-transform: uppercase; letter-spacing: 1px; }
button[type="submit"] { background-color: var(--accent-color); color: var(--white); border: none; padding: 15px 40px; font-family: 'Lato', sans-serif; text-transform: uppercase; letter-spacing: 2px; cursor: pointer; justify-self: center; grid-column: span 2; transition: 0.3s; }
button[type="submit"]:hover { background-color: var(--gold-color); }

/* --- NEWSLETTER --- */
#newsletter { background-color: var(--accent-color); color: var(--white); padding: 60px 0; text-align: center; }
#newsletter h3 { color: var(--white); font-family: 'Garamond', serif; font-size: 2rem; margin-bottom: 10px; }
#newsletter p { color: #ccc; margin-bottom: 30px; font-size: 1rem; }
.newsletter-form { display: flex; justify-content: center; gap: 10px; max-width: 500px; margin: 0 auto; }
.newsletter-form input { border: none; border-bottom: 1px solid #fff; color: #fff; padding: 10px; width: 70%; background: transparent; outline: none; }
.newsletter-form input::placeholder { color: #aaa; }
.newsletter-form button { background-color: var(--gold-color); color: #fff; border: none; padding: 10px 25px; text-transform: uppercase; letter-spacing: 1px; cursor: pointer; font-size: 0.85rem; transition: 0.3s; }
.newsletter-form button:hover { background-color: #fff; color: var(--accent-color); }

/* --- REDES SOCIALES --- */
.social-container { grid-column: span 2; text-align: center; margin-top: 40px; padding-top: 30px; border-top: 1px solid #eee; }
.social-title { font-size: 0.9rem; color: #888; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 20px; display: block; }
.social-icons { display: flex; justify-content: center; gap: 30px; }
.social-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; color: var(--accent-color); transition: 0.3s; }
.social-icon svg { width: 30px !important; height: 30px !important; fill: currentColor; }
.social-icon:hover { color: var(--gold-color); transform: scale(1.1); }

/* --- FOOTER --- */
footer { background-color: #151e26; color: #aaa; text-align: center; padding: 40px 0; font-size: 0.85rem; border-top: 1px solid rgba(255,255,255,0.1); }

/* --- BOTÓN VOLVER ARRIBA --- */
#scrollTopBtn { position: fixed; bottom: 30px; right: 30px; width: 50px; height: 50px; background-color: var(--gold-color); color: var(--white); border: none; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 10px rgba(0,0,0,0.3); opacity: 0; pointer-events: none; transition: all 0.4s ease; z-index: 9999; }
#scrollTopBtn.visible { opacity: 1; pointer-events: all; }
#scrollTopBtn:hover { background-color: var(--accent-color); transform: translateY(-5px); }
#scrollTopBtn svg { width: 24px; height: 24px; fill: currentColor; }

/* --- BOTÓN WHATSAPP --- */
#whatsappBtn { 
    position: fixed; bottom: 30px; left: 30px; width: 60px; height: 60px; 
    background: var(--whatsapp-blue); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.3); z-index: 999; transition: 0.3s; 
}
#whatsappBtn:hover { background-color: var(--gold-color); transform: scale(1.1); }
#whatsappBtn svg { width: 35px; height: 35px; fill: currentColor; }

/* --- RESPONSIVE --- */
@media (max-width: 1024px) { 
    .about-grid, form { grid-template-columns: 1fr; }
    .full-width { grid-column: span 1; }
    .social-container { grid-column: span 1; }
    .hero-content h1 { font-size: 2.5rem; }
    .academy-values { flex-direction: column; gap: 30px; }
    .newsletter-form { flex-direction: column; width: 100%; }
    .newsletter-form input { width: 100%; }
    .hamburger { display: flex; }
    
    .nav-links { 
        position: absolute; 
        top: 100%; 
        left: 0; 
        width: 100%; 
        background-color: var(--white); 
        flex-direction: column; 
        align-items: center; 
        gap: 20px; 
        padding: 0; 
        
        /* ESTADO CERRADO: Oculto visualmente y sin altura */
        max-height: 0; 
        opacity: 0;
        visibility: hidden;
        overflow: hidden; 
        
        /* Transición suave para altura y aparición */
        transition: max-height 0.4s ease-out, opacity 0.4s ease-out, visibility 0.4s; 
        
        border-bottom: none; 
        box-shadow: none;
        margin-top: 0; /* Limpieza de intentos anteriores */
    }

    .nav-links.mobile-menu-open { 
        /* ESTADO ABIERTO: Visible y desplegado */
        max-height: 500px; 
        opacity: 1;
        visibility: visible;
        
        padding: 30px 0; 
        border-bottom: 1px solid #eee; 
        box-shadow: 0 5px 10px rgba(0,0,0,0.05); 
    }
    .nav-links a { color: var(--text-color) !important; } 

    .modal-content { width: 95%; margin: 10% auto; padding: 25px; }
    .modal-gallery { grid-template-columns: 1fr; }
    .modal-img-left { float: none; max-width: 100%; margin-right: 0; }
    .director-img-container { height: 300px; }
    .carousel-btn { display: none; }
    .video-card, .staff-card { width: 85vw; }
    #expandedVideoFrame { width: 95vw; height: 55vw; }
    
    .hero-logo {
        max-width: 120px;
        margin-bottom: 20px;
    }
}