/* --- 1. VARIABLES --- */
:root {
    --black: #000000;
    --white: #ffffff;
    --gray: #f8f8f8;
    --text-muted: #666666;
    --accent: #0049ff; 
    --transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

/* --- 2. BASES --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--white);
    color: var(--black);
    line-height: 1.6;
    overflow-x: hidden;
}
body.menu-open { overflow: hidden; }
span { color: var(--accent); }
.container { max-width: 1200px; margin: 0 auto; padding: 0 5%; }

/* --- 3. NAVBAR --- */
.navbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 35px 5%; position: fixed; width: 100%; z-index: 1000; 
    transition: background-color 0.5s, backdrop-filter 0.5s, padding 0.5s;
}
.nav-scrolled {
    background: rgba(255, 255, 255, 0.95); padding: 20px 5%; 
    backdrop-filter: blur(15px); border-bottom: 1px solid rgba(0,0,0,0.05);
}
.logo-container { display: flex; align-items: center; gap: 15px; z-index: 1002; position: relative; }
.logo { font-weight: 800; font-size: 1.5rem; text-decoration: none; color: var(--black); letter-spacing: -1px; }
.logo-separator { color: var(--black); opacity: 0.2; font-weight: 300; font-size: 1.2rem; }
.logo-serena { height: 20px; width: auto; transition: filter 0.5s ease; }

.home-page:not(.menu-open) .navbar:not(.nav-scrolled) .logo { color: var(--white); }
.home-page:not(.menu-open) .navbar:not(.nav-scrolled) .logo-separator { color: var(--white); opacity: 0.4; }
.home-page:not(.menu-open) .navbar:not(.nav-scrolled) .logo-serena { filter: brightness(0) invert(1); }
.home-page:not(.menu-open) .navbar:not(.nav-scrolled) .hamburger .line { background-color: var(--white); }

.hamburger { display: block; cursor: pointer; z-index: 1002; position: relative; }
.hamburger .line {
    display: block; width: 30px; height: 3px; margin: 6px auto;
    background-color: var(--black); transition: all 0.3s ease-in-out; border-radius: 2px;
}
.hamburger.active .line:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.hamburger.active .line:nth-child(2) { opacity: 0; }
.hamburger.active .line:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

.nav-links { 
    list-style: none; position: fixed; top: 0; left: 0; 
    width: 100%; height: 100dvh; 
    background-color: var(--white); display: flex; flex-direction: column; 
    justify-content: center; align-items: center; gap: 20px; z-index: 1001;
    opacity: 0; visibility: hidden; transform: translateY(-20px);
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}
.nav-links.active { opacity: 1; visibility: visible; transform: translateY(0); }
.nav-links a { text-decoration: none; color: var(--black); font-size: clamp(2.5rem, 7vw, 5rem); font-weight: 800; text-transform: uppercase; letter-spacing: -2px; }
.nav-links a:hover { color: var(--accent); }

/* --- 4. HERO --- */
.hero { height: 100vh; display: flex; align-items: center; justify-content: center; background: #000; position: relative; overflow: hidden; }
.video-bg { position: absolute; width: 100%; height: 100%; object-fit: cover; opacity: 0.8; }
.hero-content { position: relative; text-align: center; color: var(--white); z-index: 2; }
.hero-content h1 { font-size: clamp(2.2rem, 8vw, 5.5rem); font-weight: 800; line-height: 1; letter-spacing: -3px; }

/* --- 5. SECCIONES DE PROYECTOS --- */
.featured-section { padding: 120px 0; }
.section-title { font-size: 3.5rem; font-weight: 800; letter-spacing: -2px; margin-bottom: 80px; text-align: center; }
.projects-container { display: flex; flex-direction: column; gap: 140px; }

/* Grid de escritorio */
.project-card { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 60px; align-items: center; }
.project-card.alternate { grid-template-columns: 0.8fr 1.2fr; }
.project-card.alternate .project-image { order: 2; } /* Esto mueve el video a la derecha en PC */

.project-image { overflow: hidden; height: 400px; background: #f0f0f0; }
.project-image video { width: 100%; height: 100%; object-fit: cover; transition: var(--transition); }
.project-card:hover .project-image video { transform: scale(1.05); }
.project-number { font-size: 0.8rem; font-weight: 800; color: #ddd; display: block; margin-bottom: 15px; }
.project-title { font-size: clamp(2rem, 4vw, 3.5rem); font-weight: 800; letter-spacing: -2px; line-height: 0.9; margin-bottom: 20px; }
.project-description { color: var(--text-muted); font-size: 1.1rem; max-width: 480px; }

/* --- 6. QUIÉNES SOMOS --- */
.about-section { background: var(--gray); padding: 140px 0; text-align: center; }
.about-text { max-width: 850px; margin: 0 auto; }
.about-text-details p { font-size: 1.25rem; color: var(--black); margin-bottom: 25px; line-height: 1.6; }
.about-slogan { font-weight: 800; font-size: 1.5rem; color: var(--black); letter-spacing: -1px; }

/* --- 7. CLIENTES --- */
.clients-section { padding: 120px 0; text-align: center; }
.clients-wrapper { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 60px; align-items: center; justify-items: center; max-width: 1100px; margin: 80px auto 0; }
.client-brand { max-width: 120px; max-height: 50px; filter: grayscale(100%); opacity: 0.4; transition: 0.4s ease; }
.client-brand:hover { filter: grayscale(0%); opacity: 1; transform: scale(1.05); }

/* --- 8. CONTACTO --- */
.simple-contact { padding: 100px 0 150px; text-align: center; }
.contact-mail-link { 
    font-size: 1.25rem; 
    font-weight: 400; 
    color: var(--black); 
    text-decoration: none; 
    letter-spacing: 0.5px;
    transition: var(--transition);
    display: inline-block;
}
.contact-mail-link:hover { color: var(--accent); transform: translateY(-2px); }

/* --- 9. FOOTER --- */
footer { padding: 100px 5% 60px; text-align: center; background: #fff; border-top: 1px solid #f0f0f0; }
.footer-logos { display: flex; justify-content: center; align-items: center; gap: 20px; margin-bottom: 40px; }
.footer-logo { font-weight: 800; font-size: 1.4rem; color: var(--black); text-decoration: none; }
.footer-logo-serena { height: 22px; filter: brightness(0); }
.copyright { font-size: 0.75rem; opacity: 0.4; }

/* --- 10. RESPONSIVE (CORREGIDO) --- */
@media (max-width: 992px) {
    /* Forzamos una sola columna */
    .project-card, .project-card.alternate { 
        grid-template-columns: 1fr; 
        gap: 30px; 
    }

    /* EL TRUCO: Anulamos el orden invertido para que en móvil todos sean VIDEO ARRIBA / TEXTO ABAJO */
    .project-card.alternate .project-image { 
        order: 0; 
    }

    .project-image { height: 300px; }
    .project-description { max-width: 100%; }
    
    .section-title { font-size: 2.5rem; margin-bottom: 40px; }
    .projects-container { gap: 80px; }

    .clients-wrapper { grid-template-columns: repeat(3, 1fr); gap: 40px; }
}

@media (max-width: 600px) {
    .clients-wrapper { grid-template-columns: repeat(2, 1fr); }
    .logo-serena { height: 16px; }
}