/* --- 1. VARIABLES & RESET --- */
:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --accent: #ff9800;
    --accent-hover: #fb8c00;
    --header-height: 70px;
    --font-main: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-snap-type: y mandatory;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Para bloquear el scroll mientras carga la terminal */
body.loading {
    overflow: hidden;
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.3s;
}

ul {
    list-style: none;
}

/* --- 2. LAYOUT & UTILS --- */
.container {
    max-width: 1200px;
    width: 90%;
    margin: 0 auto;
    padding: 0 20px;
}

section {
    min-height: 100vh;
    scroll-snap-align: start;
    scroll-margin-top: var(--header-height);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 0;
}

h2 {
    font-size: 2.5rem;
    margin-bottom: 40px;
    text-align: center;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.hidden {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

.show {
    opacity: 1;
    transform: translateY(0);
}

/* --- 3. HEADER --- */
header {
    position: fixed;
    top: 0;
    width: 100%;
    height: var(--header-height);
    background: rgba(18, 18, 18, 0.95);
    backdrop-filter: blur(5px);
    z-index: 1000;
    border-bottom: 1px solid #333;
    align-content: center;
}

nav {
    display: flex;
    justify-content: space-between;
    height: 100%;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent);
}

.blinking-text {
    animation: blinker 1s linear infinite;
    color: white;
    font-weight: 900;
}

@keyframes blinker {
    50% {
        opacity: 0;
    }
}

.nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-links a:hover {
    color: var(--accent);
}

/* --- 4. HERO SECTION --- */
.hero {
    position: relative;
    height: 100vh;
    scroll-margin-top: 0;
    overflow: hidden;
    background: radial-gradient(circle at center, #2a2a2a 0%, #121212 70%);
    align-items: center;
    text-align: center;
}

.hero-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

.hero-content.show {
    opacity: 1;
    transform: translateY(0);
}

.hero h1 {
    font-size: 4rem;
    margin-bottom: 10px;
}

.hero h1 span {
    color: var(--accent);
}

.hero p {
    font-size: 1.3rem;
    color: var(--text-muted);
    margin-bottom: 30px;
}

.btn {
    display: inline-block;
    padding: 12px 30px;
    background: transparent;
    border: 2px solid var(--accent);
    color: var(--accent);
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    max-width: 200px;
}

.btn:hover {
    background: var(--accent);
    color: #121212;
    box-shadow: 0 0 15px rgba(255, 152, 0, 0.4);
}

/* Animación Fondo Hero */
.bg-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.bg-animation span {
    position: absolute;
    display: block;
    width: 20px;
    height: 20px;
    background: rgba(255, 152, 0, 0.1);
    border-radius: 50%;
    bottom: -150px;
    animation: animate 10s linear infinite;
}

/* (Animación de burbujas resumida para limpieza, se mantiene igual) */
.bg-animation span:nth-child(1) {
    left: 10%;
    width: 30px;
    height: 30px;
    animation-delay: 0s;
    animation-duration: 12s;
}

.bg-animation span:nth-child(2) {
    left: 20%;
    width: 25px;
    height: 25px;
    animation-delay: 2s;
    animation-duration: 7s;
}

.bg-animation span:nth-child(3) {
    left: 25%;
    width: 40px;
    height: 40px;
    animation-delay: 4s;
    animation-duration: 10s;
}

.bg-animation span:nth-child(4) {
    left: 40%;
    width: 20px;
    height: 20px;
    animation-delay: 0s;
    animation-duration: 8s;
}

.bg-animation span:nth-child(5) {
    left: 55%;
    width: 35px;
    height: 35px;
    animation-delay: 5s;
    animation-duration: 15s;
}

.bg-animation span:nth-child(6) {
    left: 70%;
    width: 22px;
    height: 22px;
    animation-delay: 2s;
    animation-duration: 9s;
}

.bg-animation span:nth-child(7) {
    left: 80%;
    width: 28px;
    height: 28px;
    animation-delay: 6s;
    animation-duration: 11s;
}

.bg-animation span:nth-child(8) {
    left: 90%;
    width: 32px;
    height: 32px;
    animation-delay: 3s;
    animation-duration: 14s;
}

.bg-animation span:nth-child(9) {
    left: 15%;
    width: 27px;
    height: 27px;
    animation-delay: 1s;
    animation-duration: 13s;
}

.bg-animation span:nth-child(10) {
    left: 65%;
    width: 18px;
    height: 18px;
    animation-delay: 4s;
    animation-duration: 6s;
}

@keyframes animate {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        transform: translateY(-1000px) scale(1.2);
        opacity: 0;
    }
}

/* --- 5. ABOUT SECTION --- */
.about-card {
    position: relative;
    width: 100%;
    background: linear-gradient(rgba(30, 30, 30, 0.9), rgba(42, 42, 42, 0.95)),
        repeating-linear-gradient(45deg, #333 0, #333 1px, transparent 0, transparent 50%);
    background-size: 100% 100%, 10px 10px;
    border-radius: 30px;
    border: 1px solid #444;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 40px;
    margin-top: 80px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.bombal-img-container {
    position: absolute;
    bottom: 0;
    left: 50px;
    width: 350px;
    height: auto;
    z-index: 10;
}

.bombal-img-container img {
    width: 100%;
    display: block;
    filter: drop-shadow(0 0 50px rgba(255, 255, 255, 0.15));
    transform: scale(1.4) translateY(0%);
    transform-origin: bottom center;
}

.bombal-text-content {
    width: 55%;
    z-index: 5;
    padding-left: 20px;
}

.bombal-text-content h3 {
    font-size: 2.2rem;
    color: var(--accent);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 15px rgba(255, 152, 0, 0.3);
}

.bombal-text-content p {
    color: #bbb;
    font-size: 1.1rem;
    line-height: 1.7;
    margin-bottom: 15px;
}

.bombal-text-content strong {
    color: #fff;
    font-weight: 700;
}

.stats-mini {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #444;
    font-size: 0.9rem;
    color: #aaa;
    text-transform: uppercase;
    justify-content: space-around;
}

.social-buttons {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #444;
    gap: 15px;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    font-size: 1.5rem;
    color: #ccc;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    transition: 0.3s;
    border: 1px solid #444;
}

.social-btn:hover {
    background: var(--accent);
    color: #121212;
    border-color: var(--accent);
    transform: translateY(-3px);
}

/* --- 6. SKILLS SECTION --- */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.skill-card {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 10px;
    border: 1px solid transparent;
    transition: transform 0.3s, border-color 0.3s;
}

.skill-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
}

.skill-title {
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
    margin-bottom: 15px;
    color: #fff;
}

.skill-category {
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    display: block;
    margin-bottom: 5px;
}

.skill-group {
    margin-bottom: 15px;
}

.skill-tags span {
    display: inline-block;
    background: #333;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.85rem;
    margin: 5px 5px 0 0;
    color: var(--accent);
    border: 1px solid transparent;
    transition: transform 0.3s, border-color 0.3s;
}

.skill-tags span:hover {
    background: #444;
    border: 1px solid var(--accent);
    cursor: pointer;
    transform: translateY(-5px);
}

/* --- 7. PROJECTS SECTION --- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.project-card {
    background: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    border: 1px solid #333;
    transition: 0.3s;
}

.project-card:hover {
    border-color: var(--accent);
}

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.project-img-container {
    height: 180px;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #333;
}

.project-img-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.project-info {
    padding: 20px;
}

/* --- PAGINA DE PROYECTOS (Actualizado) --- */

.projects-page {
    width: 100%;
    max-width: 1200px;
    /* Limitamos el ancho para que no se deforme en pantallas gigantes */
    margin: 0 auto;
    /* Centrado */
    min-height: 80vh;
    display: flex;
    /* ESTA ES LA CLAVE DEL STICKY: */
    align-items: flex-start;
    gap: 40px;
    /* Espacio entre columnas */
    padding-bottom: 60px;
}

/* Columna Izquierda (Artículos) */
.col-articles {
    width: 65%;
    /* Ajustado para dar aire */
    display: flex;
    flex-direction: column;
    /* Quitamos el borde derecho duro, usaremos espacio negativo */
    border-right: 1px solid #222;
    padding-right: 30px;
}

.col-articles h2 {
    text-align: left;
    margin-left: 0;
    /* Corregido alineación */
    font-size: 1.5rem;
    margin-bottom: 30px;
    border-left: 3px solid var(--accent);
    padding-left: 15px;
}

/* Columna Derecha (Videos Sticky) */
.col-videos {
    width: 35%;
    display: flex;
    flex-direction: column;

    /* AQUÍ OCURRE LA MAGIA */
    position: sticky;
    top: 100px;
    /* 70px del header + 30px de aire */
    height: fit-content;
    /* Importante para que no se estire */
}

.col-videos h2 {
    text-align: left;
    font-size: 1.5rem;
    margin-bottom: 30px;
    color: #fff;
    /* Título blanco para diferenciar */
    border-left: 3px solid #555;
    padding-left: 15px;
}

.art-container {
    display: flex;
    flex-wrap: wrap;
    margin: 10px;
    justify-content: center;
}

/* Ajuste de la Card de Artículo */
.art-card {
    width: 48%;
    /* 2 columnas en lugar de 30% fijo para llenar mejor */
    margin-bottom: 30px;
    background: #161616;
    border: 1px solid #2a2a2a;
    /* Quitamos margin inline manual y usamos gap del flex container si fuera grid, 
       pero como es flex wrap: */
    margin: 1%;
}

.art-img-container {
    height: 200px;
    overflow: hidden;
    /* Para el zoom */
    position: relative;
}

.art-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;

    /* EFECTO SUAVE */
    filter: grayscale(60%) brightness(0.7);
    transition: all 0.5s ease;
}

/* Hover en la card completa activa la imagen */
.art-card:hover .art-img-container img {
    filter: grayscale(0%) brightness(1);
    transform: scale(1.05);
    /* Zoom sutil */
}

.art-card:hover {
    border-color: var(--accent);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transform: translateY(-5px);
}

.art-info {
    padding: 20px;
}

/* Contenedor de la lista */
.vid-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* El item de video (Ahora sin borde ni fondo pesado) */
.vid-card {
    display: flex;
    align-items: center;
    padding: 15px 10px;
    background: transparent;
    /* Fondo transparente */
    border: none;
    /* Sin bordes */
    border-bottom: 1px solid #222;
    /* Línea sutil separadora */
    transition: all 0.3s ease;
    border-radius: 5px;
}

.vid-card:hover {
    background: rgba(255, 255, 255, 0.03);
    /* Brillo muy sutil al pasar mouse */
    transform: translateX(10px);
    /* Pequeño movimiento a la derecha */
    cursor: pointer;
    border-bottom-color: var(--accent);
    /* La línea se pone naranja */
}

/* El icono de Play */
.playcircle {
    min-width: 35px;
    height: 35px;
    border-radius: 50%;
    background: transparent;
    border: 2px solid #444;
    /* Círculo gris fino */
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 1rem;
    padding-right: 5px;
    transition: 0.3s;
}

.vid-card:hover .playcircle {
    border-color: var(--accent);
    background: var(--accent);
    color: #000;
    transform: scale(1.0);
}

/* Textos */
.vid-cardText h4 {
    font-size: 1rem;
    color: #eee;
    margin-bottom: 4px;
    font-weight: 500;
}

.vid-cardText p {
    font-size: 0.85rem;
    color: #777;
    margin: 0;
}

.backtohome{
    display: none;
}
.backhome{
    margin: 0px 0;
    display: flex;
    justify-content: center;
    width: 100%;
}
.home-btn {
    background: transparent;
    border: 1px solid #444;
    color: #aaa;
    padding: 10px 30px;
    cursor: pointer;
    border-radius: 20px;
    transition: 0.3s;
    font-size: 1rem;
    display: inline-block;
}
.home-btn i{
    margin-right: 5px;
}
.home-btn:hover {
    background: var(--accent);
    color: #121212;
    border-color: var(--accent);
    font-weight: bold;
}
/* FIN PROJECTS */

.category-tag {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--accent);
    letter-spacing: 1px;
    display: block;
    margin-bottom: 5px;
}

.project-link {
    color: var(--accent);
    font-weight: bold;
    font-size: 0.9rem;
}

.center-btn {
    margin: 30px 0;
    display: flex;
    justify-content: center;
    width: 100%;
}

.filter-btn {
    background: transparent;
    border: 1px solid #444;
    color: #aaa;
    padding: 10px 30px;
    cursor: pointer;
    border-radius: 20px;
    transition: 0.3s;
    font-size: 0.9rem;
    display: inline-block;
}

.filter-btn:hover {
    background: var(--accent);
    color: #121212;
    border-color: var(--accent);
    font-weight: bold;
}

/* --- 8. FOOTER --- */
footer {
    background: #0a0a0a;
    border-top: 1px solid #333;
    scroll-snap-align: end;
    min-height: auto;
    padding: 40px 0;
    text-align: center;
    color: var(--text-muted);
    margin-top: 40px;
}

.social-footer {
    display: flex;
    gap: 30px;
    justify-content: center;
    width: 100%;
    margin-top: 20px;
}

/* --- INTRO TERMINAL --- */
#intro-terminal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #0a0a0a;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    font-family: 'Courier New', Courier, monospace;
    transition: opacity 0.8s ease-out, visibility 0.8s;
}

#intro-terminal.finished {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.terminal-window {
    width: 100%;
    max-width: 800px;
    color: var(--accent);
    font-size: 1.2rem;
    line-height: 1.5;
    text-shadow: 0 0 5px rgba(255, 152, 0, 0.5);
}

.cursor {
    display: inline-block;
    width: 10px;
    height: 20px;
    background-color: var(--accent);
    animation: blink 1s infinite;
    vertical-align: middle;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* --- IDIOMA TOGGLE --- */
.lang-switch {
    cursor: pointer;
    font-weight: bold;
    margin-left: 20px;
    color: #666;
    display: flex;
    gap: 5px;
}

.lang-btn {
    transition: 0.3s;
}

.lang-btn.active {
    color: var(--accent);
    text-decoration: underline;
}

.lang-btn:hover {
    color: #fff;
}

/* --- CV DROPDOWN --- */
.cv-dropdown-container {
    position: relative;
    display: inline-block;
}

.cv-trigger {
    background: transparent;
    color: var(--text-main);
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid var(--accent);
    border-radius: 15px;
    padding: 2px 15px;
    transition: 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.cv-trigger:hover {
    background: var(--accent);
    color: #121212;
}

.cv-menu {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #1e1e1e;
    min-width: 120px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.5);
    border: 1px solid #444;
    border-radius: 10px;
    z-index: 100;
    margin-bottom: 10px;
    overflow: hidden;
}

.cv-menu a {
    color: var(--text-main);
    padding: 10px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    text-align: center;
    transition: 0.2s;
}

.cv-menu a:hover {
    background-color: var(--accent);
    color: #121212;
}

.cv-dropdown-container:hover .cv-menu {
    display: block;
}

/* --- RESPONSIVE --- */
@media (max-width: 900px) {
    html {
        scroll-snap-type: none;
    }

    .about-card {
        flex-direction: column;
        margin-top: 0;
        padding: 30px 20px;
        text-align: center;
    }

    .about-card p {
        font-size: 15px;
    }

    .bombal-img-container {
        position: relative;
        width: 250px;
        left: auto;
        bottom: auto;
        margin: 0 auto 20px auto;
        border-radius: 50%;
        background-color: #1e1e1e;
        border: 4px solid var(--accent);
    }

    .bombal-img-container img {
        transform: scale(1);
        border-bottom-left-radius: 50%;
        border-bottom-right-radius: 50%;
    }

    .bombal-text-content {
        width: 100%;
        padding: 20px 0;
    }

    .bombal-text-content h3 {
        display: none;
    }

    .stats-mini {
        justify-content: center;
        flex-wrap: wrap;
    }

    .social-buttons {
        justify-content: center;
    }

    .cv-trigger {
        display: block;
    }

    .projects-page {
        flex-direction: column;
    }

    .col-articles,
    .col-videos {
        width: 100%;
        border-right: none;
        padding: 0 20px;
    }

    .col-videos {
        position: static;
        /* Desactiva el sticky en celular */
        margin-top: 50px;
    }

    .art-info  p{
        display: none;        
    }
    .art-card{
        min-width: 100%;
        margin: 10px;
    }
    .backtohome{
        position: fixed;
        display: flex;
        justify-content: center;
        align-items: center;
        bottom:100px;
        right: 30px;
        width: 70px;
        height: 70px;
        padding-right: 4px;
        border-radius: 50%;
        background-color: var(--accent);
        font: 3em sans-serif;
        color:#fff;
        
    }

}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.5rem;
    }

    .nav-links {
        display: none;
    }

    .hero-content {
        transform: translateY(0);
    }

}