@import url('https://fonts.googleapis.com/css2?family=Imbue:opsz,wght@10..100,500&family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap');

/* --- 1. Variables & Configuración Global --- */
:root {
    --padding-dinamico: max(72px, (100vw - 1440px) / 2);
    
    /* Paleta de Colores */
    --blanco: #D9D9D9;
    --blanco-parrafos: rgba(217, 217, 217, 0.84);
    --beige: #ADAD96;
    --azul-claro: #6D8186;
    --azul-medio: #2F383E;
    --azul-oscuro: #232A2E;
    --verde-claro: #728059;
    --verde-oscuro: #333C2C;
}

html { scroll-behavior: smooth; }

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Open Sans', sans-serif;
    color: var(--blanco);
    background-color: var(--azul-oscuro);
}

/* --- 2. Tipografía --- */
h1, h2 {
    font-family: 'Imbue', serif;
    font-weight: 500;
    line-height: 100%;
    margin-bottom: 32px;
}

h1 { font-size: 128px; }
h2 { font-size: 88px; color: var(--beige); }

p {
    font-size: 20px;
    line-height: 150%;
    color: var(--blanco-parrafos);
}

/* --- 3. Navegación (Header & Nav) --- */
header nav {
    position: fixed;
    inset: 0 0 auto 0; /* Sustituye top, left, right */
    z-index: 9999;
    height: 72px;
    padding: 0 var(--padding-dinamico);    
    background-color: rgba(35, 42, 46, 0.8);
    background-color: color-mix(in srgb, var(--azul-oscuro) 80%, transparent);
    backdrop-filter: blur(60px);
    -webkit-backdrop-filter: blur(60px);
    
    display: flex;
    justify-content: space-between;
    align-items: center;

    ul {
        display: flex;
        list-style: none;
        gap: 40px;
        align-items: center;

        li a {
            font-size: 16px;
            font-weight: 500;
            text-decoration: none;
            color: var(--blanco);
            transition: opacity 0.2s ease;

            &:hover { opacity: 0.8; }

            /* Estilos específicos para el botón del CV */
            &.btn-descarga {
                background-color: var(--beige);
                color: var(--verde-oscuro);
                padding: 12px 24px;
                
                &:hover { opacity: 0.9; }
            }
        }
    }
}

/* Botón Hamburguesa (Oculto en Desktop) */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;

    img {
        width: 32px;
        height: 32px;
        filter: invert(100%);
    }
}

/* --- 4. Layouts Base --- */
section {
    min-height: 960px;
    padding: 80px var(--padding-dinamico);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Estructura para secciones de 2 columnas (Texto / Imagen) */
.flex-row-section {
    flex-direction: row;
    align-items: center;
    gap: 64px;
    overflow: hidden;

    .contenido-texto, 
    .contenedor-imagen, 
    .bloque-invisible {
        flex: 1;
        position: relative;
    }

    .contenedor-imagen {
        img {
            width: 100%;
            height: auto;
            max-height: 600px;
            object-fit: cover;
            display: block;
            position: relative;
            z-index: 2;
        }

        /* Bloques de color decorativos detrás de las imágenes */
        &::before {
            content: "";
            position: absolute;
            z-index: 1;
        }
    }
}

/* --- 5. Secciones Específicas --- */
#hero {
    text-align: center;
    background: var(--azul-oscuro) url('Recursos/hero-bg.webp') center/cover no-repeat;
    
    p { font-size: 24px; }
}

#quien-soy {
    background-color: var(--azul-medio);
    
    .contenedor-imagen::before {
        background-color: var(--beige);
        inset: -500px -32px -32px -32px;
    }
}

#mis-intereses {
    background-color: var(--azul-oscuro);
    
    .contenedor-imagen::before {
        background-color: var(--azul-claro);
        inset: -32px -32px -32px calc(var(--padding-dinamico) * -1);
    }
}

#vida-profesional {
    background-color: var(--azul-medio);
    
    .contenedor-imagen::before {
        background-color: var(--beige);
        inset: -32px -32px -500px -32px;
    }
    
    .contenido-texto {
        display: flex;
        flex-direction: column;
    }
}

/* Sub-componente: Grid de Habilidades y Software */
.stack-habilidades {
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    gap: 32px;

    h3 {
        font-size: 28px;
        font-weight: 500;
        line-height: 150%;
        color: var(--blanco);
        margin: 0;
    }

    .grid-iconos {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 32px;

        .icono-item {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 8px;

            img {
                width: 64px;
                height: 64px;
                object-fit: contain;
            }

            span {
                font-size: 16px;
                color: var(--blanco-parrafos);
            }
        }
    }
}

#mis-gustos {
    background-color: var(--verde-oscuro);

    .encabezado-gustos {
        margin-bottom: 64px;
    }

    /* Contenedor principal de las 4 tarjetas */
    .contenedor-tarjetas {
        display: flex;
        border: 1px solid var(--verde-claro);
        overflow: hidden;
        gap: 32px;

        .tarjeta {
            flex: 1;
            padding: 24px;
            height: 465px;
            border-right: 1px solid var(--verde-claro);
            border-left: 1px solid var(--verde-claro);
            display: flex;
            flex-direction: column;

            /* Eliminar bordes laterales en los extremos */
            &:last-child { border-right: none; }
            &:first-child { border-left: none; }

            img {
                width: 100%;
                aspect-ratio: 1/1;
                object-fit: cover;
                margin-bottom: 24px;
                background-color: var(--verde-claro);
            }

            h3 {
                font-size: 28px;
                font-weight: 500;
                margin-bottom: 8px;
            }
        }
    }
}

#mis-objetivos {
    background-color: var(--beige);
    position: relative;

    h2 { color: var(--verde-oscuro); }
    p { color: rgba(35, 42, 46, 0.84); }

    img {
        position: absolute;
        inset: 0 0 auto auto; /* Top right */
        width: 50%;
        height: 100%;
        object-fit: cover;
        z-index: 1;
    }
}

/* --- 6. Footer --- */
footer {
    height: 72px;
    background-color: var(--azul-medio);
    display: flex;
    justify-content: center;
    align-items: center;
}


/* --- 7. Responsive Design --- */

/* Tablets / Nav Breakpoint */
@media (max-width: 1024px) {
    header nav {
        padding: 0 24px;

        /* Activación del menú de hamburguesa */
        .menu-toggle {
            display: block;
            z-index: 10001;
        }

        /* Transformar la lista en un menú desplegable a pantalla completa */
        ul {
            position: fixed;
            inset: 0 -100% 0 auto; 
            width: 100%;
            height: 100vh;
            background-color: var(--azul-oscuro);
            flex-direction: column;
            justify-content: center;
            transition: right 0.3s ease-in-out;
            z-index: 10000;
            gap: 32px;

            &.menu-abierto { right: 0; }
            li a { font-size: 24px; }
        }
    }
}

/* Mobile Breakpoint */
@media (max-width: 860px) {
    
    /* Escala tipográfica */
    h1 { font-size: 56px; }
    h2 { font-size: 40px; }
    p { font-size: 18px; }

    section {
        padding: 64px 24px;
        min-height: auto;
    }

    #hero {
        min-height: 100dvh;
        p { font-size: 18px; }
    }

    /* Colapsado a 1 columna */
    .flex-row-section {
        flex-direction: column;
        gap: 40px;

        /* Ocultar bloques decorativos para evitar desbordes visuales */
        .contenedor-imagen::before { display: none; }
    }

    /* Invertir orden texto-imagen para mejor lectura móvil */
    #quien-soy, #vida-profesional {
        flex-direction: column-reverse;
    }

    .stack-habilidades {
        h3 { font-size: 24px; }
        .grid-iconos { grid-template-columns: repeat(2, 1fr); gap: 24px; }
    }

    #mis-gustos {
        .encabezado-gustos { margin-bottom: 40px; }
        
        .contenedor-tarjetas {
            flex-direction: column;
            border: none;
            gap: 24px;

            .tarjeta {
                border: 1px solid var(--verde-claro) !important;
                height: auto;
            }
        }
    }

    /* Extender imagen a los bordes de la pantalla y anular paddings */
    #mis-objetivos {
        img {
            position: static;
            width: calc(100% + 48px);
            margin-bottom: -64px;
            margin-top: 32px;
            display: block;
        }
        .bloque-invisible { display: none; }
    }
}