@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Rajdhani:wght@300;400;500;700&display=swap');

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

:root {
    --primary-glow: #00ffff;
    --secondary-glow: #ff0080;
    --tertiary-glow: #80ff00;
    --dark-bg: #0a0a0f;
    --darker-bg: #050508;
    --text-light: #e0e0ff;
    --text-glow: #00ffff;
}

body {
    font-family: 'Rajdhani', sans-serif;
    background: var(--dark-bg);
    color: var(--text-light);
    overflow-x: hidden;
    cursor: none;
}

/* Custom Cursor */
.cursor {
    position: fixed;
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.cursor.hover {
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, var(--secondary-glow) 0%, transparent 70%);
}

/* Matrix Rain Background */
.matrix-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.1;
}

/* Floating Particles */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--primary-glow);
    border-radius: 50%;
    animation: float 15s infinite linear;
}

@keyframes float {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateY(-100vh) scale(1);
        opacity: 0;
    }
}

/* Glitch Effect */
@keyframes glitch {
    0% {
        transform: translate(0);
    }

    20% {
        transform: translate(-2px, 2px);
    }

    40% {
        transform: translate(-2px, -2px);
    }

    60% {
        transform: translate(2px, 2px);
    }

    80% {
        transform: translate(2px, -2px);
    }

    100% {
        transform: translate(0);
    }
}

.glitch {
    animation: glitch 0.3s infinite;
}

/* Header */
header {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 255, 255, 0.2);
    z-index: 1000;
    padding: 1rem 0;
}

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

.logo {
    font-family: 'Orbitron', monospace;
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--primary-glow);
    text-shadow: 0 0 20px var(--primary-glow);
    position: relative;
}

.logo::before {
    content: '>';
    position: absolute;
    left: -20px;
    animation: blink 1.5s infinite;
}

@keyframes blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

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

.nav-links a {
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    transition: all 0.3s ease;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-glow), var(--secondary-glow));
    transition: width 0.3s ease;
}

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

.nav-links a:hover {
    color: var(--primary-glow);
    text-shadow: 0 0 10px var(--primary-glow);
}

/* Hero Section */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: radial-gradient(ellipse at center, rgba(0, 255, 255, 0.1) 0%, transparent 70%);
}

.hero-content {
    text-align: center;
    z-index: 2;
    position: relative;
}

.hero-subtitle {
    font-family: 'Orbitron', monospace;
    font-size: 1.2rem;
    color: var(--secondary-glow);
    margin-bottom: 1rem;
    opacity: 0;
    animation: slideUp 1s ease forwards 0.5s;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.hero h1 {
    font-family: 'Orbitron', monospace;
    font-size: 4.5rem;
    font-weight: 900;
    margin-bottom: 1rem;
    opacity: 0;
    animation: slideUp 1s ease forwards 0.8s;
    text-shadow: 0 0 30px var(--primary-glow);
    position: relative;
}

.hero h1::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, var(--primary-glow) 50%, transparent 70%);
    opacity: 0;
    animation: scan 3s infinite;
}

@keyframes scan {
    0% {
        transform: translateX(-100%);
        opacity: 0;
    }

    50% {
        opacity: 0.5;
    }

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

.hero-description {
    font-size: 1.4rem;
    margin-bottom: 3rem;
    opacity: 0;
    animation: slideUp 1s ease forwards 1.1s;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.cta-container {
    opacity: 0;
    animation: slideUp 1s ease forwards 1.4s;
}

.cta-button {
    display: inline-block;
    padding: 15px 40px;
    background: linear-gradient(45deg, var(--primary-glow), var(--secondary-glow));
    color: var(--dark-bg);
    text-decoration: none;
    border-radius: 0;
    font-weight: 700;
    font-family: 'Orbitron', monospace;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.cta-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.6s ease;
}

.cta-button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px var(--primary-glow);
    border-color: var(--primary-glow);
}

.cta-button:hover::before {
    left: 100%;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }

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

/* Sections */
section {
    padding: 8rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
}

.section-title {
    font-family: 'Orbitron', monospace;
    text-align: center;
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 4rem;
    color: var(--primary-glow);
    text-shadow: 0 0 20px var(--primary-glow);
    position: relative;
}

.section-title::before,
.section-title::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 100px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-glow), transparent);
}

.section-title::before {
    left: -150px;
}

.section-title::after {
    right: -150px;
}

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

.profile-container {
    position: relative;
}

.profile-img {
    width: 350px;
    height: 350px;
    border-radius: 0;
    object-fit: cover;
    position: relative;
    border: 3px solid var(--primary-glow);
    box-shadow: 0 0 50px rgba(0, 255, 255, 0.3);
}

.about-text {
    font-size: 1.2rem;
    line-height: 1.8;
}

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

.tech-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 3rem;
}

.tech-item {
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.1), rgba(255, 0, 128, 0.1));
    border: 1px solid rgba(0, 255, 255, 0.3);
    padding: 1rem;
    text-align: center;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.tech-item::before {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 255, 0.2), transparent);
    transition: top 0.5s ease;
}

.tech-item:hover::before {
    top: 100%;
}

.tech-item:hover {
    border-color: var(--primary-glow);
    color: var(--primary-glow);
    text-shadow: 0 0 10px var(--primary-glow);
}

/* Projects Section */
.projects-container {
    position: relative;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 3rem;
}

.project-card {
    background: linear-gradient(135deg, rgba(10, 10, 15, 0.8), rgba(20, 20, 30, 0.8));
    border: 1px solid rgba(0, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    transition: all 0.5s ease;
    backdrop-filter: blur(10px);
}

.project-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--primary-glow), var(--secondary-glow), var(--tertiary-glow), var(--primary-glow));
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.project-card:hover::before {
    opacity: 1;
}

.project-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 50px rgba(0, 255, 255, 0.2);
}

.project-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    background: #222;
}

.project-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    border-radius: 16px 16px 0 0;
}

.project-preview::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 50%, var(--primary-glow) 0%, transparent 20%),
        radial-gradient(circle at 80% 20%, var(--secondary-glow) 0%, transparent 20%),
        radial-gradient(circle at 40% 80%, var(--tertiary-glow) 0%, transparent 20%);
    opacity: 0.1;
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.1;
    }

    50% {
        opacity: 0.3;
    }
}

.project-icon {
    font-size: 4rem;
    color: var(--primary-glow);
    z-index: 2;
    position: relative;
    text-shadow: 0 0 20px var(--primary-glow);
}

.project-content {
    padding: 2rem;
}

.project-title {
    font-family: 'Orbitron', monospace;
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--primary-glow);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.project-description {
    margin-bottom: 1.5rem;
    line-height: 1.6;
    opacity: 0.9;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.tech-tag {
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.3);
    color: var(--primary-glow);
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.project-link {
    display: inline-block;
    background: linear-gradient(45deg, var(--primary-glow), var(--secondary-glow));
    color: var(--dark-bg);
    padding: 0.8rem 2rem;
    text-decoration: none;
    font-weight: 700;
    font-family: 'Orbitron', monospace;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.project-link:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--primary-glow);
}

/* CV Download Section */
.cv-section {
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.05), rgba(255, 0, 128, 0.05));
    border: 1px solid rgba(0, 255, 255, 0.2);
    padding: 4rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    margin: 4rem 0;
}

.cv-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    opacity: 0.03;
    animation: rotate 20s linear infinite;
}

.cv-title {
    font-family: 'Orbitron', monospace;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--primary-glow);
    text-shadow: 0 0 20px var(--primary-glow);
}

.cv-description {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.download-button {
    display: inline-block;
    background: linear-gradient(45deg, var(--secondary-glow), var(--primary-glow));
    color: var(--dark-bg);
    padding: 1.2rem 3rem;
    text-decoration: none;
    font-weight: 700;
    font-family: 'Orbitron', monospace;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 1.1rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.download-button:hover {
    transform: scale(1.1) rotate(-2deg);
    box-shadow: 0 0 40px var(--secondary-glow);
    border-color: var(--secondary-glow);
}

/* Contact Section */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.contact-item {
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.1), rgba(255, 0, 128, 0.1));
    border: 1px solid rgba(0, 255, 255, 0.2);
    padding: 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.contact-item::before {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.1), rgba(255, 0, 128, 0.1));
    transition: top 0.5s ease;
}

.contact-item:hover::before {
    top: 0;
}

.contact-item:hover {
    border-color: var(--primary-glow);
    color: var(--primary-glow);
    text-shadow: 0 0 10px var(--primary-glow);
    transform: translateY(-10px);
}

.contact-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--primary-glow);
}

.contact-title {
    font-family: 'Orbitron', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Terminal Effect */
.terminal {
    background: var(--darker-bg);
    border: 1px solid var(--primary-glow);
    padding: 1rem;
    font-family: 'Courier New', monospace;
    margin: 2rem 0;
    position: relative;
}

.terminal::before {
    content: '> ';
    color: var(--primary-glow);
}

.terminal-text {
    color: var(--tertiary-glow);
}

/* Footer */
footer {
    background: var(--darker-bg);
    border-top: 1px solid rgba(0, 255, 255, 0.2);
    padding: 3rem 0;
    text-align: center;
    position: relative;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Responsive */
@media (max-width: 768px) {
    header {
        padding: 0.5rem 0;
    }

    nav {
        flex-direction: column;
        gap: 1rem;
        padding: 0 1rem;
    }

    .logo {
        font-size: 1.2rem;
    }

    .hero {
        height: auto;
        min-height: 70vh;
        padding: 4rem 1rem 2rem 1rem;
    }

    .hero-content {
        padding: 1rem;
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .hero-description {
        font-size: 1rem;
        margin-bottom: 2rem;
    }

    .cta-button {
        padding: 10px 20px;
        font-size: 1rem;
    }

    section {
        padding: 3rem 1rem;
    }

    .section-title {
        font-size: 2rem;
        margin-bottom: 2rem;
    }

    .about-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        text-align: center;
    }

    .profile-img {
        width: 150px;
        height: 150px;
        margin: 0 auto;
    }

    .tech-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        margin-top: 1.5rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .project-preview {
        height: 150px;
    }

    .project-content {
        padding: 1rem;
    }

    .cv-section {
        padding: 2rem 1rem;
        margin: 2rem 0;
    }

    .cv-title {
        font-size: 1.5rem;
    }

    .download-button {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }

    .contact-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-top: 1.5rem;
    }

    .contact-item {
        padding: 1rem;
    }

    .contact-icon {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

    footer {
        padding: 1.5rem 0;
    }

    .footer-content {
        padding: 0 1rem;
    }
}

/* Extra: Mejorar para pantallas muy pequeñas */
@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.3rem;
    }

    .section-title {
        font-size: 1.2rem;
    }

    .profile-img {
        width: 100px;
        height: 100px;
    }

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

/* Loading Screen */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--darker-bg);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.loader-text {
    font-family: 'Orbitron', monospace;
    font-size: 2rem;
    color: var(--primary-glow);
    margin-bottom: 2rem;
    text-shadow: 0 0 20px var(--primary-glow);
}

.loader-bar {
    width: 300px;
    height: 4px;
    background: rgba(0, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.project-access {
    margin: 1rem 0;
    font-size: 1rem;
    background: rgba(0, 255, 255, 0.07);
    border-radius: 8px;
    padding: 0.7rem 1rem;
    color: var(--primary-glow);
    font-family: 'Rajdhani', monospace;
}

.loader-progress {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-glow), var(--secondary-glow));
    animation: loading 3s ease-in-out forwards;
}

@keyframes loading {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

@keyframes blink-cursor {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

.cursor-blink {
    animation: blink-cursor 1s infinite;
    color: var(--primary-glow);
}

/* Centrar el loader en móviles */
@media (max-width: 768px) {
    .loader {
        display: flex;
        flex-direction: column;
        justify-content: center !important;
        align-items: center !important;
        min-height: 100vh;
        top: 0;
        left: 0;  
        width: 100vw;
        text-align: center;
        position: fixed;
    }

    .loader-text {
        font-size: 1.5rem;
        margin-bottom: 1rem;
        width: 100%;
        text-align: center;
        display: flex;
        justify-content: center;
        align-items: center;
    }
}

/* Tech grid en móviles: varias columnas */
@media (max-width: 768px) {
    .tech-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
        margin-top: 1.5rem;
    }

    .tech-item {
        font-size: 0.95rem;
        padding: 0.5rem 0.3rem;
        text-align: center;
        border-radius: 8px;
        background: rgba(0, 0, 0, 0.08);
    }
}

/* Extra pequeño: una sola columna si la pantalla es muy estrecha */
@media (max-width: 480px) {
    .tech-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .nav-links {
        display: none !important;
    }
}