/* ==========================================================================
   1. VARIABLES GLOBALES Y RESET
   ========================================================================== */
:root { 
    --bg-color: #000000; 
    --card-bg: #111111; 
    --accent: #00ff9d; 
    --accent-dim: rgba(0, 255, 157, 0.1); 
    --text-main: #ffffff; 
    --text-muted: #a0a0a0; 
    --font-mono: 'Fira Code', monospace; 
    --font-sans: 'Inter', sans-serif; 
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background-color: var(--bg-color); color: var(--text-main); font-family: var(--font-sans); line-height: 1.6; overflow-x: hidden; position: relative; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; position: relative; z-index: 1; }
.mono { font-family: var(--font-mono); color: var(--accent); }
section { margin-bottom: 120px; }

/* ==========================================================================
   2. FONDOS CYBERPUNK (GRID Y NIEBLA)
   ========================================================================== */
.cyber-grid-container { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; perspective: 800px; overflow: hidden; z-index: -2; background: #000; }
.cyber-fog { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(to bottom, #000 10%, transparent 80%); z-index: 2; pointer-events: none; }
.grid-layer { position: absolute; left: -50%; width: 200%; z-index: 1; }
.cyber-grid-vertical { top: 0; height: 100vh; background: linear-gradient(to right, transparent 0%, rgba(0, 255, 157, 0.2) 1px, transparent 2px); background-size: 150px 100%; transform: rotateX(60deg); transform-origin: bottom center; }
.cyber-grid-horizontal { top: -100vh; height: 300vh; background: linear-gradient(to bottom, transparent 0%, var(--accent) 1px, transparent 2px); background-size: 100% 120px; transform: rotateX(60deg); transform-origin: bottom center; animation: gridMove 40s linear infinite; box-shadow: 0 0 100px rgba(0, 255, 157, 0.15); }
.scanlines { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: repeating-linear-gradient(to bottom, transparent 0px, transparent 2px, rgba(0, 255, 157, 0.02) 3px, rgba(0, 255, 157, 0.02) 4px); pointer-events: none; z-index: 9999; }
#matrixCanvas { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 10000; background: black; cursor: pointer; }

@keyframes gridMove { 0% { transform: rotateX(60deg) translateY(0); } 100% { transform: rotateX(60deg) translateY(120px); } }

/* ==========================================================================
   3. BOOT PRELOADER
   ========================================================================== */
#boot-preloader { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: #030303; z-index: 99999; display: flex; flex-direction: column; justify-content: center; padding: 5vw; font-family: var(--font-mono); transition: opacity 0.6s ease, visibility 0.6s ease; }
#boot-preloader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-terminal { max-width: 800px; width: 100%; color: var(--accent); font-size: clamp(0.8rem, 2vw, 1.1rem); line-height: 1.6; }
.boot-line { margin-bottom: 8px; text-shadow: 0 0 5px rgba(0, 255, 157, 0.5); }
.boot-line.error { color: #ff5f56; text-shadow: 0 0 5px rgba(255, 95, 86, 0.5); }
.boot-line.system { color: #8be9fd; text-shadow: 0 0 5px rgba(139, 233, 253, 0.5); }
.boot-cursor { display: inline-block; width: 10px; height: 1.2em; background-color: var(--accent); animation: blink 1s step-end infinite; vertical-align: bottom; margin-left: 5px; }

/* ==========================================================================
   4. NAVEGACIÓN Y HERO SECTION
   ========================================================================== */
nav { padding: 30px 0; display: flex; justify-content: space-between; align-items: center; }
.logo-img { height: 85px; width: auto; display: block; object-fit: contain; }
.status-badge { font-size: 0.8rem; border: 1px solid #333; padding: 5px 12px; border-radius: 20px; background: rgba(255,255,255,0.05); display: flex; align-items: center; gap: 8px; white-space: nowrap; backdrop-filter: blur(5px); }
.status-dot { width: 8px; height: 8px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 10px var(--accent); }
.status-dot.sleep { background: #ffbd2e; box-shadow: 0 0 10px #ffbd2e; }

.hero { min-height: 80vh; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.hero h1 { font-size: clamp(2.5rem, 5vw, 4.5rem); line-height: 1.1; margin-bottom: 20px; font-weight: 700; }
.hero p.subtitle { color: var(--text-muted); max-width: 600px; font-size: 1.1rem; margin-bottom: 30px;}
.typing-container { min-height: 1.6em; display: flex; align-items: center; margin-bottom: 10px; }
.cursor-blink { display: inline-block; width: 10px; height: 1.2em; background-color: var(--accent); margin-left: 5px; animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

.cta-btn { padding: 15px 30px; background: rgba(0,0,0,0.5); border: 1px solid var(--accent); color: var(--accent); font-family: var(--font-mono); text-decoration: none; transition: 0.3s; font-weight: 600; backdrop-filter: blur(5px); }
.cta-btn:hover { background: var(--accent); color: var(--bg-color); box-shadow: 0 0 20px var(--accent-dim); }

/* UTILIDADES: ANIMACIONES DE REVELADO Y GLITCH */
.reveal { opacity: 0; transform: translateY(30px); transition: all 0.8s ease-out; }
.reveal.active { opacity: 1; transform: translateY(0); }
.section-title { font-family: var(--font-mono); margin-bottom: 40px; font-size: 1.2rem; display: block; border-left: 3px solid var(--accent); padding-left: 15px; }

.glitch-text { position: relative; display: inline-block; cursor: crosshair; }
.glitch-text::before, .glitch-text::after { content: attr(data-text); position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 0.1s; }
.glitch-text::before { left: 3px; text-shadow: -2px 0 #ff00c1; background: transparent; clip-path: inset(20% 0 80% 0); animation: glitch-anim-1 2s infinite linear alternate-reverse; }
.glitch-text::after { left: -3px; text-shadow: -2px 0 #00fff9; background: transparent; clip-path: inset(80% 0 20% 0); animation: glitch-anim-2 2.5s infinite linear alternate-reverse; }
.glitch-text:hover::before, .glitch-text:hover::after { opacity: 1; }

@keyframes glitch-anim-1 { 0% { clip-path: inset(20% 0 80% 0); } 20% { clip-path: inset(60% 0 10% 0); } 40% { clip-path: inset(40% 0 50% 0); } 60% { clip-path: inset(80% 0 5% 0); } 80% { clip-path: inset(10% 0 70% 0); } 100% { clip-path: inset(30% 0 50% 0); } }
@keyframes glitch-anim-2 { 0% { clip-path: inset(10% 0 60% 0); } 20% { clip-path: inset(30% 0 20% 0); } 40% { clip-path: inset(70% 0 10% 0); } 60% { clip-path: inset(20% 0 50% 0); } 80% { clip-path: inset(50% 0 30% 0); } 100% { clip-path: inset(5% 0 80% 0); } }

/* ==========================================================================
   5. COMPONENTES DE TERMINAL Y JSON
   ========================================================================== */
.terminal-window { background: rgba(10, 10, 10, 0.95); border: 1px solid #333; border-radius: 6px; box-shadow: 0 20px 50px rgba(0,0,0,0.5); font-family: var(--font-mono); overflow: hidden; max-width: 800px; }
.terminal-header { background: #1a1a1a; padding: 10px 15px; display: flex; gap: 8px; border-bottom: 1px solid #333; align-items: center; }
.dot { width: 12px; height: 12px; border-radius: 50%; } .red { background: #ff5f56; } .yellow { background: #ffbd2e; } .green { background: #27c93f; }
.terminal-body { padding: 25px; font-size: 0.95rem; color: #ccc; line-height: 1.8; }
.cmd { color: var(--accent); }

.crt-screen { position: relative; background: rgba(5, 10, 5, 0.95); box-shadow: 0 0 30px rgba(0, 255, 157, 0.1), inset 0 0 20px rgba(0,0,0,0.8); }
.crt-screen::after { content: " "; display: block; position: absolute; top: 0; left: 0; bottom: 0; right: 0; background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%); background-size: 100% 4px; z-index: 2; pointer-events: none; }

.json-code { display: block; font-family: var(--font-mono); font-size: 0.95rem; line-height: 1.7; text-shadow: 0 0 3px rgba(255,255,255,0.2); position: relative; z-index: 3; white-space: pre-wrap; word-break: break-word; overflow-wrap: break-word; }
.json-code .key { color: #8be9fd; font-weight: 600; }
.json-code .string { color: #f1fa8c; }
.json-code .boolean { color: #ff79c6; font-weight: bold; }

/* ==========================================================================
   6. SERVICIOS (TARJETAS 3D FLIP)
   ========================================================================== */
.services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 2rem; margin-top: 30px; perspective: 1000px; }
.service-flip-card { background: transparent; width: 100%; min-height: 260px; cursor: crosshair; }
.service-flip-inner { position: relative; width: 100%; height: 100%; text-align: center; transition: transform 0.7s cubic-bezier(0.4, 0.2, 0.2, 1); transform-style: preserve-3d; }
.service-flip-card:hover .service-flip-inner { transform: rotateY(180deg); }
.service-flip-front, .service-flip-back { position: absolute; top: 0; left: 0; width: 100%; height: 100%; backface-visibility: hidden; border-radius: 4px; padding: 2rem; display: flex; flex-direction: column; border: 1px solid #222; }

.service-flip-front { background: rgba(17, 17, 17, 0.8); backdrop-filter: blur(5px); justify-content: center; align-items: center; }
.service-flip-front .service-icon { color: var(--accent); margin-bottom: 20px; transition: transform 0.3s, filter 0.3s; }
.service-flip-card:hover .service-flip-front .service-icon { transform: scale(1.1); filter: drop-shadow(0 0 10px var(--accent)); }
.service-flip-front h3 { font-size: 1.2rem; }
.decode-tag { font-size: 0.65rem; color: var(--accent); margin-top: 15px; opacity: 0.7; }

.service-flip-back { background: rgba(5, 10, 5, 0.98); transform: rotateY(180deg); border-color: var(--accent); box-shadow: 0 0 20px rgba(0,255,157,0.1); justify-content: flex-start; align-items: flex-start; text-align: left; }
.service-flip-back h3 { color: var(--accent); font-size: 1.1rem; margin-bottom: 15px; border-bottom: 1px dashed #333; padding-bottom: 10px; width: 100%; font-family: var(--font-mono); }
.service-flip-back p { color: #ffffff; font-size: 0.95rem; line-height: 1.6; }

/* ==========================================================================
   7. ARSENAL Y PORTAFOLIO DE PROYECTOS
   ========================================================================== */
.stack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 15px; margin-top: 20px; position: relative; }
.stack-item { border: 1px solid #333; border-radius: 4px; padding: 15px; text-align: center; font-family: var(--font-mono); font-size: 0.8rem; background: rgba(20, 20, 20, 0.4); color: #aaa; position: relative; overflow: hidden; transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s; cursor: crosshair; }
.stack-item:hover { border-color: rgba(0, 255, 157, 0.5); transform: translateY(-3px); color: #fff; }
.stack-item.active-ping { border-color: var(--accent); box-shadow: 0 0 15px rgba(0, 255, 157, 0.3); color: #fff; transform: scale(1.05); background: rgba(0, 255, 157, 0.05); transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); }
.stack-item span { position: relative; z-index: 1; }

.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }
.card { background: rgba(17, 17, 17, 0.9); padding: 2rem; border-radius: 4px; border: 1px solid #222; transition: transform 0.2s, border-color 0.2s; display: flex; flex-direction: column; justify-content: space-between; backdrop-filter: blur(5px); }
.card:hover { transform: translateY(-5px); border-color: var(--accent); }
.card h3 { margin-bottom: 10px; font-size: 1.4rem; margin-top: 10px;}
.card p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 20px;}
.card-link { color: var(--text-main); text-decoration: none; border-bottom: 1px dotted var(--accent); font-family: var(--font-mono); font-size: 0.8rem; align-self: flex-start; cursor: pointer; transition: 0.3s;}
.card-link:hover { color: var(--accent); padding-left: 5px; }

.tech-stack { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.tech-badge { background: rgba(255,255,255,0.05); border: 1px solid #333; padding: 4px 10px; border-radius: 4px; font-size: 0.75rem; font-family: var(--font-mono); color: #ccc; }

/* ==========================================================================
   8. EQUIPO DIRECTIVO Y CONTACTO
   ========================================================================== */
.team-section { border: 1px dashed #333; padding: 30px; border-radius: 6px; background: rgba(10,10,10,0.5); display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 40px; }
.team-card { display: flex; gap: 20px; align-items: flex-start; }
.team-avatar { min-width: 80px; height: 80px; background: #111; border-radius: 50%; display: flex; justify-content: center; align-items: center; border: 2px solid var(--accent); font-size: 2rem; color: #fff; box-shadow: 0 0 15px rgba(0, 255, 157, 0.2); }

.contact-wrapper { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: start; }
form { display: flex; flex-direction: column; gap: 20px; }
input, textarea { background: rgba(0,0,0,0.3); border: none; border-bottom: 1px solid #333; padding: 15px 10px; color: #fff; font-family: var(--font-mono); font-size: 1rem; width: 100%; transition: 0.3s; }

/* Solo el form tiene el efecto escáner */
#contact-form input:focus, #contact-form textarea:focus { border-bottom-color: var(--accent); background: rgba(0, 255, 157, 0.05); box-shadow: inset 3px 0 0 var(--accent), inset -3px 0 0 var(--accent); outline: none; padding-left: 15px; }

.submit-btn { background: var(--accent); color: #000; border: none; padding: 15px; font-family: var(--font-mono); font-weight: bold; cursor: pointer; margin-top: 10px; transition: 0.3s; position: relative; overflow: hidden; }
.submit-btn:hover { color: transparent; transform: scale(1.02); }
.submit-btn:hover::before { content: ">> INICIANDO_TRANSMISIÓN_"; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: var(--text-main); color: #000; display: flex; align-items: center; justify-content: center; font-weight: 900; letter-spacing: 2px; animation: radar-flicker 0.3s infinite alternate; }
@keyframes radar-flicker { 0% { opacity: 0.8; } 100% { opacity: 1; text-shadow: 0 0 8px #000; } }

#form-status { font-family: var(--font-mono); font-size: 0.85rem; margin-top: 10px; display: none; padding: 10px; border-radius: 4px; }
#form-status.success { background: rgba(0, 255, 157, 0.1); color: var(--accent); border: 1px solid var(--accent); display: block; }
#form-status.error { background: rgba(255, 95, 86, 0.1); color: #ff5f56; border: 1px solid #ff5f56; display: block; }

/* ==========================================================================
   9. FOOTER, CONSOLA Y BOTONES ESPECIALES
   ========================================================================== */
.footer-console { background: linear-gradient(to bottom, rgba(0,255,157,0.02) 0%, #000 100%); border-top: 1px solid var(--accent); box-shadow: 0 -5px 20px rgba(0, 255, 157, 0.1); padding: 40px 0 20px; margin-top: 50px; font-family: var(--font-mono); font-size: 0.85rem; position: relative; z-index: 2; }
.console-output { color: #888; margin-bottom: 10px; max-height: 150px; overflow-y: auto; }
.console-input-line { display: flex; align-items: baseline; color: var(--accent); margin-bottom: 30px; }

/* Override estricto para el input de la consola (evita estilos del form) */
.console-input { background: transparent; border: none; color: #fff; font-family: var(--font-mono); font-size: 0.85rem; flex-grow: 1; outline: none; margin-left: 10px; padding: 0; line-height: 1; }
.console-input:focus { box-shadow: none !important; background: transparent !important; padding-left: 10px !important; }

#gameCanvas { border: 1px solid var(--accent); background: #000; display: none; margin: 20px auto; }

.cyber-footer-bar { border-top: 1px dashed #333; padding-top: 20px; display: flex; justify-content: space-between; align-items: center; font-size: 0.75rem; text-transform: uppercase; }
.footer-sys-info { display: flex; gap: 10px; color: #666; font-weight: 600; letter-spacing: 1px; }
.footer-sys-info .separator { color: #333; }
.footer-sys-info .status-ok { color: var(--accent); animation: pulse-glow 2s infinite; }
.footer-copyright { color: #888; transition: all 0.3s ease; cursor: crosshair; }
.footer-copyright:hover { color: #fff; text-shadow: 0 0 8px var(--accent); letter-spacing: 1px; }

/* SCROLLBAR Y SELECCIÓN */
::selection { background: var(--accent); color: #000; text-shadow: none; }
::-moz-selection { background: var(--accent); color: #000; text-shadow: none; }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #050505; border-left: 1px solid #111; }
::-webkit-scrollbar-thumb { background: #111; border: 1px solid var(--accent); border-radius: 4px; box-shadow: 0 0 10px var(--accent-dim); }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* BOTÓN COPIAR (Para modal o consola) */
.copy-btn { background: transparent; border: 1px dashed var(--accent); color: var(--accent); padding: 8px 15px; font-family: var(--font-mono); font-size: 0.8rem; cursor: pointer; transition: 0.3s; margin-top: 15px; display: inline-block; }
.copy-btn:hover { background: var(--accent-dim); text-shadow: 0 0 5px var(--accent); }

/* ==========================================================================
   10. MODALES (VENTANAS EMERGENTES)
   ========================================================================== */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(5px); z-index: 100000; display: flex; justify-content: center; align-items: center; opacity: 1; transition: opacity 0.3s ease; }
.modal-overlay.hidden { opacity: 0; pointer-events: none; }
.modal-box { width: 90%; max-width: 600px; border: 1px solid var(--accent); box-shadow: 0 0 50px rgba(0, 255, 157, 0.2); transform: scale(1); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.modal-overlay.hidden .modal-box { transform: scale(0.9); }

/* ==========================================================================
   11. LINTERNA MAGNÉTICA GLOBAL (CORREGIDO 3D)
   ========================================================================== */
.card, .terminal-window { position: relative; overflow: hidden; }
.service-flip-front, .service-flip-back { overflow: hidden; }

.stack-item::before, .card::before, .terminal-window::before, .service-flip-front::before, .service-flip-back::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle 150px at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(0, 255, 157, 0.12), transparent 100%);
    opacity: 0; transition: opacity 0.3s; pointer-events: none; z-index: 0;
}
.stack-item:hover::before, .card:hover::before, .terminal-window:hover::before, .service-flip-card:hover .service-flip-front::before, .service-flip-card:hover .service-flip-back::before { opacity: 1; }
.card > *, .terminal-header, .terminal-body, .service-flip-front > *, .service-flip-back > * { position: relative; z-index: 1; }

/* ==========================================================================
   12. RESPONSIVE DESIGN (MEDIA QUERIES)
   ========================================================================== */
@media (max-width: 768px) { 
    .contact-wrapper { grid-template-columns: 1fr; } 
    .team-section { grid-template-columns: 1fr; gap: 30px; } 
    .team-card { flex-direction: column; text-align: center; align-items: center; } 
}
@media (max-width: 600px) { 
    section { margin-bottom: 80px; } 
    .terminal-body { padding: 15px; font-size: 0.75rem; overflow-x: auto; } 
    .hero { min-height: 60vh; } 
    .hero h1 { font-size: 2.5rem; } 
    nav { padding: 20px 0; } 
    .logo-img { height: 55px; } 
    .status-badge { font-size: 0.65rem; padding: 4px 8px; max-width: 150px; overflow: hidden; } 
    .cyber-footer-bar { flex-direction: column; gap: 15px; text-align: center; }
}
.cyber-wa-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(10, 20, 15, 0.85); /* Fondo oscuro semitransparente */
    border: 1px solid #00D67D; /* Verde AppStack / Cyberpunk */
    padding: 12px 24px;
    color: #00D67D;
    font-family: 'Fira Code', 'Courier New', monospace; /* Fuente de consola */
    font-size: 15px;
    font-weight: bold;
    text-decoration: none;
    letter-spacing: 1px;
    z-index: 9999;
    backdrop-filter: blur(8px);
    
    /* Corte Cyberpunk en las esquinas */
    clip-path: polygon(15px 0, 100% 0, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0 100%, 0 15px);
    
    box-shadow: 0 0 15px rgba(0, 214, 125, 0.15);
    transition: all 0.3s ease;
    overflow: hidden;
  }

  .cyber-wa-btn:hover {
    background: rgba(0, 214, 125, 0.1);
    box-shadow: 0 0 25px rgba(0, 214, 125, 0.5), inset 0 0 10px rgba(0, 214, 125, 0.3);
    text-shadow: 0 0 8px #00D67D;
    transform: translateY(-4px); /* Se levanta un poco al pasar el mouse */
  }

  /* Línea de escaneo láser (Efecto Hover) */
  .cyber-wa-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -150%;
    width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 214, 125, 0.5), transparent);
    transform: skewX(-20deg);
    transition: 0s;
  }

  .cyber-wa-btn:hover::before {
    left: 200%;
    transition: 0.6s ease-in-out;
  }

  /* Ícono SVG */
  .wa-icon {
    width: 24px;
    height: 24px;
    fill: #00D67D;
    filter: drop-shadow(0 0 5px rgba(0, 214, 125, 0.5));
    transition: transform 0.3s ease;
  }
  
  .cyber-wa-btn:hover .wa-icon {
    transform: scale(1.1);
  }
  
  /* Parpadeo del guion bajo de consola */
  .wa-blink {
    animation: wa-blink-anim 1s step-end infinite;
  }
  
  @keyframes wa-blink-anim {
    50% { opacity: 0; }
  }
  
  /* Ajuste para celulares (Se hace un poco más pequeño para no estorbar) */
  @media (max-width: 768px) {
    .cyber-wa-btn {
      bottom: 20px;
      right: 20px;
      padding: 10px 16px;
      font-size: 13px;
    }
    .wa-icon {
      width: 20px;
      height: 20px;
    }
  }
