/* ========================================
   ANIMACIONES - Alicia en el País de las Maravillas
   ======================================== */

/* Estado inicial de las puertas */
.doors-container {
    --door-progress: 0;
}

/* Animación de puertas abriéndose basada en scroll */
.door-left {
    transform: translateX(calc(-35% * var(--door-progress)));
}

.door-right {
    transform: translateX(calc(35% * var(--door-progress)));
}

/* Madriguera aparece cuando las puertas se abren */
.rabbit-hole {
    opacity: var(--hole-opacity, 0);
}

/* Oscuridad de la madriguera - zoom effect */
.hole-darkness {
    --zoom-progress: 0;
    width: calc(200% * var(--zoom-progress));
    height: calc(200% * var(--zoom-progress));
    background: var(--color-ink);
    border-radius: 50%;
}

/* Fade out de toda la sección de entrada */
.entrance-section {
    --entrance-opacity: 1;
    opacity: var(--entrance-opacity);
    pointer-events: auto;
}

.entrance-section.complete {
    pointer-events: none;
}

/* ========================================
   ANIMACIONES DE ENTRADA DE ELEMENTOS
   ======================================== */

/* Fade in desde abajo */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade in desde la izquierda */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade in desde la derecha */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Escala desde pequeño */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Rotación elegante */
@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-10deg) scale(0.9);
    }
    to {
        opacity: 1;
        transform: rotate(0) scale(1);
    }
}

/* ========================================
   CLASES DE ANIMACIÓN OBSERVABLES
   ======================================== */

.animate-on-scroll {
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.fade-up {
    transform: translateY(40px);
}

.animate-on-scroll.fade-left {
    transform: translateX(-40px);
}

.animate-on-scroll.fade-right {
    transform: translateX(40px);
}

.animate-on-scroll.scale-in {
    transform: scale(0.8);
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0) translateX(0) scale(1);
}

/* ========================================
   ANIMACIONES ESPECÍFICAS DE ELEMENTOS
   ======================================== */

/* Mensaje de deslizar - pulso suave */
.swipe-message {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Flecha de deslizar */
.swipe-arrow {
    animation: bounceDown 1.5s ease-in-out infinite;
}

@keyframes bounceDown {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(15px);
    }
}

/* Personajes flotantes */
.floating-character.cheshire {
    animation: floatCheshire 4s ease-in-out infinite;
}

@keyframes floatCheshire {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.8;
    }
    25% {
        opacity: 0.6;
    }
    50% {
        transform: translateY(-20px) rotate(3deg);
        opacity: 0.9;
    }
    75% {
        opacity: 0.7;
    }
}

.floating-character.rabbit {
    animation: floatRabbit 3s ease-in-out infinite 0.5s;
}

@keyframes floatRabbit {
    0%, 100% {
        transform: translateY(0) translateX(0);
    }
    50% {
        transform: translateY(-15px) translateX(5px);
    }
}

.floating-character.hatter {
    animation: floatHatter 5s ease-in-out infinite 1s;
}

@keyframes floatHatter {
    0%, 100% {
        transform: translateX(-50%) rotate(0deg);
    }
    50% {
        transform: translateX(-50%) rotate(-5deg) translateY(-10px);
    }
}

/* Citas flotantes */
.floating-quote {
    animation: gentleFloat 6s ease-in-out infinite;
}

.floating-quote.q1 {
    animation-delay: 0s;
}

.floating-quote.q2 {
    animation-delay: 2s;
}

.floating-quote.q3 {
    animation-delay: 4s;
}

@keyframes gentleFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Cards de regalo - shimmer */
.gift-card {
    position: relative;
    overflow: hidden;
}

.gift-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        to bottom right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0) 40%,
        rgba(255, 255, 255, 0.4) 50%,
        rgba(255, 255, 255, 0) 60%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(45deg);
    transition: all 0.5s ease;
    opacity: 0;
}

.gift-card:hover::after {
    animation: shimmer 1s ease forwards;
}

@keyframes shimmer {
    from {
        left: -50%;
        opacity: 1;
    }
    to {
        left: 150%;
        opacity: 0;
    }
}

/* Ornamentos de esquina - aparición */
.corner-ornament {
    opacity: 0;
    animation: cornerAppear 1s ease forwards;
}

.corner-ornament.top-left { animation-delay: 0.2s; }
.corner-ornament.top-right { animation-delay: 0.4s; }
.corner-ornament.bottom-right { animation-delay: 0.6s; }
.corner-ornament.bottom-left { animation-delay: 0.8s; }

@keyframes cornerAppear {
    from {
        opacity: 0;
        transform: scale(0) rotate(-45deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

/* Reset para los que tienen transform inicial */
.corner-ornament.top-right {
    animation: cornerAppearTopRight 1s ease forwards;
    animation-delay: 0.4s;
}

@keyframes cornerAppearTopRight {
    from {
        opacity: 0;
        transform: scale(0) rotate(45deg);
    }
    to {
        opacity: 1;
        transform: rotate(90deg);
    }
}

.corner-ornament.bottom-left {
    animation: cornerAppearBottomLeft 1s ease forwards;
    animation-delay: 0.8s;
}

@keyframes cornerAppearBottomLeft {
    from {
        opacity: 0;
        transform: scale(0) rotate(-135deg);
    }
    to {
        opacity: 1;
        transform: rotate(-90deg);
    }
}

.corner-ornament.bottom-right {
    animation: cornerAppearBottomRight 1s ease forwards;
    animation-delay: 0.6s;
}

@keyframes cornerAppearBottomRight {
    from {
        opacity: 0;
        transform: scale(0) rotate(135deg);
    }
    to {
        opacity: 1;
        transform: rotate(180deg);
    }
}

/* Cartas de naipe en el footer */
.card-suit {
    animation: cardFloat 3s ease-in-out infinite;
}

.card-suit:nth-child(1) { animation-delay: 0s; }
.card-suit:nth-child(2) { animation-delay: 0.5s; }
.card-suit:nth-child(3) { animation-delay: 1s; }
.card-suit:nth-child(4) { animation-delay: 1.5s; }

@keyframes cardFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-8px) rotate(5deg);
    }
}

/* Botón de envío - glow */
.submit-btn:not(:disabled) {
    animation: buttonGlow 2s ease-in-out infinite;
}

@keyframes buttonGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(201, 162, 39, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(201, 162, 39, 0.6), 0 0 40px rgba(201, 162, 39, 0.3);
    }
}

/* ========================================
   ANIMACIONES DE GALERÍA
   ======================================== */

.gallery-item {
    animation: galleryItemIn 0.6s ease forwards;
    opacity: 0;
}

.gallery-item:nth-child(1) { animation-delay: 0.1s; }
.gallery-item:nth-child(2) { animation-delay: 0.2s; }
.gallery-item:nth-child(3) { animation-delay: 0.3s; }
.gallery-item:nth-child(4) { animation-delay: 0.4s; }
.gallery-item:nth-child(5) { animation-delay: 0.5s; }
.gallery-item:nth-child(6) { animation-delay: 0.6s; }

@keyframes galleryItemIn {
    from {
        opacity: 0;
        transform: scale(0.8) rotate(-5deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

/* ========================================
   ANIMACIÓN DEL OVERLAY DE CONFIRMACIÓN
   ======================================== */

.confirmation-overlay {
    backdrop-filter: blur(0px);
    transition: all 0.5s ease;
}

.confirmation-overlay.active {
    backdrop-filter: blur(10px);
}

.confirmation-card {
    animation: cardAppear 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: scale(0.5) rotate(-10deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

.confirmation-icon img {
    animation: keyTurn 1s ease 0.5s forwards;
}

@keyframes keyTurn {
    0% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-15deg);
    }
    75% {
        transform: rotate(15deg);
    }
    100% {
        transform: rotate(0deg);
    }
}

.playing-cards-decoration .mini-card {
    animation: cardSpin 3s linear infinite;
}

.mini-card:nth-child(1) { animation-delay: 0s; }
.mini-card:nth-child(2) { animation-delay: 0.5s; }
.mini-card:nth-child(3) { animation-delay: 1s; }
.mini-card:nth-child(4) { animation-delay: 1.5s; }

@keyframes cardSpin {
    0% {
        transform: rotateY(0deg);
    }
    100% {
        transform: rotateY(360deg);
    }
}

/* ========================================
   PARTÍCULAS Y EFECTOS DECORATIVOS
   ======================================== */

/* Partículas de brillo */
@keyframes sparkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Efecto de typing para el nombre */
.quinceañera-name {
    overflow: hidden;
    animation: revealName 2s ease forwards;
}

@keyframes revealName {
    from {
        clip-path: inset(0 100% 0 0);
    }
    to {
        clip-path: inset(0 0 0 0);
    }
}

/* ========================================
   TRANSICIONES SUAVES PARA FORMULARIO
   ======================================== */

.guests-group,
.guests-forms,
.not-attending-msg {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.5s ease, opacity 0.5s ease, margin 0.5s ease;
}

.guests-group:not(.hidden),
.guests-forms:not(.hidden),
.not-attending-msg:not(.hidden) {
    max-height: 1000px;
    opacity: 1;
}

.person-form {
    animation: personFormIn 0.4s ease forwards;
}

@keyframes personFormIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========================================
   PREFERS REDUCED MOTION
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
