/* --- Variables & Reset --- */
:root {
    /* Paleta de colores profesional */
    --primary-color: #2563EB;
    /* Azul vibrante */
    --primary-dark: #1E40AF;
    --secondary-color: #0F172A;
    /* Azul noche / Negro suave */
    --text-color: #334155;
    --text-light: #64748B;
    --bg-color: #F8FAFC;
    --white: #FFFFFF;
    --accent: #F59E0B;
    /* Toque sutil */

    /* Espaciado y estructura */
    --header-height: 4.5rem;
    --border-radius: 12px;
    --container-width: 1024px;

    /* Fuentes */
    --font-main: 'Inter', sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

ul {
    list-style: none;
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.3s;
}

/* --- Layout Utilities --- */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.section {
    padding: 5rem 0;
}

.section-title {
    font-size: 2rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
    text-align: center;
    font-weight: 700;
}

.section-subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 3rem;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
    border: 2px solid var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-outline {
    background-color: transparent;
    color: var(--secondary-color);
    border: 2px solid var(--secondary-color);
}

.btn-outline:hover {
    background-color: var(--secondary-color);
    color: var(--white);
    transform: translateY(-2px);
}

.full-width {
    width: 100%;
    justify-content: center;
}

/* --- Header & Nav --- */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 100;
    box-shadow: 0 1px 10px rgba(0, 0, 0, 0.05);
    height: var(--header-height);
    display: flex;
    align-items: center;
}

.nav-container {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.logo span {
    color: var(--primary-color);
}

/* Menú en desktop */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-list {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-color);
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

.nav-link.button-link {
    background-color: var(--secondary-color);
    color: var(--white);
    padding: 0.5rem 1rem;
    border-radius: 6px;
}

.nav-link.button-link:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

/* Selector de idioma */
.lang-switcher {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.lang-btn {
    border: 1px solid #e2e8f0;
    background-color: #f8fafc;
    color: var(--secondary-color);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

.lang-btn--active,
.lang-btn:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
}

/* Botones de menú mobile (desktop oculto) */
.nav-toggle,
.nav-close {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--secondary-color);
}

/* --- Hero Section --- */
.hero {
    padding-top: calc(var(--header-height) + 4rem);
    padding-bottom: 4rem;
    background: linear-gradient(135deg, #f0f4ff 0%, #ffffff 100%);
}

.hero-container {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 3rem;
    align-items: center;
}

.hero-badge {
    background-color: #DBEAFE;
    color: var(--primary-dark);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 1rem;
}

.hero-title {
    font-size: 3rem;
    line-height: 1.2;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.hero-description {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 2rem;
    max-width: 500px;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
}

.hero-image-wrapper {
    display: flex;
    justify-content: center;
}

.hero-img {
    width: 300px;
    height: 300px;
    object-fit: cover;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    box-shadow: 0 20px 40px rgba(37, 99, 235, 0.15);
    background-color: #e2e8f0;
    transition: border-radius 0.5s ease;
}

.hero-img:hover {
    border-radius: 50%;
}

/* --- About Section --- */
.about {
    background-color: var(--white);
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.about-text p {
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
}

.about-stats {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    margin-top: 3rem;

    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 1.5rem;

    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1 1 180px;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
}

/* --- Skills Section --- */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.skill-card {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    border: 1px solid #e2e8f0;
    transition: transform 0.3s;
}

.skill-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
}

.skill-icon {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.skill-card h3 {
    margin-bottom: 1.5rem;
    color: var(--secondary-color);
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.skill-tags span {
    background-color: #eff6ff;
    color: var(--primary-dark);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* --- Experience (Timeline) --- */
.experience {
    background-color: #f1f5f9;
}

.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

/* Línea vertical */
.timeline::after {
    content: '';
    position: absolute;
    width: 2px;
    background-color: #cbd5e1;
    top: 0;
    bottom: 0;
    left: 20px;
    /* Ajuste para móvil por defecto */
}

.timeline-item {
    position: relative;
    padding-left: 50px;
    margin-bottom: 3rem;
}

.timeline-dot {
    position: absolute;
    width: 16px;
    height: 16px;
    background-color: var(--primary-color);
    border: 3px solid #fff;
    border-radius: 50%;
    left: 13px;
    top: 5px;
    z-index: 2;
}

.timeline-date {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.timeline-content {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.timeline-content h3 {
    color: var(--secondary-color);
    margin-bottom: 0.2rem;
}

.timeline-content h4 {
    color: var(--primary-color);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.timeline-content ul {
    list-style: disc;
    padding-left: 1.2rem;
    margin-top: 0.8rem;
    color: var(--text-color);
}

/* --- Projects Section --- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.project-card {
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    transition: 0.3s;
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.project-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.project-type {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.project-content h3 {
    margin-bottom: 0.8rem;
    color: var(--secondary-color);
}

.project-content p {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.project-tech {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: auto;
}

.project-tech span {
    font-size: 0.75rem;
    background-color: #f1f5f9;
    color: var(--text-color);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
}

.projects-subtitle {
    margin-top: 2.5rem;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--secondary-color);
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.projects-subtitle::before {
    content: '';
    width: 32px;
    height: 2px;
    border-radius: 999px;
    background: var(--primary-color);
}

/* Contenedor de enlaces dentro de cada proyecto */
.project-links {
    margin-top: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

/* Botón/enlace de proyecto tipo "chip" */
.project-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background-color: #f8fafc;
    color: var(--secondary-color);
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.project-link i {
    font-size: 1rem;
}

/* Hover general */
.project-link:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
    transform: translateY(-1px);
}

/* Variante ghost (para el segundo botón, por ejemplo iOS) */
.project-link--ghost {
    background-color: transparent;
    border-style: dashed;
}

.project-link--ghost:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

/* Ajuste responsivo para que no reviente en móviles */
@media screen and (max-width: 480px) {
    .project-links {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .project-link {
        white-space: normal;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .hero-buttons .btn {
        width: 100%;
        justify-content: center;
    }
}

.section.projects {
    padding-bottom: 3rem;
}

.section.contact {
    padding-top: 2.5rem;
    padding-bottom: 4rem;
}

/* --- Contact Section --- */
.contact-container {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

/* Grid de 2 columnas para los datos de contacto (desktop) */
.contact-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem 2rem;
}

.contact-info h2 {
    text-align: left;
    margin-bottom: 1rem;
}

.contact-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.contact-item i {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-top: 3px;
}

.contact-item span {
    display: block;
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 600;
}

.contact-item a,
.contact-item p {
    font-size: 1.05rem;
    color: var(--secondary-color);
    font-weight: 500;
}

.contact-form {
    background: var(--white);
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* --- Footer --- */
.footer {
    background-color: var(--secondary-color);
    color: #94a3b8;
    padding: 2rem 0;
    text-align: center;
}

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

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: #fff;
    font-size: 1.5rem;
}

body.menu-open {
    overflow: hidden;
}

/* --- Responsive Media Queries --- */

/* Tablet & Mobile */
@media screen and (max-width: 768px) {

    /* NAVBAR / MENÚ MÓVIL */

    .nav-container {
        gap: 0.75rem;
        position: relative;
        /* referencia para el menú desplegable */
    }

    .logo {
        font-size: 1.05rem;
    }

    /* Panel del menú móvil: dropdown debajo del header, fondo sólido */
    .nav-menu {
        position: absolute;
        top: 100%;
        /* justo debajo del header */
        left: 0;
        right: 0;

        background-color: #ffffff;
        padding: 1.5rem 1.25rem 1.75rem;

        display: none;
        /* oculto por defecto */
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;

        box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
        border-radius: 0 0 12px 12px;
        z-index: 200;
        /* por encima del contenido */
    }

    .nav-menu.show-menu {
        display: flex;
        /* se muestra cuando JS añade show-menu */
    }

    .nav-list {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.25rem;
        width: 100%;
    }

    .nav-link {
        font-size: 1.05rem;
    }

    .nav-link.button-link {
        padding: 0.7rem 1.4rem;
        width: 100%;
        text-align: center;
    }

    .nav-toggle,
    .nav-close {
        display: block;
    }

    .nav-toggle {
        font-size: 1.8rem;
    }

    .nav-close {
        position: absolute;
        top: 0.75rem;
        right: 1rem;
        font-size: 1.6rem;
        cursor: pointer;
    }

    .lang-switcher {
        margin-top: 0.5rem;
    }

    /* HERO MOBILE: TEXTO ARRIBA, FOTO ABAJO */

    .hero-container {
        display: grid;
        grid-template-columns: 1fr;
        /* una columna */
        gap: 2.5rem;
    }

    .hero-description {
        max-width: 100%;
    }

    .hero-image-wrapper {
        justify-content: center;
    }

    /* CONTACT: UNA COLUMNA COMPLETA EN MÓVIL */

    .contact-details {
        grid-template-columns: 1fr;
    }

    .contact-item {
        align-items: flex-start;
    }

    .contact-item a {
        word-break: break-all;
        /* evita que un link largo rompa el layout */
    }

    /* ABOUT: ESTADÍSTICAS CENTRADAS EN MÓVIL/TABLET */

    .about-stats {
        justify-content: center;
        padding: 0 1.25rem;
        gap: 1.5rem 2rem;
    }

    /* FOOTER EN COLUMNA */

    .footer-content {
        flex-direction: column;
        gap: 1rem;
    }

    /* Timeline más simple en móvil (línea a la izquierda) */
    .timeline::after {
        left: 20px;
    }

    .timeline-item {
        width: 100%;
        padding-left: 50px;
        padding-right: 0;
        left: 0;
    }

    .timeline-dot {
        left: 13px;
        right: auto;
    }
}

/* Desktop Styles para Timeline */
@media screen and (min-width: 769px) {
    .timeline::after {
        left: 50%;
        transform: translateX(-50%);
    }

    .timeline-item {
        width: 50%;
        padding-left: 0;
        padding-right: 40px;
        left: 0;
    }

    .timeline-item:nth-child(even) {
        left: 50%;
        padding-left: 40px;
        padding-right: 0;
    }

    .timeline-dot {
        left: auto;
        right: -11px;
    }

    .timeline-item:nth-child(even) .timeline-dot {
        left: -11px;
        right: auto;
    }

    .timeline-date {
        position: absolute;
        top: 0;
        right: -140px;
        width: 100px;
        text-align: left;
    }

    .timeline-item:nth-child(even) .timeline-date {
        right: auto;
        left: -140px;
        text-align: right;
    }
}