/* --- ESTILOS BASE Y VARIABLES --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --cream: #f3f1eb;
    --navy: #2b364f;
    --navy70: rgba(43,54,79,.7);
    --navy30: rgba(43,54,79,.3);
    --navy10: rgba(43,54,79,.1);
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: #e2e0d9; /* Fondo lateral monitor 2K */
    color: var(--navy);
    font-family: 'Montserrat', sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    margin: 0;
    display: flex;
    justify-content: center;
}

/* --- ESTRUCTURA PRINCIPAL (LIENZO CENTRADO) --- */
#main {
    background: var(--cream);
    width: 100%;
    max-width: 1400px; /* Tu 80% de ancho aproximado en 2K */
    min-height: 100vh;
    margin: 0 auto;
    box-shadow: 0 0 50px rgba(0,0,0,0.05);
    position: relative;
}

#sidebar {
    position: fixed;
    /* Pegado al borde izquierdo del lienzo centrado, sin salirse de pantalla */
    left: max(0px, calc(50% - 700px));
    top: 0;
    bottom: 0;
    width: 220px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px 32px;
    background: var(--navy);
    z-index: 100;
}

/* --- COMPONENTES DEL SIDEBAR --- */
.sidebar-logo {
    font-size: 22px;
    font-weight: 900;
    letter-spacing: -.01em;
    color: var(--cream);
    text-decoration: none;
    line-height: 1.1;
}

.sidebar-logo span {
    display: block;
    font-size: 10px;
    font-weight: 400;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: rgba(243,241,235,.4);
    margin-top: 6px;
}

.sidebar-photo {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    object-position: top center;
    filter: grayscale(1);
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(243,241,235,.08);
}

nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

nav a {
    display: block;
    padding: 9px 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    text-decoration: none;
    color: rgba(243,241,235,.45);
    border-left: 2px solid transparent;
    transition: color .2s, border-color .2s;
}

nav a:hover, nav a.active {
    color: var(--cream);
    border-left-color: var(--cream);
}

.sidebar-bottom {
    font-size: 10px;
    font-weight: 400;
    letter-spacing: .05em;
    color: rgba(243,241,235,.22);
    line-height: 1.7;
}

/* --- SECCIONES Y CONTENIDO --- */
section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Margen izquierdo de 220px para no solapar con el sidebar */
    padding: 80px 8% 80px calc(220px + 8%);
    border-bottom: 1px solid var(--navy10);
}

section:last-of-type {
    border-bottom: none;
}

.section-content {
    width: 100%;
    max-width: 900px;
}

.label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--navy30);
    margin-bottom: 48px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.label::after {
    content: '';
    flex: 0 0 56px;
    height: 1px;
    background: var(--navy10);
}

/* --- BLOQUE HERO --- */
#hero {
    padding-top: 60px;
    width: 100%;
    align-self: flex-start;
}

.hero-name {
    font-size: clamp(52px, 6vw, 84px);
    font-weight: 900;
    line-height: .96;
    letter-spacing: -.02em;
    margin-bottom: 20px;
}

.hero-title {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--navy70);
    margin-bottom: 36px;
}

.hero-divider {
    width: 48px;
    height: 2px;
    background: var(--navy);
    margin-bottom: 28px;
}

.hero-quote {
    font-size: 15px;
    font-weight: 400;
    line-height: 1.75;
    color: var(--navy70);
    max-width: 520px;
    margin-bottom: 40px;
}

.hero-quote strong { font-weight: 600; color: var(--navy); }

.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
    display: inline-block;
    padding: 13px 24px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    text-decoration: none;
    border: 2px solid var(--navy);
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    transition: background .2s, color .2s;
}

.btn-primary { background: var(--navy); color: var(--cream); }
.btn-primary:hover { background: transparent; color: var(--navy); }
.btn-ghost { background: transparent; color: var(--navy); }
.btn-ghost:hover { background: var(--navy); color: var(--cream); }

/* --- SECCIÓN TRAYECTORIA --- */
#experiencia .content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 72px;
    align-items: start;
}

#experiencia .sobre-body {
    width: 70%; /* Ancho de lectura optimizado para esta sección */
}

.sobre-headline {
    font-size: clamp(28px, 3.5vw, 44px);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -.01em;
}

.sobre-body { display: flex; flex-direction: column; gap: 18px; }
.sobre-body p { font-size: 14px; font-weight: 400; line-height: 1.8; color: var(--navy70); }
.sobre-body strong { font-weight: 600; color: var(--navy); }

.stats {
    display: flex;
    gap: 40px;
    margin-top: 32px;
    padding-top: 32px;
    border-top: 1px solid var(--navy10);
}

.stat-num { font-size: 34px; font-weight: 900; color: var(--navy); display: block; line-height: 1; }
.stat-lbl { font-size: 9px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--navy30); margin-top: 6px; display: block; }

/* --- SECCIÓN PROYECTOS / CERTIFICACIONES --- */
.pgrid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px; /* Crea esa línea divisoria fina entre tarjetas */
}

.project {
    padding: 40px 36px;
    border: 1px solid var(--navy10);
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: background .25s;
}

.project:hover { background: var(--navy10); }

.p-status {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    padding: 4px 9px;
    border: 1px solid currentColor;
    align-self: flex-start;
}

.status-active { color: #4a7c59; border-color: rgba(74,124,89,.35); }
.status-wip { color: var(--navy30); }

.project-title { font-size: 22px; font-weight: 700; line-height: 1.2; color: var(--navy); }
.project-desc { font-size: 13px; font-weight: 400; line-height: 1.7; color: var(--navy70); flex: 1; }

.project-link {
    margin-top: auto;
    padding-top: 18px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--navy30);
    text-decoration: none;
    border-top: 1px solid var(--navy10);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color .2s;
}

.project-link::after { content: '→'; transition: transform .2s; }
.project:hover .project-link { color: var(--navy); }
.project:hover .project-link::after { transform: translateX(5px); }

/* --- SECCIÓN CONTACTO --- */
#contacto {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.contact-inner { max-width: 640px; }
.contact-headline { font-size: clamp(36px, 5vw, 60px); font-weight: 900; line-height: 1.05; letter-spacing: -.02em; margin-bottom: 24px; }
.contact-headline em { font-style: italic; color: var(--navy30); }
.contact-sub { font-size: 14px; font-weight: 400; line-height: 1.75; color: var(--navy70); margin-bottom: 36px; max-width: 480px; }
.contact-links { display: flex; gap: 12px; flex-wrap: wrap; }

/* --- FOOTER --- */
footer {
    padding: 28px 72px;
    border-top: 1px solid var(--navy10);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.footer-copy { font-size: 10px; color: var(--navy30); }
.footer-quote { font-size: 11px; font-style: italic; font-weight: 400; color: var(--navy30); }

/* --- MEDIA QUERIES INTELIGENTES (PC MITAD PANTALLA / MÓVIL) --- */

/* MODO INTERMEDIO: Si encoges la ventana en PC */
@media (min-width: 769px) and (max-width: 1024px) {
    #sidebar {
        width: 180px;
        padding: 30px 20px;
        left: 0; /* Lo pegamos al borde si la ventana es pequeña */
    }
    #main {
        margin-left: 0;
        max-width: 100%;
    }
    section {
        padding-left: calc(180px + 8%);
    }
    .sidebar-photo { width: 60px; height: 60px; }
    #experiencia .content { grid-template-columns: 1fr; gap: 40px; }
}

/* MODO MÓVIL Y TÁCTIL: Barra superior fija con foto + nav */
@media (max-width: 768px), (pointer: coarse) and (max-width: 1024px) {
    body { display: block; background-color: var(--cream); }
    
    #sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: auto;        /* cancela el bottom:0 del desktop */
        width: 100%;
        height: 68px;        /* altura fija — nada puede estirarla */
        max-height: 68px;    /* doble seguro */
        overflow: hidden;    /* si algo desborda, no se ve */
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        padding: 10px 16px;
        gap: 16px;
        z-index: 1000;
    }

    /* Foto cuadrada compacta */
    .sidebar-photo {
        display: block;
        width: 48px;
        height: 48px;
        flex-shrink: 0;
        object-fit: cover;
        object-position: top center;
        border-bottom: none;
        margin-bottom: 0;
    }

    /* Logo y tagline ocultos */
    .sidebar-logo { display: none; }
    .sidebar-bottom { display: none; }

    /* Nav: links en grid de 3 columnas */
    nav {
        flex: 1;
    }
    nav ul {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 2px 0;
        row-gap: 4px;
    }
    nav a {
        font-size: 10px;
        padding: 6px 10px;
        border-left: none;
        white-space: nowrap;
    }
    nav a.active {
        border-left: none;
        color: var(--cream);
    }

    #main { margin-left: 0; padding-top: 68px; max-width: 100%; }
    section { padding: 60px 10%; min-height: auto; }
    .pgrid { grid-template-columns: 1fr; }
    #experiencia .content { grid-template-columns: 1fr; gap: 32px; }
    #experiencia .sobre-body { width: 100%; }
}

/* --- ANIMACIONES REVEAL --- */
.reveal { opacity: 0; transform: translateY(30px); transition: all .8s ease-out; }
.reveal.visible { opacity: 1; transform: translateY(0); }