/* --- PALETA DE COLORES Y FUENTES --- */
:root {
    --color-dark: #001D3F;
    --color-main: #006838;
    --color-gray: #000000;
    --color-gray1: #58595B;
    --color-light: #FFFFFF;
    
    --font-primary: 'Poppins', sans-serif;
    --font-secondary: 'Montserrat', sans-serif;
}

/* --- RESET Y ESTILOS GLOBALES (MOBILE-FIRST) --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-secondary);
    font-weight: 400;
    background-color: var(--color-light);
    color: var(--color-gray1);
}

a {
    text-decoration: none;
    color: var(--color-main);
    transition: color 0.3s ease;
}

a:hover {
    color: var(--color-dark);
}

p {
    font-size: 1em;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-primary);
    font-weight: 700;
    color: var(--color-dark);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

.list-inline li {
    display: inline-block;
    list-style-type: none;
}

.bg-image {
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
}

/* --- CLASES DE UTILIDAD --- */
.section {
    padding: 60px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 40px;
}

.section .short {
    color: var(--color-main);
    text-transform: uppercase;
    font-size: 0.9em;
    font-weight: 600;
    margin-bottom: 8px;
}

.section .title {
    font-size: 2em;
    margin-bottom: 16px;
}

.section .desc {
    max-width: 700px;
    margin: 0 auto 40px;
    font-size: 1em;
}

/* --- ANIMACIONES DE SCROLL --- */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- HEADER Y NAVEGACIÓN --- */
header {
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1000;
    background-color: transparent;
    transition: background-color 0.4s ease, box-shadow 0.4s ease;
    padding: 10px 0;
}

header.sticky {
    background-color: var(--color-dark);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
}

.grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo img {
    max-width: 150px;
    transition: max-width 0.3s ease;
}

header.sticky .logo img {
    max-width: 130px;
}

/* Menú Móvil */
.btn-menu-toggle {
    display: block;
    background: none;
    border: none;
    color: var(--color-light);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1001;
}

.menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--color-dark);
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.menu.show {
    max-height: 500px; /* Suficientemente grande para el contenido */
}

.menu li {
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.menu li a {
    display: block;
    padding: 18px;
    color: var(--color-light);
    font-size: 0.9em;
    text-transform: uppercase;
    font-weight: 600;
}
.menu li a:hover {
    background-color: var(--color-main);
}

/* --- INTRO --- */
#intro {
    background-image: url(../img/bg-top.png);
    padding: 140px 0 60px;
    text-align: center;
    color: var(--color-dark);
}

#intro .grid {
    display: grid;
    gap: 40px;
    align-items: center;
}

.intro-desc h1 {
    font-size: 2.2em;
    line-height: 1.2;
}
.intro-desc h3 {
    color: var(--color-main);
    font-size: 1em;
}

/* --- HOW TO WORK --- */
#howto .grid {
    display: grid;
    gap: 30px;
    align-items: center;
}
.functions-image {
    order: -1; /* Mueve la imagen arriba en móvil */
    margin-bottom: 30px;
}
.functions li {
    list-style: none;
    text-align: center;
    margin-bottom: 30px;
}
.functions li i {
    font-size: 2.5em;
    color: var(--color-main);
    margin-bottom: 15px;
}
.functions li h3 {
    margin-bottom: 10px;
}

/* --- VIDEO DEMO --- */
.bg-video {
    background-image: url(../img/bg-video.jpg);
    background-attachment: fixed;
}
#demo {
    text-align: center;
}
#demo .title, #demo .desc {
    color: var(--color-light);
}
#demo .btn-play i {
    font-size: 5em;
    color: var(--color-light);
    transition: transform 0.3s ease;
}
#demo .btn-play:hover i {
    transform: scale(1.1);
}

/* --- REVIEWS --- */
#reviews .grid {
    display: grid;
    gap: 30px;
}
.review {
    text-align: center;
}
.review img {
    max-width: 150px;
    border-radius: 50%;
    margin: 0 auto 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.review blockquote {
    font-style: italic;
    margin: 15px 0;
}

/* --- CONTACT --- */
#contact {
    position: relative;
    padding: 0;
    background-color: var(--color-dark);
}
.bg-contact {
    background-image: url(../img/bg-contact.jpg);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 300px;
    opacity: 0.3;
}
.section-contact {
    position: relative;
    z-index: 2;
    padding: 60px 20px;
    text-align: center;
    color: var(--color-light);
}
.section-contact h2 {
    color: var(--color-light);
}
.section-contact p {
    margin-bottom: 15px;
}

/* --- FOOTER --- */
footer {
    padding: 40px 0;
    background-color: #f8f9fa;
    text-align: center;
}
ul.social a {
    font-size: 1.8em;
    margin: 0 10px;
    color: var(--color-gray1);
}
ul.social {
    margin-bottom: 20px;
}
footer p {
    font-size: 0.9em;
}

/* --- MEDIA QUERIES PARA TABLETS Y DESKTOP --- */
@media (min-width: 768px) {
    /* --- ESTRUCTURA --- */
    .section { padding: 80px 0; }
    .section .title { font-size: 2.5em; }
    
    .grid2 { grid-template-columns: repeat(2, 1fr); }
    .grid3 { grid-template-columns: repeat(3, 1fr); }

    /* --- HEADER --- */
    .btn-menu-toggle { display: none; }
    .menu {
        position: static;
        display: block;
        max-height: none;
        width: auto;
        background-color: transparent;
        overflow: visible;
    }
    .menu li {
        display: inline-block;
        border-bottom: none;
        margin-left: 10px;
    }
    .menu li a {
        padding: 10px 15px;
        font-weight: 600;
        font-size: 0.85em;
        transition: color 0.3s ease;
    }
    .menu li a:hover {
        background-color: transparent;
        color: var(--color-main);
    }
    header.sticky .menu li a {
        color: var(--color-light);
    }
     header.sticky .menu li a:hover {
        color: var(--color-main);
    }

    /* --- INTRO --- */
    #intro { text-align: left; }
    #intro .grid { align-items: center; grid-template-columns: 1fr 1fr; }
    .intro-desc h1 { font-size: 2.8em; }

    /* --- HOW TO WORK --- */
    #howto .grid {
        grid-template-columns: 1fr 300px 1fr;
        gap: 20px;
    }
    .functions-image { order: 0; } /* Resetea el orden */
    .col-left li { text-align: right; }
    .functions li { text-align: left; }

    /* --- CONTACTO ANIMADO (VERSIÓN CORREGIDA) --- */
    #contact.bg-white {
        background-color: var(--color-dark);
        padding-top: 60px;
        padding-bottom: 60px;
    }

    #contact .grid2 {
        /* Por defecto (móvil): apilado en una columna */
        display: grid;
        grid-template-columns: 1fr;
        gap: 30px;
        align-items: center;
    }

    .contact-animation {
        width: 100%;
        height: 300px; /* Altura fija para la animación en vista móvil */
    }

    #contactCanvas {
        display: block;
        width: 100%;
        height: 100%;
    }

    .section-contact {
        text-align: center; /* Texto centrado en móvil */
    }

    .color-dark { color: var(--color-dark); }
    .color-gray1 { color: var(--color-gray1); }


    /* --- VISTA DESKTOP (pantallas de 768px o más) --- */
    @media (min-width: 768px) {
        #contact .grid2 {
            /* En desktop: dos columnas iguales */
            grid-template-columns: repeat(2, 1fr);
        }

        .contact-animation {
            /* La animación ocupa toda la altura de su celda en el grid */
            position: relative;
            width: 100%;
            height: 400px; /* Ajusta la altura según necesites */
            margin-bottom: 30px;
        }

        .section-contact {
            text-align: left; /* Texto alineado a la izquierda en desktop */
            padding: 40px;
            background-color: rgba(255, 255, 255, 0.8);
            position: relative; /* Asegura que esté por encima de la animación */
            z-index: 2;
        }
    }
}