/* --- VARIABLES --- */
:root {
    --bg-color: #050505;
    --card-bg: rgba(20, 20, 20, 0.6);
    --text-color: #ffffff;
    --accent-color: #CCFF00; /* Neon Lime */
    --accent-glow: rgba(204, 255, 0, 0.4);
    --secondary-text: #a0a0a0;
    --border-color: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.03);
    --font-display: 'Orbitron', sans-serif;
    --font-body: 'Inter', sans-serif;
    --transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    --header-height: 80px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Forzar aceleración por hardware globalmente para evitar parpadeos */
body { 
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    /* Importante para móviles iOS */
    -webkit-overflow-scrolling: touch; 
}

html { scroll-behavior: smooth; scroll-padding-top: var(--header-height); }

h1, h2, h3, .logo-text, .badge { font-family: var(--font-display); }

/* --- FONDO ANIMADO --- */
.bg-grid {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    z-index: -2;
    perspective: 1000px;
    transform-style: preserve-3d;
    /* Animación activada en Desktop */
    animation: gridMove 20s linear infinite;
    will-change: transform;
    backface-visibility: hidden;
}

.bg-glow {
    position: fixed; top: 50%; left: 50%; width: 80vw; height: 80vh;
    background: radial-gradient(circle, rgba(204, 255, 0, 0.05) 0%, transparent 60%);
    transform: translate(-50%, -50%); z-index: -1; pointer-events: none;
}

@keyframes gridMove {
    0% { transform: translateY(0); }
    100% { transform: translateY(60px); }
}

/* --- UI ELEMENTS --- */
#scroll-progress {
    position: fixed; top: 0; left: 0; width: 0%; height: 3px;
    background: var(--accent-color); z-index: 2000;
    box-shadow: 0 0 10px var(--accent-color), 0 0 20px var(--accent-color);
    will-change: width;
    transform: translateZ(0);
}

#back-to-top {
    position: fixed; bottom: 30px; right: 30px; width: 50px; height: 50px;
    background: rgba(10, 10, 10, 0.8); border: 1px solid var(--accent-color);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 1001; opacity: 0; visibility: hidden;
    transition: var(--transition); backdrop-filter: blur(5px);
    transform: translateZ(0);
}

#back-to-top svg { width: 24px; height: 24px; stroke: var(--accent-color); stroke-width: 2.5; fill: none; transition: 0.3s; }
#back-to-top:hover { background: var(--accent-color); box-shadow: 0 0 20px var(--accent-glow); }
#back-to-top:hover svg { stroke: #000; }
#back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }

/* --- NAVEGACIÓN --- */
nav {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1.2rem 6%; position: fixed; width: 100%; top: 0;
    background: rgba(5, 5, 5, 0.85); backdrop-filter: blur(20px); /* Pesado en móvil, ajustado abajo */
    z-index: 1000; border-bottom: 1px solid var(--border-color);
    transition: 0.3s;
    will-change: background-color, transform;
}

.logo-container {
    display: flex; align-items: center; gap: 12px;
    text-decoration: none; color: inherit;
}

.logo-icon {
    width: 40px; height: 40px; fill: var(--accent-color);
    filter: drop-shadow(0 0 5px var(--accent-color));
}

.logo-texts { display: flex; flex-direction: column; line-height: 1.1; }
.logo-title { font-weight: 900; font-size: 1.2rem; letter-spacing: 1px; color: #fff; text-transform: uppercase; }
.logo-subtitle { font-size: 0.6rem; letter-spacing: 2px; color: #888; font-weight: 700; text-transform: uppercase; }
.logo-title span { color: var(--accent-color); }

.nav-links { display: flex; gap: 2.5rem; }
.nav-links a { 
    font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1px;
    color: #888; text-decoration: none; transition: 0.3s; position: relative;
}
.nav-links a::after {
    content: ''; position: absolute; bottom: -5px; left: 0; width: 0; height: 2px;
    background: var(--accent-color); transition: 0.3s;
}
.nav-links a:hover { color: #fff; text-shadow: 0 0 10px rgba(255,255,255,0.5); }
.nav-links a:hover::after { width: 100%; }

.menu-btn { display: none; background: none; border: none; cursor: pointer; width: 30px; height: 20px; position: relative; z-index: 1002; }
.menu-btn span { display: block; width: 100%; height: 2px; background: #fff; position: absolute; transition: 0.3s; }
.menu-btn span:nth-child(1) { top: 0; }
.menu-btn span:nth-child(2) { top: 9px; }
.menu-btn span:nth-child(3) { top: 18px; }
.menu-btn.active span:nth-child(1) { transform: rotate(45deg); top: 9px; background: var(--accent-color); }
.menu-btn.active span:nth-child(2) { opacity: 0; }
.menu-btn.active span:nth-child(3) { transform: rotate(-45deg); top: 9px; background: var(--accent-color); }

/* --- HERO SECTION --- */
.hero { 
    min-height: 100vh; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    padding: 120px 5% 80px; 
    position: relative;
    overflow: hidden;
}

.hero-content { 
    max-width: 1000px; 
    width: 100%; 
    position: relative; z-index: 2; 
    text-align: center;
}

.badge { 
    display: inline-block; 
    background: rgba(204, 255, 0, 0.05); 
    color: var(--accent-color); 
    padding: 0.5rem 1.2rem; 
    border-radius: 50px; 
    font-size: 0.75rem; 
    margin-bottom: 1.5rem; 
    border: 1px solid rgba(204, 255, 0, 0.2);
    letter-spacing: 1px;
    box-shadow: 0 0 15px rgba(204, 255, 0, 0.1);
    animation: fadeInDown 0.8s ease-out;
    will-change: opacity, transform;
    backface-visibility: hidden;
}

.hero h1 { 
    font-size: clamp(2.5rem, 8vw, 5rem); 
    line-height: 1.1; 
    margin-bottom: 1.5rem; 
    text-transform: uppercase; 
    letter-spacing: -2px;
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
    will-change: opacity, transform;
}

.highlight { color: var(--accent-color); position: relative; display: inline-block; }
.highlight::before {
    content: ''; position: absolute; bottom: 10px; left: 0; width: 100%; height: 15px;
    background: var(--accent-color); opacity: 0.2; z-index: -1;
    transform: scaleX(0); transform-origin: left; animation: growLine 1s cubic-bezier(0.19, 1, 0.22, 1) 1s forwards;
}

@keyframes growLine { to { transform: scaleX(1); } }

.hero-description { 
    font-size: clamp(1rem, 2vw, 1.2rem); 
    color: var(--secondary-text); 
    max-width: 700px; 
    margin: 0 auto 2.5rem; 
    animation: fadeInUp 0.8s ease-out 0.4s backwards;
    will-change: opacity, transform;
}

.cta-container {
    display: flex; flex-direction: column; gap: 2rem; align-items: center;
    animation: fadeInUp 0.8s ease-out 0.6s backwards;
}

.cta-buttons { display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: center; }

.btn { 
    padding: 1rem 2.5rem; 
    border-radius: 4px; 
    font-weight: 700; 
    font-size: 0.85rem; 
    text-transform: uppercase; 
    letter-spacing: 1px;
    text-decoration: none; 
    transition: var(--transition);
    position: relative; overflow: hidden;
    z-index: 1;
    will-change: transform, box-shadow;
}

.btn-primary { 
    background: var(--accent-color); 
    color: #000; 
    box-shadow: 0 0 20px rgba(204, 255, 0, 0.2);
}

.btn-primary::before {
    content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
    transition: 0.5s; z-index: -1;
}

.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 10px 30px var(--accent-glow); }
.btn-primary:hover::before { left: 100%; }

.btn-secondary { 
    border: 1px solid rgba(255, 255, 255, 0.2); 
    color: #fff; 
    background: rgba(255,255,255,0.03);
    backdrop-filter: blur(5px); /* Reducido también */
}
.btn-secondary:hover { border-color: var(--accent-color); color: var(--accent-color); background: rgba(204, 255, 0, 0.05); }

.features-bar { 
    display: flex; gap: 2rem; flex-wrap: wrap; justify-content: center; margin-top: 1rem;
    opacity: 0.7;
}

.feature { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; font-weight: 600; color: #aaa; text-transform: uppercase; }
.feature svg { width: 16px; height: 16px; stroke: var(--accent-color); stroke-width: 2; fill: none; }

/* --- CARDS --- */
.card-wrap {
    position: relative;
    transform-style: preserve-3d;
    perspective: 1000px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.1s ease-out; 
    backdrop-filter: blur(12px); /* Muy pesado, pero visualmente clave */
    -webkit-backdrop-filter: blur(12px);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    transform: translateZ(0); /* GPU acceleration */
    backface-visibility: hidden;
}

.card::before {
    content: "";
    position: absolute;
    height: 100%;
    width: 100%;
    top: 0; left: 0;
    border-radius: 16px;
    background: radial-gradient(
        800px circle at var(--mouse-x) var(--mouse-y),
        rgba(255, 255, 255, 0.06),
        transparent 40%
    );
    z-index: 1;
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
}

.card::after {
    content: "";
    position: absolute;
    height: 100%;
    width: 100%;
    top: 0; left: 0;
    border-radius: 16px;
    background: radial-gradient(
        600px circle at var(--mouse-x) var(--mouse-y),
        var(--accent-color),
        transparent 40%
    );
    z-index: 0;
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
    mask-image: linear-gradient(#fff 0 0); 
    -webkit-mask-image: linear-gradient(#fff 0 0);
    mask-composite: exclude; 
    -webkit-mask-composite: xor;
}

.card-content { position: relative; z-index: 2; height: 100%; display: flex; flex-direction: column; }

.card-wrap:hover .card::before { opacity: 1; }
.card-wrap:hover .card::after { opacity: 0.3; }

/* --- SECCIONES --- */
section { padding: 100px 5%; max-width: 1300px; margin: 0 auto; position: relative; }

.section-header { 
    margin-bottom: 4rem; 
    position: relative; 
    display: inline-block;
}

.section-header h2 { 
    font-size: clamp(2rem, 5vw, 3rem); 
    text-transform: uppercase; 
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1;
}

/* Grid Layouts */
.portfolio-grid, .services-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 30px; 
}

/* --- PORTAFOLIO --- */
.work-item { 
    position: relative; 
    aspect-ratio: 4/3; 
    border-radius: 16px; 
    overflow: hidden; 
    background: #111;
}

.work-img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    display: block; 
    transition: transform 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); 
    transform: translateZ(0);
}

.work-overlay {
    position: absolute; bottom: 0; left: 0; width: 100%;
    padding: 2rem; 
    background: linear-gradient(to top, #000 0%, transparent 100%);
    z-index: 2;
    transform: translateY(20px);
    opacity: 0.9;
    transition: 0.5s;
}

.work-item:hover .work-img { transform: scale(1.1); }
.work-item:hover .work-overlay { transform: translateY(0); opacity: 1; }
.work-item h3 { font-size: 1.5rem; margin-bottom: 0.5rem; color: #fff; }
.work-item p { color: var(--accent-color); font-size: 0.9rem; font-weight: 600; text-transform: uppercase; }

/* --- SERVICIOS --- */
.service-icon { 
    width: 50px; height: 50px; 
    background: rgba(204, 255, 0, 0.1); 
    border-radius: 12px; 
    display: flex; align-items: center; justify-content: center; 
    margin-bottom: 1.5rem; 
    color: var(--accent-color);
    border: 1px solid rgba(204, 255, 0, 0.2);
    transition: 0.3s;
}

.service-card:hover .service-icon { 
    background: var(--accent-color); 
    color: #000; 
    box-shadow: 0 0 15px var(--accent-glow);
}

.service-card h3 { font-size: 1.3rem; margin-bottom: 1rem; font-weight: 700; }
.service-card p { color: #aaa; font-size: 0.95rem; line-height: 1.6; flex-grow: 1; }

/* --- FOOTER --- */
footer { 
    padding: 100px 5% 50px; 
    text-align: center; 
    border-top: 1px solid var(--border-color);
    background: linear-gradient(to top, #000, transparent);
    position: relative;
}

.footer-content h2 { font-size: clamp(2rem, 5vw, 3rem); margin-bottom: 1.5rem; }
.footer-content p { color: #888; margin-bottom: 2.5rem; font-size: 1.1rem; }

.footer-cta {
    display: inline-flex; align-items: center; justify-content: center; gap: 12px;
    padding: 1.2rem 3rem;
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    font-family: var(--font-display);
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 4px;
    transition: 0.3s;
    position: relative;
    overflow: hidden;
}

.footer-cta:hover {
    background: var(--accent-color);
    color: #000;
    box-shadow: 0 0 40px var(--accent-glow);
}

.copyright {
    margin-top: 5rem; color: #444; font-size: 0.8rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 1px;
}

/* --- ANIMATIONS --- */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-30px); } to { opacity: 1; transform: translateY(0); } }

.reveal {
    opacity: 0; transform: translateY(40px);
    transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
}
.reveal.active { opacity: 1; transform: translateY(0); }

/* --- RESPONSIVE (OPTIMIZADO MÁXIMO) --- */
@media (max-width: 768px) {
    html { scroll-padding-top: 70px; }
    
    /* 1. DESACTIVAR ANIMACIÓN DE FONDO EN MÓVIL (Ahorra mucha CPU) */
    .bg-grid {
        animation: none; 
        opacity: 0.3; /* Hacerlo más sutil */
    }
    
    /* 2. REDUCIR BLUR (Glassmorphism pesado) */
    nav { backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
    .card { backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
    
    .menu-btn { display: block; }
    .nav-links { 
        position: fixed; right: -100%; top: 0; width: 85%; height: 100vh; 
        background: rgba(5, 5, 5, 0.98); flex-direction: column; 
        justify-content: center; align-items: center;
        transition: 0.4s cubic-bezier(0.77, 0, 0.175, 1); 
        backdrop-filter: blur(20px); z-index: 1001;
        border-left: 1px solid var(--border-color);
    }
    .nav-links.active { right: 0; }
    .nav-links { gap: 2rem; }
    
    section { padding: 60px 5%; } 
    .hero-content { text-align: left; }
    .cta-container { align-items: flex-start; }
    .cta-buttons { flex-direction: column; width: 100%; gap: 1rem; }
    .btn { width: 100%; text-align: center; display: flex; justify-content: center; }
    .features-bar { justify-content: flex-start; }
    
    .card { padding: 1.5rem; }
    .work-item { height: auto; aspect-ratio: 16/9; }
    .portfolio-grid, .services-grid { gap: 20px; }
    .footer-content h2 { font-size: 2rem; }
}

/* --- BOTÓN WHATSAPP --- */
.whatsapp-float {
    position: fixed;
    bottom: 30px; left: 30px;
    width: 55px; height: 55px;
    background: rgba(5, 5, 5, 0.8);
    backdrop-filter: blur(5px); /* Reducido */
    border: 1px solid #25D366;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 0 15px rgba(37, 211, 102, 0.2);
    animation: pulse-whatsapp 2s infinite;
    will-change: transform, box-shadow;
}

.whatsapp-float:hover {
    background: #25D366;
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 0 25px rgba(37, 211, 102, 0.6);
}
.whatsapp-float:hover svg { fill: #ffffff; stroke: none; }
.whatsapp-float svg { width: 28px; height: 28px; fill: #25D366; stroke: none; transition: 0.3s; }

@keyframes pulse-whatsapp {
    0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

@media (max-width: 768px) {
    .whatsapp-float { bottom: 20px; left: 20px; width: 45px; height: 45px; }
    .whatsapp-float svg { width: 22px; height: 22px; }
    footer { padding-bottom: 80px; }
}