/* ---- VARIABLES Y CONFIGURACIÓN BASE ---- */
:root {
    --bg-dark: #0a0a0c;
    --bg-card: #121217;
    --neon-blue: #00f0ff;
    --neon-purple: #9d4edd;
    --neon-gold: #ffb703;
    --text-main: #e2e8f0;
    --text-muted: #8a99ad;
    --font-cyber: 'Fira Code', Consolas, Monaco, monospace;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

/* Skip to content link */
.skip-link {
    position: absolute;
    left: -999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
.skip-link:focus {
    left: 20px;
    top: 18px;
    width: auto;
    height: auto;
    padding: 8px 12px;
    background: rgba(0,0,0,0.7);
    color: var(--text-main);
    border-radius: 6px;
    z-index: 11000;
}

/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
    .loader-bars span { display: none; }
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-cyber);
    overflow-x: hidden;
    position: relative;
}

/* Canvas del Fondo */
#cyber-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    opacity: 0.15;
}

/* ---- NAVBAR ---- */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 50px;
    background: rgba(10, 10, 12, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 240, 255, 0.1);
    z-index: 100;
}

.logo {
    font-weight: bold;
    font-size: 1.3rem;
    color: var(--neon-blue);
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.95rem;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--neon-blue);
    text-shadow: 0 0 8px var(--neon-blue);
}

/* ---- HERO SECTION ---- */
.hero-section {
    height: 100vh;
    display: flex;
    align-items: center;
    padding: 0 10%;
    position: relative;
}

.hero-content h1 {
    font-size: 3.5rem;
    margin: 10px 0;
}

.neon-text {
    color: var(--neon-blue);
    text-shadow: 0 0 15px rgba(0, 240, 255, 0.7), 0 0 30px rgba(0, 240, 255, 0.3);
}

.hero-desc {
    max-width: 600px;
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 30px;
    line-height: 1.6;
}

/* Botones Futuristas */
.hero-buttons {
    display: flex;
    gap: 20px;
}

.btn {
    padding: 12px 30px;
    font-family: var(--font-cyber);
    text-decoration: none;
    font-weight: bold;
    border-radius: 4px;
    transition: var(--transition);
    position: relative;
}

.btn-primary {
    background: transparent;
    color: var(--neon-blue);
    border: 1px solid var(--neon-blue);
    box-shadow: inset 0 0 10px rgba(0, 240, 255, 0.2), 0 0 10px rgba(0, 240, 255, 0.2);
}

.btn-primary:hover {
    background: var(--neon-blue);
    color: var(--bg-dark);
    box-shadow: 0 0 20px var(--neon-blue);
}

.btn-secondary {
    background: transparent;
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    border-color: var(--neon-purple);
    color: var(--neon-purple);
    box-shadow: 0 0 15px var(--neon-purple);
}

/* ---- SECCIONES GENERALES ---- */
.section {
    padding: 100px 10%;
}

.section-title {
    font-size: 2rem;
    margin-bottom: 50px;
    color: var(--neon-purple);
    text-shadow: 0 0 10px rgba(157, 78, 221, 0.5);
}

/* Tarjetas */
.about-card, .contact-card {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    position: relative;
}

.about-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 3px;
    background: linear-gradient(90deg, var(--neon-blue), var(--neon-purple));
}

.about-card p {
    color: var(--text-muted);
    line-height: 1.8;
    margin: 20px 0;
}

.soft-skills {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.skill-tag {
    background: rgba(0, 240, 255, 0.05);
    border: 1px solid rgba(0, 240, 255, 0.3);
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--neon-blue);
}

/* Tech Stack alignment */
.skills-container {
    display: flex;
    justify-content: center;
}
.skills-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: rgba(18, 18, 23, 0.6);
    padding: 30px;
    border-radius: 12px;
    border: 1px solid rgba(0, 240, 255, 0.1);
}
.skills-grid img {
    max-width: 100%;
    height: auto;
}

/* ---- TIMELINE DE LOGROS ---- */
.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.timeline::before {
    content: '';
    position: absolute;
    width: 2px;
    background: rgba(255,255,255,0.1);
    top: 0; bottom: 0; left: 30px;
}

.timeline-item {
    position: relative;
    margin-bottom: 40px;
    padding-left: 80px;
}

.timeline-badge {
    position: absolute;
    left: 12px;
    width: 36px;
    height: 36px;
    background: var(--bg-card);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--text-muted);
}

.timeline-badge.gold { border-color: var(--neon-gold); color: var(--neon-gold); }
.timeline-badge.silver { border-color: #cbd5e1; color: #cbd5e1; }
.timeline-badge.cyber { border-color: var(--neon-blue); color: var(--neon-blue); }

.timeline-content {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.03);
}

.timeline-content h3 {
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.timeline-content p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ---- CONTACTO Y REDES ---- */
.contact-card {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    border: 1px solid rgba(0, 240, 255, 0.2);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.05);
}

.contact-card p {
    margin: 20px 0;
    color: var(--text-muted);
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin: 30px 0;
}

.social-links a {
    color: var(--text-main);
    font-size: 1.8rem;
    transition: var(--transition);
}

.social-links a:hover {
    color: var(--neon-blue);
    transform: translateY(-5px);
    text-shadow: 0 0 15px var(--neon-blue);
}

.terminal-footer {
    background: #000;
    padding: 10px;
    font-size: 0.85rem;
    border-radius: 4px;
    color: #39ff14; /* Verde terminal */
    text-align: left;
}

.blink {
    animation: blinker 1s linear infinite;
}

.main-footer {
    text-align: center;
    padding: 30px;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(255,255,255,0.05);
}

/* ---- ANIMACIONES CLAVE ---- */
@keyframes blinker {
    50% { opacity: 0; }
}

/* Efecto Glitch */
.glitch {
    position: relative;
    font-size: 0.9rem;
    letter-spacing: 3px;
    color: var(--neon-purple);
    font-weight: bold;
}

.glitch::before, .glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-dark);
}

.glitch::before {
    left: 2px;
    text-shadow: -1px 0 var(--neon-blue);
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -1px 0 var(--neon-purple);
    clip: rect(85px, 450px, 140px, 0);
    animation: glitch-anim2 5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% { clip: rect(31px, 9999px, 94px, 0); }
    10% { clip: rect(112px, 9999px, 76px, 0); }
    /* Agrega más fotogramas si deseas mayor distorsión */
    100% { clip: rect(67px, 9999px, 125px, 0); }
}

@keyframes glitch-anim2 {
    0% { clip: rect(76px, 9999px, 116px, 0); }
    11% { clip: rect(23px, 9999px, 98px, 0); }
    100% { clip: rect(122px, 9999px, 43px, 0); }
}

/* ---- MENU MÓVIL (HAMBURGUESA) ---- */
.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
}
.menu-toggle .bar {
    display: block;
    width: 24px;
    height: 3px;
    margin: 4px 0;
    background: var(--text-main);
    border-radius: 3px;
    transition: transform 0.35s ease, opacity 0.35s ease;
}
.menu-toggle.open .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.open .bar:nth-child(2) { opacity: 0; }
.menu-toggle.open .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-links.open {
    display: flex !important;
    flex-direction: column;
    position: absolute;
    top: 70px;
    right: 20px;
    background: linear-gradient(180deg, rgba(18,18,23,0.95), rgba(10,10,12,0.9));
    padding: 18px;
    gap: 12px;
    border-radius: 10px;
    width: calc(100% - 40px);
    max-width: 320px;
    box-shadow: 0 10px 35px rgba(0,0,0,0.6);
    border: 1px solid rgba(0,240,255,0.06);
    animation: mobileMenuIn 300ms cubic-bezier(.22,.9,.28,1);
}

@keyframes mobileMenuIn {
    from { transform: translateY(-6px) scale(.98); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

/* ---- UTILS: ANIMACIONES AL SCROLL ---- */
.anim-item { opacity: 0; transform-origin: center; transition: opacity 700ms cubic-bezier(.2,.9,.3,1), transform 700ms cubic-bezier(.2,.9,.3,1); }
.anim-item.in-view { opacity: 1; transform: none; }

/* Orígenes variados */
.from-left { transform: translateX(-80px) rotate(-6deg) scale(.98); }
.from-right { transform: translateX(80px) rotate(6deg) scale(.98); }
.from-top { transform: translateY(-60px) rotate(-3deg) scale(.98); }
.from-bottom { transform: translateY(60px) rotate(3deg) scale(.98); }
.spin-in { transform: translateY(10px) rotate(-90deg) scale(.8); }
.pop-in { transform: scale(.6) translateY(10px); }

/* Cuando estén visibles, añadimos un brillo extra para impacto (opcional) */
/* La clase `.glow-on-view` puede aplicarse a elementos específicos para evitar contenedores cuadrados visibles. */
.glow-on-view.in-view { box-shadow: 0 12px 30px rgba(157,78,221,0.06), 0 0 30px rgba(0,240,255,0.02); }

/* Pequeñas mejoras responsivas */
@media (max-width: 900px) {
    .navbar { padding: 16px 22px; }
    .hero-section { padding: 0 6%; }
}

@media (max-width: 768px) {
    .nav-links { display: none; }
    .menu-toggle { display: block; }
    .nav-links a { font-size: 1rem; }
    .hero-content h1 { font-size: 2.2rem; }
    .hero-content h2 { font-size: 1rem; }
    .section { padding: 60px 6%; }
}

/* ---- INTRO OVERLAY (WOW) ---- */
.intro-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(1200px 600px at 10% 10%, rgba(157,78,221,0.12), transparent 10%), radial-gradient(1000px 500px at 90% 90%, rgba(0,240,255,0.06), transparent 12%), linear-gradient(180deg,#07070a 0%, #0b0b10 100%);
    z-index: 9999;
    backdrop-filter: blur(6px);
    color: var(--text-main);
    overflow: hidden;
}
.intro-inner { text-align: center; transform: translateY(0); }
.intro-logo {
    color: var(--neon-blue);
    font-weight: 800;
    letter-spacing: 2px;
    font-size: 1.05rem;
    text-shadow: 0 0 18px rgba(0,240,255,0.45);
    opacity: 0;
    transform: translateY(-8px) scale(.98);
    animation: intro-logo 700ms cubic-bezier(.2,.9,.3,1) 120ms forwards;
}
.intro-title {
    font-size: 3.4rem;
    margin-top: 14px;
    color: white;
    letter-spacing: 6px;
    opacity: 0;
    transform: translateY(18px) scale(.9) rotate(-6deg);
    animation: intro-title 900ms cubic-bezier(.2,.9,.3,1) 280ms forwards;
    text-shadow: 0 6px 40px rgba(157,78,221,0.18), 0 0 40px rgba(0,240,255,0.06);
}
.intro-sub {
    margin-top: 10px;
    color: var(--text-muted);
    opacity: 0;
    transform: translateY(12px);
    animation: intro-sub 700ms ease 520ms forwards;
}
.loader-bars { display:flex; gap:10px; justify-content:center; margin-top:26px; }
.loader-bars span { display:block; width:12px; height:36px; background:linear-gradient(180deg,var(--neon-blue), var(--neon-purple)); border-radius:4px; opacity:0.9; transform:scaleY(.2); }
.loader-bars span:nth-child(1) { animation: loader 900ms cubic-bezier(.2,.9,.3,1) 320ms infinite; }
.loader-bars span:nth-child(2) { animation: loader 900ms cubic-bezier(.2,.9,.3,1) 380ms infinite; }
.loader-bars span:nth-child(3) { animation: loader 900ms cubic-bezier(.2,.9,.3,1) 440ms infinite; }

@keyframes loader {
    0% { transform: scaleY(.2); opacity:.4 }
    50% { transform: scaleY(1.15); opacity:1 }
    100% { transform: scaleY(.2); opacity:.4 }
}

@keyframes intro-logo {
    to { opacity:1; transform: translateY(0) scale(1); }
}
@keyframes intro-title {
    to { opacity:1; transform: translateY(0) scale(1) rotate(0); }
}
@keyframes intro-sub { to { opacity:1; transform: translateY(0); } }

.intro-overlay.intro-hide { animation: intro-fadeout 600ms ease forwards; }
@keyframes intro-fadeout { to { opacity: 0; visibility: hidden; transform: scale(.995); } }

.skip-intro { position: absolute; bottom: 28px; right: 28px; background: transparent; border: 1px solid rgba(255,255,255,0.06); color: var(--text-muted); padding:8px 12px; border-radius:6px; cursor:pointer; }

/* Evitar que la intro afecte layout en móviles (menú etc.) */
@media (max-width: 600px) {
    .intro-title { font-size: 1.8rem; letter-spacing: 3px; }
    .intro-sub { font-size: .95rem; }
}