/* ==========================================================================
   VARIABLES DE ENTORNO Y CONFIGURACIÓN BASE
   ========================================================================== */
:root {
    --primary: #1a365d;
    --secondary: #2b6cb0;
    --text: #2d3748;
    --bg: #f7fafc;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --hover-btn: #3182ce;
}

* {
    box-sizing: border-box; /* Asegura que el padding no rompa los anchos */
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
}

/* ==========================================================================
   MENÚ DE NAVEGACIÓN (STICKY & RESPONSIVE)
   ========================================================================== */
nav {
    background-color: var(--primary);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    width: 100%;
}

.nav-container {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap; /* Permite que los botones bajen de línea en móviles */
    padding: 0 10px;
}

/* Enlaces contenedores (como el de descarga) */
.nav-container a {
    display: inline-block;
    text-decoration: none;
}

/* Botones de Navegación */
.nav-btn {
    background: none;
    border: none;
    color: #e2e8f0;
    padding: 16px 20px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease-in-out;
    border-bottom: 3px solid transparent;
    white-space: nowrap; /* Evita que el texto del botón se rompa en dos líneas */
}

.nav-btn:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.08);
}

.nav-btn:focus {
    outline: none;
}

.nav-btn.active {
    color: #ffffff;
    border-bottom: 3px solid #63b3ed;
    background-color: rgba(255, 255, 255, 0.04);
    font-weight: 600;
}

/* ==========================================================================
   CONTENEDOR PRINCIPAL (TARJETA)
   ========================================================================== */
.container {
    max-width: 950px;
    width: 90%; /* Se encoge proporcionalmente en pantallas medianas */
    margin: 40px auto;
    background: var(--card-bg);
    padding: 40px;
    box-shadow: 0 10px 25px rgba(26, 54, 93, 0.25); /* Tu sombra azul perfecta */
    border-radius: 8px;
    min-height: 480px;
}

/* Control de visibilidad interactiva */
.tab-content {
    display: none;
    animation: fadeIn 0.35s ease-out;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   DISEÑO INTERACTIVO DE LA PÁGINA DE INICIO (FLEXBOX RESPONSIVE)
   ========================================================================== */
.home-layout {
    display: flex;
    gap: 40px;
    align-items: center;
    justify-content: space-between;
}

.home-text {
    flex: 1;
}

.home-profile {
    flex: 0 0 220px;
    text-align: center;
}

.home-profile img {
    width: 100%;
    max-width: 200px;
    height: auto;
    aspect-ratio: 4 / 5; /* Mantiene la proporción de aspecto carnet */
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 6px 15px rgba(26, 54, 93, 0.2);
    border: 3px solid #ffffff;
}

header h1 {
    color: var(--primary);
    margin-bottom: 8px;
    font-size: 2.5rem;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 1.25rem;
    color: var(--secondary);
    font-weight: 600;
    margin-bottom: 20px;
    line-height: 1.4;
}

.profile-text {
    text-align: justify;
    font-size: 1.05rem;
}

/* Información de Contacto en Grid Flexible */
.contact-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 25px;
    background: var(--bg);
    padding: 15px;
    border-radius: 6px;
    font-size: 0.95rem;
}

.contact-info a {
    color: var(--secondary);
    text-decoration: none;
    font-weight: 500;
}

.contact-info a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   ESTILOS DE CONTENIDO (EDUCACIÓN, CERTIFICACIONES, EXPERIENCIA)
   ========================================================================== */
h2 {
    color: var(--primary);
    border-bottom: 2px solid var(--secondary);
    padding-bottom: 6px;
    margin-bottom: 20px;
    font-size: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-margin {
    margin-top: 40px;
}

.cv-list {
    padding-left: 20px;
    margin: 15px 0;
}

.cv-list li {
    margin-bottom: 12px;
}

/* Bloques de la sección de Experiencia */
.experience-item {
    margin-bottom: 25px;
    border-left: 3px solid var(--border);
    padding-left: 15px;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-weight: bold;
    color: var(--primary);
    font-size: 1.1rem;
    gap: 15px;
}

.company {
    font-style: italic;
    color: var(--secondary);
    margin-bottom: 8px;
    font-size: 0.95rem;
    font-weight: 500;
}

/* ==========================================================================
   MEDIA QUERIES: ADAPTACIÓN TOTAL PARA DISPOSITIVOS MÓVILES
   ========================================================================== */

/* Tablets y pantallas medianas (Menos de 768px) */
@media (max-width: 768px) {
    .home-layout {
        flex-direction: column-reverse; /* Pone la foto arriba del texto en móviles */
        gap: 25px;
        text-align: center;
    }
    
    .home-profile {
        flex: none;
        width: 180px; /* Centra y reduce ligeramente la foto en móviles */
        margin: 0 auto;
    }
    
    .container {
        padding: 25px;
        margin: 20px auto;
        width: 95%; /* Aprovecha más espacio en los bordes de la pantalla */
    }
    
    header h1 {
        font-size: 2rem; /* Reduce el tamaño del título para que no se desborde */
    }

    .profile-text {
        text-align: left; /* Se lee mejor alineado a la izquierda en pantallas pequeñas */
    }
    
    .item-header {
        flex-direction: column; /* El cargo y la fecha se apilan verticalmente */
        gap: 4px;
    }
}

/* Teléfonos móviles pequeños (Menos de 480px) */
@media (max-width: 480px) {
    .nav-btn {
        padding: 12px 10px; /* Botones del menú más compactos y táctiles */
        font-size: 0.85rem;
        flex: 1 1 45%; /* Los botones se organizan en cuadrícula de dos por fila */
        text-align: center;
    }
    
    .container {
        padding: 15px;
        border-radius: 4px;
    }
    
    h2 {
        font-size: 1.25rem;
    }
}