/* ===== 1. RESETEO Y FUENTES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600&family=Playfair+Display:wght@400;700&display=swap');

body {
    background: #0f0f0f;
    color: #e8e8e8;
    font-family: 'Playfair Display', serif;
    line-height: 1.7;
    overflow-x: hidden;
    position: relative;
    transition: all 0.4s ease;
}

/* ===== 2. BOTÓN TEMA ===== */
.boton-tema {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}

.boton-tema:hover {
    transform: scale(1.1);
    background: #8B0000;
}

/* ===== 3. ENCABEZADO PRINCIPAL ===== */
.encabezado-principal {
    background: linear-gradient(135deg, #1a0000, #4a1a1a);
    padding: 2rem 1rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.encabezado-principal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(139, 0, 0, 0.3), transparent);
    z-index: 0;
}

.contenido-encabezado {
    position: relative;
    z-index: 1;
}

/* Logo JM */
.logo-jm {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    font-weight: bold;
    color: #b8860b;
    background: #1a0000;
    border: 3px solid #8B0000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(139, 0, 0, 0.7);
}

/* Título animado */
.titulo-animado {
    font-family: 'Cinzel', serif;
    font-size: 3.5rem;
    color: #b8860b;
    text-shadow: 0 0 10px rgba(184, 134, 11, 0.5);
    overflow: hidden;
    white-space: nowrap;
    border-right: 3px solid #8B0000;
    animation: escribir 3s steps(20) forwards, parpadeo 0.7s infinite;
}

@keyframes escribir {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

@keyframes parpadeo {
    50% {
        border-color: transparent;
    }
}

.subtitulo {
    font-size: 1.5rem;
    color: #ccc;
    margin: 1rem 0;
}

.frase-destacada {
    font-style: italic;
    color: #aaa;
}

/* ===== MENÚ NAVEGACIÓN (MODO OSCURO) ===== */
.menu-navegacion {
    background: #111;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.menu-navegacion a {
    color: #ccc;
    text-decoration: none;
    margin: 0 1.5rem;
    font-size: 1.1rem;
    position: relative;
    transition: color 0.3s;
    font-weight: 500;
}

.menu-navegacion a:hover {
    color: #8B0000;
}

.menu-navegacion a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 3px;
    background: #8B0000;
    bottom: -6px;
    left: 0;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.menu-navegacion a:hover::after {
    width: 100%;
}

/* ===== 5. CONTENEDOR Y SECCIONES ===== */
.contenedor-principal {
    max-width: 1100px;
    margin: 3rem auto;
    padding: 0 2rem;
}

.titulo-seccion {
    font-family: 'Cinzel', serif;
    font-size: 2.2rem;
    color: #b8860b;
    margin-bottom: 1.5rem;
    text-align: center;
    position: relative;
}

.titulo-seccion::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: #8B0000;
    margin: 0.5rem auto;
    border-radius: 2px;
}

/* ===== 6. SOBRE MÍ ===== */
.contenido-sobre-mi {
    display: flex;
    align-items: center;
    gap: 2rem;
    background: #1a1a1a;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
}

.foto-perfil {
    position: relative;
    width: 180px;
    height: 180px;
    flex-shrink: 0;
}

.foto-perfil img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #8B0000;
    box-shadow: 0 0 20px rgba(139, 0, 0, 0.6);
}

.marco-foto {
    position: absolute;
    top: -10px;
    left: -10px;
    width: 100%;
    height: 100%;
    border: 2px solid #b8860b;
    border-radius: 50%;
    transform: rotate(45deg);
    z-index: -1;
}

.contenido-sobre-mi p {
    flex: 1;
    font-size: 1.1rem;
    color: #ddd;
}

/* ===== 7. PROYECTOS ===== */
.grilla-proyectos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.tarjeta-proyecto {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.4s ease;
    position: relative;
}

.tarjeta-proyecto::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, transparent, rgba(139, 0, 0, 0.1));
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 0;
}

.tarjeta-proyecto:hover::before {
    opacity: 1;
}

.tarjeta-proyecto:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(139, 0, 0, 0.3);
    border-color: #8B0000;
}

.contenido-tarjeta {
    padding: 1.5rem;
    position: relative;
    z-index: 1;
}

.contenido-tarjeta h3 {
    color: #b8860b;
    margin-bottom: 0.5rem;
}

.contenido-tarjeta p {
    color: #ccc;
    font-size: 0.95rem;
}

.boton-verde {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: #8B0000;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: all 0.3s;
    box-shadow: 0 0 10px rgba(139, 0, 0, 0.5);
}

.boton-verde:hover {
    background: #a00;
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(139, 0, 0, 0.7);
}

/* ===== 8. HABILIDADES ===== */
.grilla-habilidades {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    justify-content: center;
}

.etiqueta-habilidad {
    background: #4a1a1a;
    color: #b8860b;
    padding: 0.5rem 1rem;
    border-radius: 30px;
    font-size: 0.95rem;
    border: 1px solid #8B0000;
    transition: all 0.3s;
}

.etiqueta-habilidad:hover {
    background: #8B0000;
    color: white;
    transform: translateY(-3px);
}

/* ===== 9. CONTACTO ===== */
.iconos-contacto {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 2rem 0;
}

.iconos-contacto a {
    color: #ccc;
    font-size: 2rem;
    transition: all 0.3s;
}

.iconos-contacto a:hover {
    color: #8B0000;
    transform: scale(1.2) rotate(5deg);
}

/* ===== 10. PIE DE PÁGINA ===== */
.pie-pagina {
    background: #111;
    color: #666;
    text-align: center;
    padding: 1.5rem;
    margin-top: 3rem;
    font-size: 0.9rem;
}

/* ===== 11. RESPONSIVE ===== */
@media (max-width: 768px) {
    .titulo-animado {
        font-size: 2.5rem;
    }

    .contenido-sobre-mi {
        flex-direction: column;
        text-align: center;
    }

    .foto-perfil {
        width: 140px;
        height: 140px;
    }

    .menu-navegacion a {
        display: block;
        margin: 0.5rem 0;
    }
}

/* ===== 12. MODO CLARO (AZUL) - EFECTOS ADAPTADOS ===== */
body.modo-claro {
    background: #f0f8ff;
    color: #1e3a8a;
}

/* Encabezado */
body.modo-claro .encabezado-principal {
    background: linear-gradient(135deg, #1e40af, #3b82f6);
}

body.modo-claro .encabezado-principal::before {
    background: radial-gradient(circle at center, rgba(59, 130, 246, 0.3), transparent);
}

body.modo-claro .titulo-animado {
    color: #fbbf24;
    border-right-color: #fbbf24;
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}

body.modo-claro .subtitulo,
body.modo-claro .frase-destacada {
    color: #e0f2fe;
}

/* Logo JM */
body.modo-claro .logo-jm {
    color: #fbbf24;
    background: #1e40af;
    border: 3px solid #3b82f6;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.7);
}

/* ===== MODO CLARO - MENÚ MEJORADO ===== */
body.modo-claro .menu-navegacion {
    background: #f8fafc;
    padding: 1.2rem;
    box-shadow: 0 4px 15px rgba(30, 64, 175, 0.1);
    border-bottom: 1px solid #e2e8f0;
}

body.modo-claro .menu-navegacion a {
    color: #1e293b;
    /* Gris azulado oscuro - excelente contraste */
    font-weight: 600;
    margin: 0 1.8rem;
    font-size: 1.15rem;
}

body.modo-claro .menu-navegacion a:hover {
    color: #1d4ed8;
}

body.modo-claro .menu-navegacion a::after {
    background: #3b82f6;
    height: 3px;
    bottom: -8px;
    border-radius: 3px;
}

body.modo-claro .menu-navegacion a:hover::after {
    width: 100%;
}

/* Títulos */
body.modo-claro .titulo-seccion {
    color: #1e40af;
}

body.modo-claro .titulo-seccion::after {
    background: #3b82f6;
}

/* Sobre Mí */
body.modo-claro .contenido-sobre-mi {
    background: white;
    border: 1px solid #bfdbfe;
    box-shadow: 0 5px 20px rgba(59, 130, 246, 0.15);
}

body.modo-claro .foto-perfil img {
    border: 4px solid #3b82f6;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.6);
}

body.modo-claro .marco-foto {
    border: 2px solid #60a5fa;
}

/* Proyectos */
body.modo-claro .tarjeta-proyecto {
    background: white;
    border: 1px solid #bfdbfe;
}

body.modo-claro .tarjeta-proyecto::before {
    background: linear-gradient(135deg, transparent, rgba(59, 130, 246, 0.1));
}

body.modo-claro .tarjeta-proyecto:hover::before {
    opacity: 1;
}

body.modo-claro .tarjeta-proyecto:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(59, 130, 246, 0.3);
    border-color: #3b82f6;
}

body.modo-claro .contenido-tarjeta h3 {
    color: #1e40af;
}

body.modo-claro .boton-verde {
    background: #1d4ed8;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

body.modo-claro .boton-verde:hover {
    background: #1e40af;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.7);
}

/* Habilidades */
body.modo-claro .etiqueta-habilidad {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

body.modo-claro .etiqueta-habilidad:hover {
    background: #3b82f6;
    color: white;
}

/* Contacto */
body.modo-claro .iconos-contacto a {
    color: #64748b;
}

body.modo-claro .iconos-contacto a:hover {
    color: #1d4ed8;
}

/* Pie de página */
body.modo-claro .pie-pagina {
    background: #f8fafc;
    color: #475569;
    border-top: 1px solid #e2e8f0;
}

/* Botón tema */
body.modo-claro .boton-tema {
    background: rgba(255, 255, 255, 0.95);
    color: #1e40af;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

body.modo-claro .boton-tema:hover {
    background: #3b82f6;
    color: white;
}

body.modo-claro .contenido-sobre-mi p {
    color: #202020bd;
}

body.modo-claro .contenido-tarjeta p {
    color: #202020bd;
}

/* ==========================================================================
    NUEVO: Fondo 3D + overlay
========================================================================== */

#spline-fondo {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    /* muy atrás */
    pointer-events: none;
    /* clics pasan a través */
}

.overlay-fondo {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    /* negro semi-transparente - ajústalo (0.3 a 0.6) */
    z-index: -1;
    pointer-events: none;
}

/* En modo claro, reducimos o quitamos el overlay para que se vea mejor */
body.modo-claro .overlay-fondo {
    background: rgba(240, 248, 255, 0.76);
    /* muy claro o quítalo si prefieres */
    /* o simplemente: display: none; si no quieres overlay en claro */
}

/* Body ahora sin url inválida */
body {
    background: #000;
    /* color sólido de respaldo */
    color: #e8e8e8;
    font-family: 'Playfair Display', serif;
    line-height: 1.7;
    /* quitamos overflow-x: hidden; a menos que lo necesites por algo específico */
    position: relative;
    transition: all 0.4s ease;
    min-height: 100vh;
}

/* Aseguramos que header, nav, main y footer estén por encima del fondo */
.encabezado-principal,
.menu-navegacion,
.contenedor-principal,
.pie-pagina {
    position: relative;
    z-index: 1;
}

/* Botón tema ya tiene z-index alto, pero por si acaso */
.boton-tema {
    z-index: 1000;
}

/* Opcional: si quieres que el spline responda menos al scroll o zoom */
#spline-fondo {
    override-colors: "false"
}