/* --- Importación de Fuentes y Variables Globales --- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

:root {
    --primary-color: #6a5acd; 
    --secondary-color: #f0f2f5;
    --dark-color: #1a1a1a;
    --light-color: #ffffff;
    --shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
}

/* --- Estilos Generales y Reseteo --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--secondary-color);
    color: var(--dark-color);
    line-height: 1.6;
}
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* --- Sección Hero con Efecto Parallax --- */
.hero {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: var(--light-color);
    position: sticky;
    top: 0;
    z-index: 0;
}
.video-background { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: -2; }
.video-background video { width: 100%; height: 100%; object-fit: cover; }
.hero::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: -1;
}
.hero-content { z-index: 1; transform-style: preserve-3d; }
.hero-content h1 {
    font-size: 4.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0px 1px 0px #ccc, 0px 2px 0px #c9c9c9, 0px 3px 0px #bbb, 0px 4px 0px #b9b9b9, 0px 5px 0px #aaa, 0px 6px 1px rgba(0,0,0,.1), 0px 0px 5px rgba(0,0,0,.1), 0px 1px 3px rgba(0,0,0,.3), 0px 3px 5px rgba(0,0,0,.2), 0px 5px 10px rgba(0,0,0,.25), 0px 10px 10px rgba(0,0,0,.2), 0px 20px 20px rgba(0,0,0,.15);
    transform: translateZ(40px);
    height: 70px; /* Altura fija para evitar saltos de layout */
    display: flex;
    align-items: center;
    justify-content: center;
}
.hero-content h2 {
    font-size: 1.8rem;
    font-weight: 300;
    text-shadow: 1px 1px 5px rgba(0,0,0,0.5);
    transform: translateZ(20px);
}

/* --- Efecto Máquina de Escribir con Cursor --- */
#typewriter {
    border-right: .1em solid var(--primary-color);
    white-space: nowrap;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
}
.typing-cursor { animation: blink-caret .75s step-end infinite; }
@keyframes blink-caret { from, to { border-color: transparent } 50% { border-color: var(--primary-color); } }

/* --- Control de Sonido --- */
#sound-control {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: rgba(0, 0, 0, 0.5);
    color: var(--light-color);
    border: 2px solid var(--light-color);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 1000;
    transition: background-color 0.3s, transform 0.3s;
}
#sound-control:hover { background-color: var(--primary-color); transform: scale(1.1); }

/* --- Contenido Principal --- */
.main-content {
    position: relative;
    z-index: 1;
    background-color: var(--secondary-color);
}

/* --- Sección de Proyectos con Animación 3D al Scroll --- */
.projects { padding: 80px 0; }
.section-title { text-align: center; font-size: 2.5rem; margin-bottom: 50px; font-weight: 600; }
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    perspective: 1000px; /* Perspectiva para las animaciones 3D de los hijos */
}

.project {
    background: var(--light-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transform-style: preserve-3d;
    /* Estado inicial (oculto) para la animación de scroll */
    opacity: 0;
    transform: translateY(100px) rotateX(-80deg);
    transform-origin: top center;
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

/* Estado final (visible) cuando se añade la clase 'is-visible' */
.project.is-visible {
    opacity: 1;
    transform: translateY(0) rotateX(0);
}

.project-image img { width: 100%; height: 220px; object-fit: cover; display: block; }
.project-content { padding: 25px; transform: translateZ(20px); }
.project-content h3 { font-size: 1.5rem; margin-bottom: 10px; }
.project-content p { font-size: 1rem; color: #555; margin-bottom: 20px; }
.project-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
    background-color: var(--primary-color);
    color: var(--light-color);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.projects-button { text-align: center; margin-top: 50px; }
.btn {
    background-color: var(--primary-color);
    color: var(--light-color);
    padding: 15px 30px;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    transition: background-color 0.3s ease, transform 0.3s ease;
}
.btn:hover { background-color: #5849b3; transform: translateY(-3px); }
.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}
.btn:hover::before { left: 100%; }

/* --- Footer --- */
footer { background-color: var(--dark-color); color: var(--light-color); text-align: center; padding: 40px 0; }

/* --- Diseño Responsivo --- */
@media (max-width: 768px) {
    .hero-content h1 { font-size: 2.8rem; height: 50px; }
    .hero-content h2 { font-size: 1.4rem; }
    .section-title { font-size: 2rem; }
}





.project-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 20px 0;
}

.tag-button {
    position: relative;
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    color: white;
    cursor: pointer;
    transition: transform 0.2s;
    font-family: sans-serif;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.tag-button.a {
    background-color: #42b883;
}
.tag-button.b {
    background-color: #ffca28;
    color: #000;
}
.tag-button.c {
    background-color: #e74c3c;
}

/* Ocultar loader por defecto */
.loader {
    width: 16px;
    height: 16px;
    border: 2px solid white;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}