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

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.5;
    scroll-behavior: smooth;
    transition: background-color 0.3s ease, color 0.2s ease;
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* ========== TEMAS (Web Dev - Light/Dark) ========== */
:root {
    /* Light Mode (default) */
    --bg-primary: #f5f7fc;
    --bg-secondary: #ffffff;
    --text-primary: #1a1f2e;
    --text-secondary: #4a5568;
    --accent-blue: #0a2b4e;
    --accent-violet: #6b46c1;
    --accent-cyan: #00b4d8;
    --accent-metal: #718096;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --glow: rgba(107, 70, 193, 0.2);
    --navbar-bg: rgba(255, 255, 255, 0.95);
    --hero-gradient: linear-gradient(135deg, #0a2b4e, #6b46c1);
}

body.dark-mode {
    --bg-primary: #0f1219;
    --bg-secondary: #1a1f2e;
    --text-primary: #e2e8f0;
    --text-secondary: #a0aec0;
    --accent-blue: #2b6cb0;
    --accent-violet: #9f7aea;
    --accent-cyan: #00b4d8;
    --accent-metal: #a0aec0;
    --card-bg: #1e2538;
    --border: #2d3748;
    --navbar-bg: rgba(15, 18, 25, 0.95);
    --hero-gradient: linear-gradient(135deg, #2b6cb0, #9f7aea);
}

/* ========== GAMEDEV PERMANENT DARK ========== */
body.game-mode {
    --bg-primary: #0a0a14;
    --bg-secondary: #0f0f1a;
    --text-primary: #e0e0ff;
    --text-secondary: #b0b0ff;
    --accent-blue: #00d4ff;
    --accent-violet: #ff2a6d;
    --accent-cyan: #00d4ff;
    --accent-metal: #c0c0ff;
    --card-bg: #1a1a2e;
    --border: #ff2a6d60;
    --glow: rgba(255, 42, 109, 0.3);
    --navbar-bg: rgba(10, 10, 20, 0.95);
    --hero-gradient: linear-gradient(135deg, #00d4ff, #ff2a6d);
}

/* ========== LAYOUT GLOBAL ========== */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ========== NAVBAR ========== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--navbar-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    transition: all 0.3s ease;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    list-style: none;
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}

.nav-links a:hover {
    color: var(--accent-violet);
}

/* ========== CONTROLES ========== */
.controls {
    display: flex;
    gap: 0.75rem;
}

.btn-icon {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.2s;
}

.btn-icon:hover {
    transform: scale(1.05);
    box-shadow: 0 0 12px var(--glow);
}

/* ========== HERO ========== */
.hero {
    padding: 4rem 0 3rem;
    text-align: center;
}

.hero h1 {
    font-size: 3.5rem;
    background: var(--hero-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--accent-metal);
    margin-bottom: 1rem;
}

.hero-desc {
    max-width: 700px;
    margin: 0 auto;
}

/* ========== PROYECTOS GRID ========== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.project-card {
    background: var(--card-bg);
    border-radius: 1.5rem;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    cursor: pointer;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 30px -12px rgba(0, 0, 0, 0.3);
    border-color: var(--accent-violet);
}

.project-img {
    height: 200px;
    background: linear-gradient(145deg, var(--accent-blue), var(--accent-violet));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    transition: all 0.3s ease;
}

.project-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.project-content {
    padding: 1.5rem;
}

.project-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

/* ========== TECNOLOGÍAS ========== */
.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
}

.tech-tag {
    background: var(--bg-primary);
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    border: 1px solid var(--border);
}

/* ========== IMÁGENES DE PROYECTOS ========== */
.project-img {
    height: 200px;
    background: linear-gradient(145deg, var(--accent-blue), var(--accent-violet));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.project-img-emoji {
    font-size: 4rem;
    transition: all 0.3s ease;
}

.project-img-custom {
    width: 100%;
    height: 100%;
    object-fit: cover;  /* Para GIFs y PNGs, cubre el área */
    transition: transform 0.3s ease;
}

/* Para GIFs que quieres que se vean completos sin recortar */
.project-img-custom.contain {
    object-fit: contain;
    padding: 1rem;
}

/* Efecto hover en imágenes */
.project-card:hover .project-img-custom {
    transform: scale(1.05);
}

/* Para proyectos sin imagen, mantener emoji centrado */
.project-img:has(.project-img-emoji) {
    justify-content: center;
    align-items: center;
}

/* ========== BOTONES DE PROYECTOS ========== */
.project-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.btn-read, .btn-link {
    background: transparent;
    border: 1px solid var(--accent-violet);
    padding: 0.5rem 1.25rem;
    border-radius: 2rem;
    cursor: pointer;
    color: var(--accent-violet);
    font-weight: 600;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    font-size: 0.875rem;
}

.btn-read:hover, .btn-link:hover {
    background: var(--accent-violet);
    color: white;
    box-shadow: 0 0 12px var(--glow);
    transform: translateY(-2px);
}

/* Modo GameDev para botones */
.game-mode .btn-read, 
.game-mode .btn-link {
    border-color: #ff2a6d;
    color: #ff2a6d;
}

.game-mode .btn-read:hover, 
.game-mode .btn-link:hover {
    background: #ff2a6d;
    color: white;
    box-shadow: 0 0 15px rgba(255, 42, 109, 0.5);
}

/* ========== SECCIONES ========== */
section {
    margin: 4rem 0;
}

.section-title {
    font-size: 2rem;
    margin-bottom: 2rem;
    border-left: 5px solid var(--accent-violet);
    padding-left: 1rem;
}

/* ========== FOOTER ========== */

footer {
    text-align: center;
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    margin-top: 3rem;
}

/* ========== ANIMACIONES Y PORTAL ========== */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.portal-btn {
    background: linear-gradient(90deg, var(--accent-violet), var(--accent-blue));
    border: none;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 3rem;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    margin: 2rem auto;
    display: inline-block;
    animation: glitch 1.5s infinite;
}

@keyframes glitch {
    0%, 100% { transform: skew(0deg); }
    96% { transform: skew(0deg); }
    97% { transform: skew(3deg); }
    98% { transform: skew(-3deg); }
    99% { transform: skew(1deg); }
}

.portal-btn:hover {
    transform: scale(1.05);
    letter-spacing: 2px;
    animation: none;
}

/* ========== CONTACTOS ========== */
.contact-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 2rem;
}

.btn-contact {
    padding: 0.75rem 1.5rem;
    border-radius: 2rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-contact:hover {
    transform: scale(1.05);
    border-color: var(--accent-violet);
    box-shadow: 0 0 12px var(--glow);
}

.btn-cv {
    background: var(--accent-violet);
    color: white;
    border: none;
}

/* ========== MODAL ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: var(--card-bg);
    max-width: 500px;
    padding: 2rem;
    border-radius: 2rem;
    border: 2px solid var(--accent-violet);
    margin: 1rem;
}

.modal-content h3 {
    margin-bottom: 1rem;
}

.close-modal {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: var(--accent-violet);
    border: none;
    border-radius: 1rem;
    color: white;
    cursor: pointer;
}

/* ========== IMÁGENES DE PERFIL ========== */
.hero-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
}

.hero-image {
    flex-shrink: 0;
}

.profile-photo {
    width: 200px;
    height: 250px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--accent-violet);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.profile-photo:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px var(--glow);
}

.game-mode .profile-photo {
    border: 4px solid #ff2a6d;
    box-shadow: 0 0 20px rgba(255, 42, 109, 0.5);
}

/* ========== ABOUT SECTION ========== */
.about-container {
    display: flex;
    align-items: center;
    gap: 3rem;
    flex-wrap: wrap;
}

.about-skills {
  margin-top: 16px;
}

.about-title {
  font-weight: 600;
  font-size: 1.2rem;
  margin-bottom: 10px;
}

.about-skills ul {
  list-style: none;
  padding-left: 0;
}

.about-skills ul li {
  margin-bottom: 12px;
  line-height: 1.5;
}

.about-image {
    flex-shrink: 0;
}

.about-photo {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent-violet);
    transition: all 0.3s ease;
}

.about-photo:hover {
    transform: scale(1.02);
    box-shadow: 0 0 20px var(--glow);
}

.game-mode .about-photo {
    border-color: #ff2a6d;
    box-shadow: 0 0 15px rgba(255, 42, 109, 0.4);
}

#aboutText {
    text-align: justify;
}


/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .hero h1 { 
        font-size: 2.5rem; 
    }
    
    .hero-subtitle { 
        font-size: 1.2rem; 
    }
    
    .nav-links { 
        gap: 1rem; 
    }
    
    .nav-content { 
        flex-direction: column; 
    }
    
    .projects-grid { 
        grid-template-columns: 1fr; 
    }
    
    .hero-container {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .profile-photo {
        width: 140px;
        height: 140px;
    }
    
    .about-container {
        flex-direction: column;
        text-align: center;
    }
    
    .about-photo {
        width: 130px;
        height: 130px;
    }
}