/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #3498db;
    --secondary: #2c3e50;
    --accent: #e74c3c;
    --dark: #1a1a2e;
    --light: #f5f5f5;
    --white: #ffffff;
    --gray: #7f8c8d;
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    /* Fondo compartido (mismas capas que el body) */
    --shared-bg-layers: 
        linear-gradient(135deg, rgba(13, 13, 26, 0.85) 0%, rgba(26, 26, 46, 0.9) 100%),
        url('hero-background.jpg');
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--secondary);
    background: #0f1121; /* fallback */
    position: relative;
}

/* Background image layer (fixes mobile issues with background-attachment: fixed) */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background: var(--shared-bg-layers) center/cover no-repeat;
    animation: backgroundMove 60s ease-in-out infinite;
    will-change: transform, background-position, background-size;
}

/* Global text justification for body copy */
p,
.skill-details,
.section-subtitle,
.project-card p,
.education-card p,
.experience-card p {
    text-align: justify;
    text-justify: inter-word;
}

/* Experience lists specifically */
.experience-list,
.experience-list li {
    text-align: justify;
    text-justify: inter-word;
    hyphens: auto;
}

/* Keep hero description not justified */
.hero p,
.hero .hero-subtitle,
.hero .hero-description {
    text-align: center;
}
@keyframes backgroundMove {
    0%, 100% {
        background-position: center center;
        background-size: 100% 100%;
    }
    25% {
        background-position: 60% 40%;
        background-size: 110% 110%;
    }
    50% {
        background-position: 40% 60%;
        background-size: 105% 105%;
    }
    75% {
        background-position: 55% 45%;
        background-size: 110% 110%;
    }
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    transition: all 0.3s ease;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary);
    text-decoration: none;
    transition: color 0.3s;
}

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

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-menu a {
    color: var(--secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
    position: relative;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s;
}

.nav-menu a:hover {
    color: var(--primary);
}

.nav-menu a:hover::after {
    width: 100%;
}

/* Nav Right Section */
.nav-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.social-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.social-links a {
    color: var(--secondary);
    font-size: 1.3rem;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Language Toggle */
.lang-toggle {
    background: transparent;
    border: 2px solid rgba(0, 0, 0, 0.25);
    border-radius: 14px;
    padding: 0.4rem 1rem;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--secondary);
}

.lang-toggle:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--secondary);
    transform: translateY(-2px);
    border-color: rgba(0,0,0,0.4);
}

.lang-option {
    color: var(--gray);
    transition: color 0.3s;
}

.lang-option.active {
    color: var(--primary);
}

.lang-separator {
    margin: 0 0.3rem;
    color: var(--gray);
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: transparent;
    color: var(--white);
    text-align: center;
    padding: 2rem;
    position: relative;
}

.hero-content {
    max-width: 800px;
    animation: fadeInUp 1s ease;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    animation: fadeInUp 1s ease 0.2s backwards;
}

.hero-subtitle {
    font-size: 2rem;
    margin-bottom: 0.6rem;
    opacity: 0.9;
    animation: fadeInUp 1s ease 0.4s backwards;
    letter-spacing: 0.01em;
    word-spacing: 0.02em;
}

.hero-description {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    opacity: 0.8;
    animation: fadeInUp 1s ease 0.6s backwards;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    animation: fadeInUp 1s ease 0.8s backwards;
}

.btn {
    padding: 0.8rem 2rem;
    border-radius: 14px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-block;
    border: 2px solid transparent;
}

.btn-primary {
    background: transparent;
    color: var(--white);
    border-color: rgba(255,255,255,0.6);
}

.btn-primary:hover {
    background: rgba(255,255,255,0.12);
    color: var(--white);
    border-color: var(--white);
    transform: translateY(-2px);
}

.btn-secondary {
    background: transparent;
    color: var(--white);
    border-color: rgba(255,255,255,0.6);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.12);
    color: var(--white);
    border-color: var(--white);
    transform: translateY(-2px);
}

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    animation: bounce 2s infinite;
}

.scroll-indicator i {
    font-size: 2rem;
    opacity: 0.7;
}

/* Sections */
.section {
    padding: 5rem 2rem;
    /* Apple-like soft white background to reduce glare */
    background: #f5f6f7;
}

.section-dark {
    background: transparent;
    color: var(--light);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--primary);
}

.section-subtitle {
    text-align: center;
    font-size: 1.2rem;
    color: var(--gray);
    margin-bottom: 2rem;
}

/* About Section */
.about-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    align-items: center;
}

.about-text {
    background: rgba(255, 255, 255, 0.8);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.06),
        0 8px 24px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(10px);
}

.about-text p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    line-height: 1.8;
}

.about-stats {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.stat-item {
    text-align: center;
    padding: 1.5rem;
    background: var(--light);
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.08),
        0 4px 12px rgba(0, 0, 0, 0.05);
}

.stat-item:hover {
    transform: translateY(-8px);
    box-shadow: 
        0 8px 16px rgba(0, 0, 0, 0.12),
        0 20px 40px rgba(0, 0, 0, 0.1);
}

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

.stat-label {
    font-size: 0.9rem;
    color: var(--gray);
    text-transform: uppercase;
}

/* Experience Grid */
.experience-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.experience-card {
    background: #2c2c44;
    padding: 2.5rem;
    border-radius: 10px;
    transition: all 0.3s;
    width: 100%;
    position: relative;
    z-index: 1;
    cursor: pointer;
}

.experience-card:hover {
    transform: translateX(10px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.experience-card.active {
    z-index: 10;
    transform: scale(1.02);
}

.experience-header {
    margin-bottom: 1.5rem;
}

.experience-card h3 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: var(--light);
}

.experience-company {
    color: var(--primary);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.experience-period {
    color: var(--gray);
    font-style: italic;
    font-size: 0.9rem;
}

.experience-list {
    margin-left: 1.5rem;
}

.experience-list li {
    margin-bottom: 0.8rem;
    line-height: 1.6;
    color: rgba(255,255,255,0.85);
}

.experience-list li::marker {
    color: var(--primary);
}

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

/* 6 columnas en pantallas grandes */
@media (min-width: 1200px) {
    .skills-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

.skill-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    transition: all 0.3s;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.section-dark .skill-card {
    background: #2c2c44;
}

.skill-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.2);
}

.skill-card i {
    font-size: 3rem;
    /* Iconos con textura del mismo fondo para contraste elegante */
    background: var(--shared-bg-layers) center/cover no-repeat fixed;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    margin-bottom: 1rem;
    /* oscurecer y mejorar contraste del relleno */
    filter: brightness(0.7) contrast(1.05);
    -webkit-text-stroke: 0.6px rgba(0, 0, 0, 0.25);
    /* sincronizar el movimiento con el fondo del body */
    animation: backgroundMove 60s ease-in-out infinite;
}

.skill-card h3 {
    margin-bottom: 1rem;
}

.skill-bar {
    background: rgba(52, 152, 219, 0.2);
    height: 8px;
    border-radius: 10px;
    overflow: hidden;
}

.skill-progress {
    height: 100%;
    background: var(--primary);
    border-radius: 10px;
    animation: progressBar 1.5s ease;
}

/* Education Grid */
.education-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

@media (min-width: 900px) {
    .education-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .education-grid {
        grid-template-columns: 1fr;
    }
}

.education-card {
    background: #2c2c44;
    padding: 2rem;
    border-radius: 10px;
    text-align: left;
    transition: all 0.3s;
}

.education-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.3);
}

.education-icon {
    width: 60px;
    height: 60px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 0 1rem 0; /* alineado a la izquierda */
}

.education-icon i {
    font-size: 1.8rem;
    color: var(--white);
}

.education-card h3 {
    margin-bottom: 0.8rem;
    color: var(--light);
    font-size: 1.1rem;
}

.education-place {
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.education-date {
    color: var(--gray);
    font-style: italic;
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
}

.education-description {
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
}

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

@media (min-width: 900px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }
}

.project-card {
    background: #2c2c44;
    padding: 2rem;
    border-radius: 10px;
    transition: all 0.3s;
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.3);
}

.project-icon {
    width: 60px;
    height: 60px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.project-icon i {
    font-size: 1.8rem;
    color: var(--white);
}

.project-card h3 {
    margin-bottom: 1rem;
    color: var(--light);
}

.project-card p {
    margin-bottom: 0.8rem;
    color: rgba(255,255,255,0.8);
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.tag {
    background: rgba(52, 152, 219, 0.2);
    color: var(--primary);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

/* Contact Section */
.contact-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.contact-btn {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1.6rem;
    background: transparent;
    color: var(--secondary);
    text-decoration: none;
    border-radius: 14px;
    border: 2px solid rgba(0,0,0,0.25);
    font-weight: 600;
    transition: all 0.25s ease;
}

.contact-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
    border-color: rgba(0,0,0,0.4);
}

.contact-btn i {
    font-size: 1.3rem;
    color: inherit;
}

/* Footer */
.footer {
    background: var(--dark);
    color: var(--light);
    text-align: center;
    padding: 2rem;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

@keyframes progressBar {
    from {
        width: 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
    }
    
    .social-links a {
        font-size: 1.1rem;
    }
    
    .nav-right {
        gap: 1rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.2rem;
    }
    
    .hero-buttons {
        flex-direction: column;
    }
    
    .about-content {
        grid-template-columns: 1fr;
    }
    
    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .contact-links {
        flex-direction: column;
        align-items: center;
    }

    /* Mobile: aseguremos la visibilidad y rendimiento del fondo */
    body::before {
        animation: none;
        background-position: center center;
        background-size: cover;
    }

    /* Hero text sizes en móvil */
    .hero-title {
        font-size: 2.1rem;
        margin-bottom: 0.4rem;
    }
    .hero-subtitle {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
    .section {
        padding: 3.5rem 1.25rem;
    }
    .btn {
        padding: 0.7rem 1.4rem;
        border-radius: 12px;
    }
}
