/* --- Definición de Variables --- */
:root {
    /* Tema Oscuro */
    --bg-color: #1a1a2e;
    --card-bg: #16213e;
    --accent-primary: #0f3460;
    --accent-secondary: #e94560;
    --text-main: #e0e0e0;
    --text-muted: #8da4b4;
    --shadow-hard: var(--accent-secondary);

    --pixel-font: "Press Start 2P", cursive;
    --mono-font: "Space Mono", monospace;
    transition: background 0.4s ease, color 0.4s ease;
}

/* Tema Claro */
body.light-theme {
    --bg-color: #fdf6e3;
    --card-bg: #eee8d5;
    --accent-primary: #d7c4a1;
    --accent-secondary: #d33682;
    --text-main: #3e3a36;
    --text-muted: #83796c;
    --shadow-hard: #3e3a36;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--mono-font);
    line-height: 1.6;
    overflow-x: hidden;
}

/* --- Header --- */
header {
    padding: 2rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo {
    font-family: var(--pixel-font);
    color: var(--accent-secondary);
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.nav-container {
    display: flex;
    align-items: center;
    gap: 2rem;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

nav a {
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s;
}

nav a:hover {
    color: var(--accent-secondary);
}

#theme-toggle {
    background: transparent;
    border: 2px solid var(--text-main);
    color: var(--text-main);
    padding: 0.5rem;
    cursor: pointer;
    font-size: 1.2rem;
    width: 45px;
    height: 45px;
    transition: all 0.3s ease;
}

#theme-toggle:hover {
    background: var(--accent-secondary);
    border-color: var(--accent-secondary);
    color: var(--bg-color);
    box-shadow: 3px 3px 0px var(--text-main);
}

/* --- Hero Section --- */
.hero {
    min-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 5%;
    perspective: 1000px;
}

.hero-container {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 3rem;
    text-align: center;
    width: 100%;
    max-width: 1200px;
}

/* Tarjeta 3D */
.profile-card {
    width: 280px;
    height: 380px;
    background: var(--card-bg);
    border: 4px solid var(--text-main);
    position: relative;
    transform-style: preserve-3d;
    box-shadow: 10px 10px 0px var(--shadow-hard);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: transform 0.1s, box-shadow 0.4s, background 0.4s,
        border 0.4s;
}

.profile-card img {
    width: 150px;
    height: 150px;
    image-rendering: pixelated;
    transform: translateZ(30px);
    border: 3px dashed var(--accent-primary);
    border-radius: 50%;
    background: var(--bg-color);
    padding: 5px;
}

.profile-card h2 {
    margin-top: 1.5rem;
    font-family: var(--pixel-font);
    font-size: 1rem;
    color: var(--accent-secondary);
    transform: translateZ(20px);
}

.profile-card p {
    font-size: 0.8rem;
    color: var(--text-muted);
    transform: translateZ(20px);
    margin-top: 0.5rem;
}

.profile-social {
    margin-top: 20px;
    font-size: 1.5rem;
    transform: translateZ(25px);
    color: var(--text-main);
}

.profile-social a {
    color: var(--text-main);
    text-decoration: none;
    transition: color 0.3s ease;
}

.profile-social a:hover {
    color: var(--accent-secondary);
}

/* --- Intro Text & Animations --- */
.intro-text {
    max-width: 600px;
}

/* 1. Animación Puntos Suspensivos */
.loading-text {
    color: var(--accent-secondary);
    margin-bottom: 10px;
    font-family: var(--pixel-font);
    font-size: 0.8rem;
    display: inline-block;
}

/* Pseudo-elemento para los puntos */
.loading-text::after {
    content: "";
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {

    0%,
    20% {
        content: "";
    }

    40% {
        content: ".";
    }

    60% {
        content: "..";
    }

    80%,
    100% {
        content: "...";
    }
}

/* 2. Estilos para Typewriter */
.intro-text h1 {
    font-family: var(--pixel-font);
    font-size: 2rem;
    line-height: 1.4;
    margin-bottom: 1rem;
    min-height: 2.8em;
    /* Reserva espacio para evitar saltos */
}

.typewriter-cursor {
    border-right: 12px solid var(--accent-secondary);
    animation: blink-cursor 0.8s step-end infinite;
    margin-left: 5px;
}

@keyframes blink-cursor {

    from,
    to {
        border-color: transparent;
    }

    50% {
        border-color: var(--accent-secondary);
    }
}

.highlight {
    color: var(--accent-secondary);
}

/* --- Grid & Footer --- */
.section-title {
    text-align: center;
    font-family: var(--pixel-font);
    font-size: 1.5rem;
    margin: 4rem 0 2rem;
    color: var(--accent-secondary);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    padding: 0 5%;
    max-width: 1200px;
    margin: 0 auto 4rem auto;
}

.card {
    background: var(--card-bg);
    padding: 2rem;
    border: 3px solid var(--accent-primary);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-7px);
    box-shadow: 7px 7px 0px var(--text-main);
    border-color: var(--accent-secondary);
}

.card-icon {
    font-size: 2rem;
    color: var(--accent-secondary);
    margin-bottom: 1rem;
}

.card h3 {
    font-family: var(--pixel-font);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.card p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.tags span {
    display: inline-block;
    background: var(--bg-color);
    color: var(--text-muted);
    padding: 0.3rem 0.7rem;
    font-size: 0.7rem;
    margin-right: 0.5rem;
    margin-top: 1rem;
    border: 2px solid var(--accent-primary);
    font-family: var(--pixel-font);
}

footer {
    text-align: center;
    padding: 3rem;
    border-top: 3px dashed var(--accent-primary);
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: auto;
}

/* Media Queries */
@media (max-width: 900px) {
    header {
        flex-direction: column;
        gap: 1.5rem;
    }

    .nav-container {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 600px) {
    .nav-container {
        flex-direction: column-reverse;
        gap: 1rem;
    }

    .intro-text h1 {
        font-size: 1.4rem;
        min-height: 4em;
    }

    /* Ajuste altura en móvil */
}

@media (min-width: 901px) {
    .hero-container {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }

    .profile-card {
        margin-left: 2rem;
        order: 2;
    }

    .intro-text {
        order: 1;
    }

    .intro-text h1 {
        font-size: 2.8rem;
    }

    .cursor-trail {
        position: fixed;
        width: 18px;
        height: 18px;
        background: var(--accent-secondary);
        pointer-events: none;
        z-index: 9999;
        animation: fadeOut 0.5s forwards;
    }

    @keyframes fadeOut {
        to {
            opacity: 0;
            transform: scale(0);
        }
    }
}

/* --- Animations --- */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-anim {
    animation: slideIn 0.6s ease-out forwards;
}