/* 
  Reset y configuración base
*/
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden; 
    font-family: 'Montserrat', sans-serif;
    background-color: #f5f5f5;
    animation: bodyDarken 3s ease-in-out 6.5s forwards;
}

@keyframes bodyDarken {
    100% { background-color: #d1d1d1; } /* Gris más oscuro para resaltar logos */
}

.hero-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('unnamed.jpg');
    background-size: cover;
    background-position: center bottom;
    background-repeat: no-repeat;
    opacity: 0;
    transform: scale(1.1);
    animation: 
        fadeZoomOut 3s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards,
        bgFadeToTranslucent 3s ease-in-out 6.5s forwards; 
    z-index: 1;
}

.content-overlay {
    position: relative;
    z-index: 2;
    margin-top: 5vh;
    text-align: center;
    width: 100%;
    padding: 0 20px;
    opacity: 0;
    animation: fadeSlideDown 1.5s ease-out 1s forwards; 
}

.welcome-text {
    color: #6C4424; 
    font-weight: 800;
    font-size: clamp(1.8rem, 4vw, 3.5rem);
    letter-spacing: 1px;
    text-shadow: 0px 2px 10px rgba(255, 255, 255, 0.8), 0px 1px 3px rgba(255, 255, 255, 0.5);
}

@keyframes fadeZoomOut {
    0% { opacity: 0; transform: scale(1.15); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes bgFadeToTranslucent {
    100% { opacity: 0.50; }
}

@keyframes fadeSlideDown {
    0% { opacity: 0; transform: translateY(-100px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* 
   ARQUITECTURA DE GRID RÍGIDA - FIDELIDAD ABSOLUTA CAPTURA 2
*/
.animation-grid {
    position: absolute;
    top: 22vh;
    left: 2vw; /* Reducido para que los logos toquen más los bordes */
    right: 2vw;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 120px;
    z-index: 5;
}

.grid-column {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
}

/* Alineaciones Geo-exactas */
.grid-column.left { justify-content: flex-start; }
.grid-column.center { justify-content: center; }
.grid-column.right { justify-content: flex-end; }

.sub-text {
    position: absolute;
    color: #6C4424;
    font-size: clamp(1rem, 2.2vw, 1.6rem);
    font-weight: 700;
    opacity: 0;
    text-shadow: 0px 1px 10px rgba(255, 255, 255, 0.9);
    animation: textSequence 3.5s ease-in-out forwards;
    white-space: nowrap;
    pointer-events: none; /* Evita bloquear el hover de los logos */
}

.grid-column.left .sub-text { animation-delay: 2.5s; left: 0; width: clamp(240px, 32vw, 440px); text-align: center; }
.grid-column.center .sub-text { animation-delay: 2.8s; }
.grid-column.right .sub-text { animation-delay: 3.1s; }

/* Estilos de Interactividad Unificados */
.logo-link {
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    position: relative;
    z-index: 20;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.logo-link:hover { 
    transform: scale(1.1) translateY(20px); 
    z-index: 1000; /* Asegurar que el logo y sus tooltips estén encima */
}

.logo-link:hover .sequence-logo {
    filter: drop-shadow(0 15px 40px rgba(0,0,0,0.3));
}

.logo-link.no-link {
    cursor: default;
}

/* Tooltip 'Visitar Web' (Solo para logos con link) */
.custom-tooltip.top {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background-color: rgba(108, 68, 36, 0.9);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 1000;
}

.logo-link:hover .custom-tooltip.top {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* COMPORTAMIENTO DINÁMICO HOVER (SLOGAN + LOGO) */
.grid-column:hover .sub-text {
    opacity: 1 !important;
    transform: translateY(160px) !important; /* Aparece debajo del logo */
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.grid-column:hover .logo-link {
    transform: scale(1.1) translateY(20px); /* El logo baja un poco para no pisar el texto */
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

/* El logo de Investments no baja tanto porque el slogan es más largo */
.grid-column.right:hover .logo-link {
    transform: scale(1.1) translateY(30px);
}

/* IMÁGENES DE LOGO (ANIMACIONES Y TAMAÑOS) */
.sequence-logo {
    height: auto;
    opacity: 0;
    animation-duration: 1.5s;
    animation-fill-mode: forwards;
    transition: filter 0.4s ease;
}

/* Logo 1: Izquierda (Renovables) */
.grid-column.left .logo-link {
    top: -45px;
    width: clamp(240px, 32vw, 440px);
}
.grid-column.left .sequence-logo {
    width: 100%;
    animation: logoSlideFromLeft 1.5s ease-out 6.5s forwards;
}

/* Logo 2: Centro (Comercialización) */
.grid-column.center .logo-link {
    top: 0;
    width: clamp(240px, 32vw, 440px);
}
.grid-column.center .sequence-logo {
    width: 100%;
    animation: logoFadeIn 1.5s ease-out 6.8s forwards;
}

/* Logo 3: Derecha (Investments) */
.grid-column.right .logo-link {
    top: -15px;
    right: 40px; 
    width: clamp(200px, 26vw, 360px);
}
.grid-column.right .sequence-logo {
    width: 100%;
    animation: logoSlideFromRight 1.5s ease-out 7.1s forwards;
}

/* Keyframes de la Secuencia */
@keyframes textSequence {
    0% { opacity: 0; transform: translateY(10px); }
    15% { opacity: 1; transform: translateY(0); }
    85% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-10px); }
}

@keyframes logoFadeIn {
    0% { opacity: 0; transform: scale(0.85); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes logoSlideFromLeft {
    0% { opacity: 0; transform: translateX(-400px); } /* Entrada desde más lejos */
    100% { opacity: 1; transform: translateX(0); }
}

@keyframes logoSlideFromRight {
    0% { opacity: 0; transform: translateX(400px); } /* Entrada desde más lejos */
    100% { opacity: 1; transform: translateX(0); }
}

/* Fase Final: Logo Inferior */
.final-logo-container {
    position: absolute;
    bottom: 5vh;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    display: flex;
    justify-content: center;
    z-index: 10;
    pointer-events: none;
}

.final-center-logo {
    width: clamp(280px, 35vw, 550px);
    opacity: 0;
    animation: finalLogoAppear 2.5s cubic-bezier(0.23, 1, 0.32, 1) 8.5s forwards;
}

@keyframes finalLogoAppear {
    0% { opacity: 0; transform: scale(0.9) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}
