/* ===================================
   VARIABLES Y RESET
   =================================== */

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

:root {
    --primary-bg: #0a0a0a;
    --secondary-bg: #1a1a1a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
}

/* ===================================
   ESTILOS GENERALES
   =================================== */

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #ffffff;
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 1s ease;
}

body.scrolled-down {
    background: #0f0f0f;
}

/* ===================================
   OVERLAY DE GRADIENTE (EFECTO HOVER)
   =================================== */

#gradient-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    z-index: 500;
}

#gradient-overlay.active-1 {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    opacity: 1;
}

#gradient-overlay.active-2 {
    background: linear-gradient(135deg, rgba(240, 147, 251, 0.2) 0%, rgba(245, 87, 108, 0.2) 100%);
    opacity: 1;
}

#gradient-overlay.active-3 {
    background: linear-gradient(135deg, rgba(79, 172, 254, 0.2) 0%, rgba(0, 242, 254, 0.2) 100%);
    opacity: 1;
}

#gradient-overlay.active-4 {
    background: linear-gradient(135deg, rgba(67, 233, 123, 0.2) 0%, rgba(56, 249, 215, 0.2) 100%);
    opacity: 1;
}

#gradient-overlay.active-5 {
    background: linear-gradient(135deg, rgba(250, 112, 154, 0.2) 0%, rgba(254, 225, 64, 0.2) 100%);
    opacity: 1;
}

#gradient-overlay.active-6 {
    background: linear-gradient(135deg, rgba(48, 207, 208, 0.2) 0%, rgba(51, 8, 103, 0.2) 100%);
    opacity: 1;
}

/* Asegurar que el contenido esté sobre el overlay */
nav,
.hero,
section,
footer {
    position: relative;
    z-index: 1000;
}

/* ===================================
   NAVEGACIÓN
   =================================== */

nav {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 1.5rem 5%;
    z-index: 1001;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
}

body.scrolled-down nav {
    background: rgba(0, 0, 0, 0.9);
}

nav.scrolled {
    padding: 1rem 5%;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #000000;
    transition: color 1s ease;
}

@media (max-width: 768px) {

    /* Logo centrado en móvil */
    .logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        font-size: clamp(1.4rem, 4vw, 1.6rem);
        white-space: nowrap;
    }

    /* resto del código móvil... */
}

body.scrolled-down .logo {
    color: #ffffff;
}

.nav-links {
    display: flex;
    gap: 2.5rem;
    list-style: none;
}

.nav-links a {
    color: #666666;
    text-decoration: none;
    transition: color 1s ease;
    font-size: 0.95rem;
    font-weight: 500;
}

body.scrolled-down .nav-links a {
    color: var(--text-secondary);
}

.nav-links a:hover {
    color: var(--accent);
}

/* Botón hamburguesa (oculto en desktop) */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: 1002;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background: #000000;
    transition: all 0.3s ease;
    border-radius: 3px;
}

body.scrolled-down .menu-toggle span {
    background: #ffffff;
}

/* Animación del botón hamburguesa cuando está activo */
.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Overlay oscuro para cerrar el menú */
.menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.menu-overlay.active {
    display: block;
    opacity: 1;
}

/* ===================================
   HERO SECTION
   =================================== */

.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5%;
    position: relative;
}

.hero-content {
    max-width: 1200px;
    text-align: center;
}

.hero h1 {
    font-size: clamp(2.5rem, 8vw, 6rem);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 2rem;
    letter-spacing: -2px;
    color: #000000;
    transition: color 1s ease;
}

body.scrolled-down .hero h1 {
    color: #ffffff;
}

.hero-subtitle {
    font-size: clamp(1.2rem, 3vw, 2rem);
    color: #666666;
    margin-bottom: 3rem;
    font-weight: 300;
    transition: color 1s ease;
}

body.scrolled-down .hero-subtitle {
    color: var(--text-secondary);
}

.highlight {
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.cta-button {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: var(--accent);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: all 1s ease;
    border: 2px solid var(--accent);
}

.cta-button:hover {
    background: transparent;
    color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.3);
}

body.scrolled-down .cta-button {
    background: var(--accent);
    color: white;
}

/* ===================================
   SECCIONES GENERALES
   =================================== */

section:not(.hero) {
    padding: 8rem 5%;
    max-width: 1400px;
    margin: 0 auto;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

section.visible {
    opacity: 1;
    transform: translateY(0);
}

.section-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: 1rem;
    font-weight: 700;
    letter-spacing: -1px;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin-bottom: 4rem;
}

/* ===================================
   ABOUT SECTION
   =================================== */

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.about-text p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.skill-item {
    background: var(--secondary-bg);
    padding: 1rem 1.5rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.skill-item:hover {
    border-color: var(--accent);
    transform: translateX(5px);
}

/* ===================================
   EXPERIENCE & EDUCATION SECTIONS
   =================================== */

.experience-grid {
    display: grid;
    gap: 3rem;
}

.experience-item {
    background: var(--secondary-bg);
    padding: 2.5rem;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.experience-item:hover {
    border-color: var(--accent);
    transform: translateY(-5px);
}

.experience-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.experience-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.experience-date {
    color: var(--accent);
    font-size: 0.9rem;
}

.experience-company {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.experience-description {
    color: var(--text-secondary);
    line-height: 1.8;
}

.experience-description ul {
    margin-top: 1rem;
    padding-left: 1.5rem;
}

.experience-description li {
    margin-bottom: 0.5rem;
}

.experience-metrics {
    color: var(--accent);
    font-weight: 600;
}

/* ===================================
   PORTFOLIO SECTION
   =================================== */

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.portfolio-item {
    position: relative;
    background: var(--secondary-bg);
    border-radius: 15px;
    overflow: hidden;
    aspect-ratio: 16/10;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.portfolio-item:hover {
    transform: translateY(-10px);
    border-color: var(--accent);
}

.portfolio-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.portfolio-item:hover .portfolio-image {
    transform: scale(1.1);
}

.portfolio-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.portfolio-item:hover .portfolio-overlay {
    transform: translateY(0);
}

.portfolio-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.portfolio-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===================================
   CONTACT SECTION
   =================================== */

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

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 3rem;
}

.contact-item {
    font-size: 1.2rem;
}

.contact-item a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.3s ease;
}

.contact-item a:hover {
    color: var(--accent-hover);
}

.social-links {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin-top: 2rem;
}

.social-links a {
    color: var(--text-secondary);
    font-size: 1.5rem;
    transition: all 0.3s ease;
}

.social-links a:hover {
    color: var(--accent);
    transform: translateY(-3px);
}

/* ===================================
   FOOTER
   =================================== */

footer {
    text-align: center;
    padding: 3rem 5%;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

/* ===================================
   ANIMACIONES
   =================================== */

.fade-in {
    animation: fadeIn 1s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

@media (max-width: 768px) {

    /* Mostrar botón hamburguesa */
    .menu-toggle {
        display: flex;
    }

    /* Ajustar container de navegación */
    .nav-container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    /* Logo centrado en móvil */
    .logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }

    /* Menú lateral (sidebar) */
    .nav-links {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        background: var(--secondary-bg);
        flex-direction: column;
        gap: 0;
        padding: 6rem 0 2rem 0;
        z-index: 999;
        transition: left 0.3s ease;
        overflow-y: auto;
    }

    .nav-links.active {
        left: 0;
    }

    .nav-links li {
        width: 100%;
    }

    .nav-links a {
        display: block;
        padding: 1.2rem 2rem;
        color: var(--text-primary);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        transition: all 0.3s ease;
    }

    .nav-links a:hover,
    .nav-links a:active {
        background: rgba(59, 130, 246, 0.1);
        color: var(--accent);
        padding-left: 2.5rem;
    }

    .about-content {
        grid-template-columns: 1fr;
    }

    .skills-grid {
        grid-template-columns: 1fr;
    }

    .experience-header {
        flex-direction: column;
        gap: 0.5rem;
    }

    .portfolio-grid {
        grid-template-columns: 1fr;
    }
}