/* ============================================
   EDITORA EIXINHO - Animações
   ============================================ */

/* ============= KEYFRAMES BASE ============= */

/* Flutuação suave */
@keyframes flutuarSuave {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    25% {
        transform: translateY(-15px) rotate(2deg);
    }

    50% {
        transform: translateY(-25px) rotate(-2deg);
    }

    75% {
        transform: translateY(-10px) rotate(1deg);
    }
}

/* Balançar como pelúcia */
@keyframes balancarPelucia {

    0%,
    100% {
        transform: rotate(-3deg) translateY(0);
    }

    50% {
        transform: rotate(3deg) translateY(-8px);
    }
}

/* Pulsar suave */
@keyframes pulsarSuave {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

/* Brilho rotativo */
@keyframes brilhoRotativo {
    0% {
        transform: rotate(0deg);
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.2);
    }

    100% {
        transform: rotate(360deg);
        filter: brightness(1);
    }
}

/* Entrada suave do lado */
@keyframes entradaLado {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Entrada de baixo */
@keyframes entradaBaixo {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Entrada com escala */
@keyframes entradaEscala {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Fade in */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Piscar estrela */
@keyframes piscarEstrela {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.3;
        transform: scale(0.8);
    }
}

/* Voar passarinho */
@keyframes voarPassaro {
    0% {
        transform: translateX(-100vw) translateY(0) rotate(0deg);
    }

    25% {
        transform: translateX(-50vw) translateY(-30px) rotate(-5deg);
    }

    50% {
        transform: translateX(0) translateY(10px) rotate(5deg);
    }

    75% {
        transform: translateX(50vw) translateY(-20px) rotate(-3deg);
    }

    100% {
        transform: translateX(100vw) translateY(0) rotate(0deg);
    }
}

/* Subir balão */
@keyframes subirBalao {
    0% {
        transform: translateY(100vh) translateX(0) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateY(-100vh) translateX(50px) rotate(15deg);
        opacity: 0;
    }
}

/* Virar página */
@keyframes virarPagina {
    0% {
        transform: perspective(1000px) rotateY(0deg);
    }

    50% {
        transform: perspective(1000px) rotateY(-30deg);
    }

    100% {
        transform: perspective(1000px) rotateY(0deg);
    }
}

/* Confete caindo */
@keyframes confeteCaindo {
    0% {
        transform: translateY(-100%) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Shake suave */
@keyframes shakeSuave {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* Bounce */
@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-20px);
    }

    60% {
        transform: translateY(-10px);
    }
}

/* Ondular */
@keyframes ondular {

    0%,
    100% {
        transform: translateY(0) scaleY(1);
    }

    50% {
        transform: translateY(-5px) scaleY(1.02);
    }
}

/* ============= CLASSES DE ANIMAÇÃO ============= */

/* Elementos flutuantes */
.animar-flutuar {
    animation: flutuarSuave 4s ease-in-out infinite;
}

.animar-flutuar-lento {
    animation: flutuarSuave 6s ease-in-out infinite;
}

.animar-flutuar-rapido {
    animation: flutuarSuave 2s ease-in-out infinite;
}

/* Livros como pelúcia */
.animar-pelucia {
    animation: balancarPelucia 3s ease-in-out infinite;
}

.animar-pelucia:nth-child(odd) {
    animation-delay: 0.5s;
}

.animar-pelucia:nth-child(even) {
    animation-delay: 1s;
}

/* Pulsação */
.animar-pulsar {
    animation: pulsarSuave 2s ease-in-out infinite;
}

/* Brilho */
.animar-brilho {
    animation: brilhoRotativo 8s linear infinite;
}

/* Estrelas */
.animar-estrela {
    animation: piscarEstrela 2s ease-in-out infinite;
}

.animar-estrela:nth-child(1) {
    animation-delay: 0s;
}

.animar-estrela:nth-child(2) {
    animation-delay: 0.3s;
}

.animar-estrela:nth-child(3) {
    animation-delay: 0.6s;
}

.animar-estrela:nth-child(4) {
    animation-delay: 0.9s;
}

.animar-estrela:nth-child(5) {
    animation-delay: 1.2s;
}

/* Pássaros */
.animar-passaro {
    animation: voarPassaro 20s linear infinite;
}

.animar-passaro:nth-child(1) {
    animation-duration: 18s;
    animation-delay: 0s;
    top: 10%;
}

.animar-passaro:nth-child(2) {
    animation-duration: 22s;
    animation-delay: 5s;
    top: 20%;
}

.animar-passaro:nth-child(3) {
    animation-duration: 25s;
    animation-delay: 10s;
    top: 15%;
}

/* Balões */
.animar-balao {
    animation: subirBalao 15s linear infinite;
}

.animar-balao:nth-child(1) {
    animation-duration: 12s;
    animation-delay: 0s;
    left: 10%;
}

.animar-balao:nth-child(2) {
    animation-duration: 18s;
    animation-delay: 4s;
    left: 30%;
}

.animar-balao:nth-child(3) {
    animation-duration: 15s;
    animation-delay: 8s;
    left: 70%;
}

.animar-balao:nth-child(4) {
    animation-duration: 20s;
    animation-delay: 2s;
    left: 90%;
}

/* Entradas - usar com JS para scroll reveal */
.animar-entrada-lado {
    animation: entradaLado 0.6s ease-out forwards;
}

.animar-entrada-baixo {
    animation: entradaBaixo 0.6s ease-out forwards;
}

.animar-entrada-escala {
    animation: entradaEscala 0.5s ease-out forwards;
}

.animar-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

/* Estados antes de animar */
.pre-animar {
    opacity: 0;
}

.pre-animar-lado {
    opacity: 0;
    transform: translateX(-30px);
}

.pre-animar-baixo {
    opacity: 0;
    transform: translateY(30px);
}

.pre-animar-escala {
    opacity: 0;
    transform: scale(0.8);
}

/* Delays de animação */
.anim-delay-100 {
    animation-delay: 0.1s;
}

.anim-delay-200 {
    animation-delay: 0.2s;
}

.anim-delay-300 {
    animation-delay: 0.3s;
}

.anim-delay-400 {
    animation-delay: 0.4s;
}

.anim-delay-500 {
    animation-delay: 0.5s;
}

.anim-delay-600 {
    animation-delay: 0.6s;
}

.anim-delay-700 {
    animation-delay: 0.7s;
}

.anim-delay-800 {
    animation-delay: 0.8s;
}

.anim-delay-900 {
    animation-delay: 0.9s;
}

.anim-delay-1000 {
    animation-delay: 1s;
}

/* ============= EFEITOS HOVER ============= */

/* Hover com brilho */
.hover-brilho {
    transition: filter 0.3s ease, transform 0.3s ease;
}

.hover-brilho:hover {
    filter: brightness(1.1) drop-shadow(0 0 10px rgba(255, 204, 188, 0.5));
    transform: scale(1.02);
}

/* Hover com bounce */
.hover-bounce {
    transition: transform 0.3s ease;
}

.hover-bounce:hover {
    animation: bounce 0.6s ease;
}

/* Hover shake */
.hover-shake:hover {
    animation: shakeSuave 0.4s ease;
}

/* Hover virar página */
.hover-virar-pagina {
    transition: transform 0.4s ease;
    transform-style: preserve-3d;
}

.hover-virar-pagina:hover {
    animation: virarPagina 0.8s ease;
}

/* ============= ELEMENTOS DO CENÁRIO ============= */

/* Container para elementos flutuantes */
.cenario-animado {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* Estrelas do céu noturno */
.estrela {
    position: absolute;
    color: white;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.estrela-pequena {
    font-size: 12px;
}

.estrela-media {
    font-size: 18px;
}

.estrela-grande {
    font-size: 24px;
}

/* Nuvens */
.nuvem {
    position: absolute;
    font-size: 48px;
    opacity: 0.8;
    animation: flutuarSuave 10s ease-in-out infinite;
}

.nuvem:nth-child(1) {
    top: 5%;
    left: 10%;
    animation-delay: 0s;
}

.nuvem:nth-child(2) {
    top: 15%;
    left: 60%;
    animation-delay: 3s;
    font-size: 36px;
}

.nuvem:nth-child(3) {
    top: 8%;
    left: 85%;
    animation-delay: 6s;
    font-size: 42px;
}

/* Pássaros voando */
.passaro {
    position: absolute;
    font-size: 24px;
}

/* Balões subindo */
.balao {
    position: absolute;
    font-size: 36px;
    bottom: -50px;
}

/* Sol e Lua */
.corpo-celeste {
    position: fixed;
    font-size: 64px;
    z-index: -1;
    transition: opacity 2s ease;
}

.sol {
    top: 10%;
    right: 10%;
    text-shadow: 0 0 30px rgba(255, 235, 59, 0.6);
}

.lua {
    top: 10%;
    right: 10%;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
}

/* ============= CONFETE ============= */
.confete-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    overflow: hidden;
}

.confete {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -10px;
    animation: confeteCaindo 3s linear forwards;
}

.confete-quadrado {
    border-radius: 2px;
}

.confete-circulo {
    border-radius: 50%;
}

.confete-triangulo {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 10px solid;
}

.confete-cor-1 {
    background: #FFEE58;
    border-bottom-color: #FFEE58;
}

.confete-cor-2 {
    background: #FFAB91;
    border-bottom-color: #FFAB91;
}

.confete-cor-3 {
    background: #80CBC4;
    border-bottom-color: #80CBC4;
}

.confete-cor-4 {
    background: #90CAF9;
    border-bottom-color: #90CAF9;
}

.confete-cor-5 {
    background: #E1BEE7;
    border-bottom-color: #E1BEE7;
}

/* ============= LOADING ============= */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-principal);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-livro {
    font-size: 64px;
    animation: balancarPelucia 1s ease-in-out infinite;
    margin-bottom: 20px;
}

.loading-texto {
    font-family: var(--font-titulo);
    font-size: var(--texto-xl);
    color: var(--texto-secundario);
    animation: pulsarSuave 1.5s ease-in-out infinite;
}

.loading-pontos::after {
    content: '';
    animation: loadingPontos 1.5s infinite;
}

@keyframes loadingPontos {
    0% {
        content: '';
    }

    25% {
        content: '.';
    }

    50% {
        content: '..';
    }

    75% {
        content: '...';
    }

    100% {
        content: '';
    }
}

/* ============= SCROLL ANIMATIONS - Intersection Observer ============= */
.revelar {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.revelar.revelado {
    opacity: 1;
    transform: translateY(0);
}

.revelar-lado {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.revelar-lado.revelado {
    opacity: 1;
    transform: translateX(0);
}

.revelar-escala {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.revelar-escala.revelado {
    opacity: 1;
    transform: scale(1);
}

/* Stagger animation for children */
.stagger-children>* {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.stagger-children.revelado>*:nth-child(1) {
    transition-delay: 0.1s;
}

.stagger-children.revelado>*:nth-child(2) {
    transition-delay: 0.2s;
}

.stagger-children.revelado>*:nth-child(3) {
    transition-delay: 0.3s;
}

.stagger-children.revelado>*:nth-child(4) {
    transition-delay: 0.4s;
}

.stagger-children.revelado>*:nth-child(5) {
    transition-delay: 0.5s;
}

.stagger-children.revelado>*:nth-child(6) {
    transition-delay: 0.6s;
}

.stagger-children.revelado>* {
    opacity: 1;
    transform: translateY(0);
}

/* ============= REDUZIR MOVIMENTO ============= */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}