/*EFECTO DE LA MESA*/
#mesa-trigger {
    cursor: pointer;
    transition: margin-bottom 0.3s ease, filter 0.3s ease;
    margin-bottom: 0;
}

#mesa-trigger:hover {
    margin-bottom: 20px;
    filter: drop-shadow(0 20px 0px rgba(255, 200, 0, 0.6));
}

/*UTILIDADES 3D PARA EL LIBRO*/
.preserve-3d { transform-style: preserve-3d; }
.backface-hidden { backface-visibility: hidden; }
.rotar-reverso { transform: rotateY(180deg); }

/*ANIMACIÓN BRINCO PARA EL LIBRO CERRADO*/
@keyframes jump-pixel {
    0%, 100% { transform: translateY(0) scale(1); }
    10% { transform: translateY(-5px) scale(1); } 
    30% { transform: translateY(-25px) scale(1.02); } 
    50% { transform: translateY(0) scale(1); }
    60% { transform: translateY(-8px) scale(1); }
    80% { transform: translateY(0) scale(1); }
}

.animate-jump-pixel {
    animation: jump-pixel 1.8s ease-out infinite;
    animation-play-state: running;
}

/* Detener el brinco al pasar el mouse */
#libro-cerrado-container:hover {
    animation-play-state: paused;
}

/*ANIMACIÓN DE LA FLECHA*/
@keyframes bounce-horizontal {
    0%, 100% { transform: translateX(0) translateY(-50%); }
    50% { transform: translateX(10px) translateY(-50%); }
}

.animate-bounce-horizontal {
    animation: bounce-horizontal 0.8s ease-in-out infinite;
}

/* ANIMACION DEL LIBRO AL ABRIRSE*/
#el-libro.is-open {
    transform: translateX(50%);
    display: block;
}

#el-libro.is-open .portada-principal {
    transform: rotateY(-180deg);
}

#el-libro.is-open .hoja-extra-1 {
    transform: rotateY(-175deg);
}

#el-libro.is-open .hoja-extra-2 {
    transform: rotateY(-170deg);
}

/*ZONA DRAG & DROP Y PAPELITOS */


.vaso-dragover {
    background-color: #93c5fd !important; 
    transform: scale(1.05); 
    box-shadow: 12px 12px 0 #000, inset -10px -10px 0 rgba(30,58,138,0.2) !important;
}

/* Estilo del papelito arrugado que cae en el vaso */
.papel-arrugado {
    width: auto;
    padding: 2px 8px;
    background-color: white;
    border: 2px solid black;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    box-shadow: inset 2px 2px 0 rgba(0,0,0,0.1), 2px 2px 0 rgba(0,0,0,1);
    transition: transform 0.3s;
    margin: 2px;
}

/* Animación de caída desde arriba */
@keyframes caer-al-vaso {
    0% {
        transform: translateY(-200px) scale(1.5) rotate(0deg);
        opacity: 0;
    }
    50% { opacity: 1; }
    100% {
        transform: translateY(0) scale(1) rotate(var(--rotacion-final));
    }
}

.animacion-caida {
    animation: caer-al-vaso 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Animación para que el papel salga volando del vaso */
@keyframes volar-del-vaso {
    0% {
        transform: translateY(0) scale(1) rotate(var(--rotacion-final));
        opacity: 1;
    }
    100% {
        transform: translateY(-300px) scale(1.5) rotate(45deg);
        opacity: 0;
    }
}

.animacion-salida {
    animation: volar-del-vaso 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards !important;
    pointer-events: none;
}

/*ANIMACIONES DEL CALENDARIO Y EFECTO ZOOM*/

/* Esta clase aleja el libro y lo desenfoca */
.libro-alejado {
    transform: translateX(-15%) scale(0.85) !important; 
    filter: blur(4px) brightness(0.6);
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Estilo para los cuadritos de los días */
.dia-calendario {
    cursor: pointer;
    background-color: white;
    border: 2px solid black;
    box-shadow: 2px 2px 0 #000;
    transition: all 0.1s;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.dia-calendario:hover:not(.vacio) {
    background-color: #a0c4ff;
    transform: translateY(-2px);
}

.dia-calendario:active:not(.vacio) {
    transform: translateY(2px);
    box-shadow: none;
}

/* Día vacío para alinear el primer día del mes */
.dia-calendario.vacio {
    background-color: transparent;
    border-color: transparent;
    box-shadow: none;
    cursor: default;
}

@keyframes shake-pixel {
    0% { transform: translate(0, 0); }
    25% { transform: translate(8px, -8px); }
    50% { transform: translate(-8px, 8px); }
    75% { transform: translate(8px, 8px); }
    100% { transform: translate(0, 0); }
}

.animate-shake-pixel {
    animation: shake-pixel 0.2s ease-in-out infinite;
}

/* Animación de la estrella cayendo en diagonal */
@keyframes estrella-fugaz {
    0% { 
        transform: translate(0, 0) rotate(-45deg) scale(1); 
        opacity: 1; 
    }
    100% { 
        transform: translate(-300px, 300px) rotate(-45deg) scale(0); 
        opacity: 0; 
    }
}

.estrella-animada {
    animation: estrella-fugaz 1.2s ease-in forwards;
}

/* Animación de las luciérnagas flotando y parpadeando */
@keyframes flotar-luciernaga {
    0% { transform: translate(0, 0); opacity: 0; }
    20% { opacity: 1; }
    50% { transform: translate(15px, -25px); opacity: 0.4; }
    80% { opacity: 0.8; }
    100% { transform: translate(-10px, -10px); opacity: 0; }
}

.luciernaga {
    animation: flotar-luciernaga infinite alternate ease-in-out;
}

/* Animación para la fogata */
@keyframes parpadeo-fuego {
    0%   { filter: brightness(1) drop-shadow(0 -10px 20px rgba(255, 100, 0, 0.3));}
    20%  { filter: brightness(1.1) drop-shadow(0 -15px 30px rgba(255, 120, 0, 0.5)) }
    40%  { filter: brightness(0.95) drop-shadow(0 -5px 15px rgba(255, 90, 0, 0.2)); }
    60%  { filter: brightness(1.15) drop-shadow(0 -20px 35px rgba(255, 130, 0, 0.6)) }
    80%  { filter: brightness(1.05) drop-shadow(0 -10px 25px rgba(255, 110, 0, 0.4)) }
    100% { filter: brightness(1) drop-shadow(0 -10px 20px rgba(255, 100, 0, 0.3)) }
}

.fuego-vivo {
    animation: parpadeo-fuego 3s infinite;
}

.poster-musical {
    width: 28%; /* Ancho relativo dentro de su contenedor flex */
    height: auto;
    object-fit: contain;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent; /* Para evitar saltos al poner el borde en hover */
}

/* Efecto hover: se agranda un poco y brilla con un tono cian lo-fi */
.poster-musical:hover {
    transform: scale(1.1) translateY(-5px);
    border-color: rgba(34, 211, 238, 0.5); /* cyan-400 de Tailwind al 50% */
    filter: brightness(1.1) drop-shadow(0 0 10px rgba(34, 211, 238, 0.7));
}

@keyframes respiracion-logo {
    0%   { transform: translate(-50%, 0); }
    50%  { transform: translate(-50%, -15px); } /* Sube 15px */
    100% { transform: translate(-50%, 0); }
}

.logo-respirando {
    /* Mantenemos el translate(-50%) para el centrado horizontal de Tailwind y agregamos la animación */
    animation: respiracion-logo 6s infinite ease-in-out;
}