/* ===== CSS Variables ===== */
:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --accent-color: #06b6d4;
    --bg-dark: #0f0f23;
    --bg-darker: #070714;
    --bg-card: rgba(255, 255, 255, 0.05);
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
    --gradient-hero: linear-gradient(180deg, #0f0f23 0%, #1a1a3e 50%, #0f0f23 100%);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.3);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    cursor: auto;
}

@media (pointer: fine) {
    body {
        cursor: none;
    }
}

/* Custom Cursor */
.cursor {
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    position: fixed;
    pointer-events: none;
    transform: translate(-50%, -50%);
    transition: width 0.2s, height 0.2s, border-color 0.2s;
    z-index: 9999;
    mix-blend-mode: difference;
}

.cursor-dot {
    width: 6px;
    height: 6px;
    background: var(--accent-color);
    border-radius: 50%;
    position: fixed;
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 9999;
}

.cursor.hover {
    width: 40px;
    height: 40px;
    border-color: var(--accent-color);
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* ===== Navbar ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(15, 15, 35, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 2rem;
}

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

.language-switcher {
    display: flex;
    gap: 0.5rem;
}

.lang-link {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}

.lang-link:hover,
.lang-link.active {
    color: var(--text-primary);
    background: var(--bg-card);
}

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

.nav-link {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-secondary);
    position: relative;
    padding: 0.5rem 0;
    transition: var(--transition);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: var(--transition);
}

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

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

.nav-link:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 4px;
    border-radius: 4px;
}

.lang-link:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0.25rem;
}

.hamburger:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 4px;
    border-radius: 4px;
}

.bar {
    width: 25px;
    height: 3px;
    background: var(--text-primary);
    border-radius: 3px;
    transition: var(--transition);
}

/* ===== Hero Section ===== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-hero);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.hero-content {
    text-align: center;
    z-index: 10;
    animation: fadeInUp 1s ease-out;
}

.hero-title {
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 800;
    letter-spacing: 0.1em;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    text-shadow: 0 0 60px rgba(99, 102, 241, 0.5);
}

.hero-subtitle {
    font-size: clamp(1.2rem, 3vw, 2rem);
    font-weight: 300;
    color: var(--text-secondary);
    letter-spacing: 0.3em;
}

/* Social Icons */
.social-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2.5rem;
}

.social-icon {
    width: 50px;
    height: 50px;
    border: 2px solid var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
    font-size: 1.25rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
}

.social-icon:hover {
    transform: scale(1.3) rotate(360deg);
    background: var(--accent-color);
    color: var(--bg-dark);
    box-shadow: 0 0 30px rgba(6, 182, 212, 0.6);
}

/* CV Button in Hero */
.btn-cv-hero {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    padding: 0.875rem 2rem;
    background: var(--gradient-primary);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.05em;
    border-radius: 50px;
    box-shadow: var(--shadow-glow);
    transition: var(--transition);
}

.btn-cv-hero:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 0 50px rgba(99, 102, 241, 0.5);
}

/* Subtle CV Link in Competencias */
.cv-link-subtle {
    color: var(--accent-color);
    font-weight: 500;
    transition: var(--transition);
}

.cv-link-subtle:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.hero-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

/* ===== Competencias Section ===== */
.competencias {
    padding: 6rem 2rem;
    background: var(--bg-darker);
    position: relative;
}

.section-title {
    text-align: center;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    margin-bottom: 1rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.btn-curriculum {
    display: block;
    width: fit-content;
    margin: 0 auto 4rem;
    padding: 1rem 3rem;
    background: var(--gradient-primary);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.1em;
    border-radius: 50px;
    box-shadow: var(--shadow-glow);
    transition: var(--transition);
}

.btn-curriculum:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 60px rgba(99, 102, 241, 0.5);
}

.skills-grid {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.skill-category {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2rem;
    backdrop-filter: blur(10px);
    transition: var(--transition);
    animation: fadeInUp 0.6s ease-out both;
}

.skill-category:hover {
    transform: translateY(-5px);
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: var(--shadow-glow);
}

.category-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(6, 182, 212, 0.3);
}

.skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.skill-tag {
    padding: 0.5rem 1rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 25px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: var(--transition);
    cursor: default;
}

.skill-tag:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary-color);
    transform: scale(1.05);
}

/* AI Featured Section */
.skill-category.ai-featured {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 50%, rgba(6, 182, 212, 0.1) 100%);
    border-color: rgba(139, 92, 246, 0.3);
}

.skill-category.ai-featured:hover {
    border-color: rgba(139, 92, 246, 0.6);
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.3);
}

.skill-category.ai-featured .category-title {
    color: #a78bfa;
    border-bottom-color: rgba(139, 92, 246, 0.4);
}

.ai-subcategory {
    margin-bottom: 1.5rem;
}

.ai-subcategory:last-child {
    margin-bottom: 0;
}

.subcategory-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.skill-tag.ai-tag {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.4);
}

.skill-tag.ai-tag:hover {
    background: rgba(139, 92, 246, 0.3);
    border-color: rgba(139, 92, 246, 0.6);
}

/* ===== Proyectos Section ===== */
.proyectos {
    padding: 6rem 2rem;
    background: var(--bg-dark);
    text-align: center;
}

.proyectos-content {
    max-width: 800px;
    margin: 3rem auto 0;
}

.proyectos-cta {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2rem;
    line-height: 1.3;
}

.btn-contact {
    display: inline-block;
    padding: 1.25rem 3rem;
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.05em;
    border-radius: 50px;
    transition: var(--transition);
}

.btn-contact:hover {
    background: var(--gradient-primary);
    border-color: transparent;
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}

/* ===== Contacto Section ===== */
.contacto {
    padding: 6rem 2rem;
    background: var(--gradient-hero);
    text-align: center;
}

.contacto-text {
    color: var(--text-secondary);
    font-size: 1.25rem;
    max-width: 600px;
    margin: 1rem auto 3rem;
}

.contact-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.contact-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    font-weight: 500;
    color: var(--text-primary);
    transition: var(--transition);
}

.contact-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary-color);
    transform: translateY(-3px);
}

.contact-btn i {
    font-size: 1.25rem;
    color: var(--primary-color);
}

/* ===== Contact Form ===== */
.contact-section {
    padding: 4rem 2rem;
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 2rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.btn-submit {
    padding: 1rem 2rem;
    background: var(--gradient-primary);
    border: none;
    border-radius: 50px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.btn-submit:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}

.form-status {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    display: none;
}

.form-status.success {
    display: block;
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.form-status.error {
    display: block;
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ===== Footer ===== */
.footer {
    padding: 2rem;
    background: var(--bg-darker);
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

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

/* Stagger animation for skill categories */
.skill-category:nth-child(1) {
    animation-delay: 0.1s;
}

.skill-category:nth-child(2) {
    animation-delay: 0.2s;
}

.skill-category:nth-child(3) {
    animation-delay: 0.3s;
}

.skill-category:nth-child(4) {
    animation-delay: 0.4s;
}

.skill-category:nth-child(5) {
    animation-delay: 0.5s;
}

.skill-category:nth-child(6) {
    animation-delay: 0.6s;
}

.skill-category:nth-child(7) {
    animation-delay: 0.7s;
}

.skill-category:nth-child(8) {
    animation-delay: 0.8s;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
    }

    .nav-menu {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background: rgba(15, 15, 35, 0.98);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3rem;
        transition: var(--transition);
    }

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

    .hamburger {
        display: flex;
    }

    .hamburger.active .bar:nth-child(1) {
        transform: rotate(45deg) translate(5px, 6px);
    }

    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active .bar:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -6px);
    }

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

    .language-switcher {
        flex-direction: column;
        gap: 0.25rem;
    }

    .lang-link {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        letter-spacing: 0.05em;
    }

    .hero-subtitle {
        letter-spacing: 0.15em;
    }

    .competencias,
    .proyectos,
    .contacto {
        padding: 4rem 1rem;
    }

    .skill-category {
        padding: 1.5rem;
    }

    .btn-curriculum,
    .btn-contact {
        padding: 1rem 2rem;
    }
}

/* ===== Scroll animations (activated by JS) ===== */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Particle animation ===== */
.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 50%;
    opacity: 0.5;
    animation: float 15s infinite ease-in-out;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) translateX(0);
        opacity: 0.5;
    }

    25% {
        transform: translateY(-100px) translateX(50px);
        opacity: 0.8;
    }

    50% {
        transform: translateY(-50px) translateX(-30px);
        opacity: 0.3;
    }

    75% {
        transform: translateY(-150px) translateX(20px);
        opacity: 0.6;
    }
}

/* Visually hidden labels for screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .cursor,
    .cursor-dot {
        display: none !important;
    }

    body {
        cursor: auto !important;
    }

    .fade-in {
        opacity: 1;
        transform: none;
    }
}