/**
 * Valentine Website - Animations
 * ================================
 * Tasteful micro-animations and unique transitions
 */

/* ─────────────────────────────────────────────────────────────
   BASIC KEYFRAME ANIMATIONS
   ───────────────────────────────────────────────────────────── */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOutDown {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(30px);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* Gentle pulse */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* Heart pulse */
@keyframes heartPulse {

    0%,
    100% {
        transform: scale(1);
    }

    14% {
        transform: scale(1.15);
    }

    28% {
        transform: scale(1);
    }

    42% {
        transform: scale(1.15);
    }

    70% {
        transform: scale(1);
    }
}

@keyframes heartBeat {

    0%,
    100% {
        transform: scale(1);
    }

    25% {
        transform: scale(1.1);
    }

    40% {
        transform: scale(1);
    }

    60% {
        transform: scale(1.1);
    }
}

@keyframes gentlePulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

/* Floating hearts going up */
@keyframes floatUp {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 0.4;
    }

    90% {
        opacity: 0.4;
    }

    100% {
        transform: translateY(-100vh) rotate(360deg);
        opacity: 0;
    }
}

/* Sparkle burst */
@keyframes sparkle {

    0%,
    100% {
        opacity: 0;
        transform: scale(0) rotate(0deg);
    }

    50% {
        opacity: 1;
        transform: scale(1) rotate(180deg);
    }
}

/* Gentle bounce */
@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

/* Gentle float */
@keyframes gentleFloat {

    0%,
    100% {
        transform: translateY(0) rotate(-2deg);
    }

    50% {
        transform: translateY(-10px) rotate(2deg);
    }
}

/* ─────────────────────────────────────────────────────────────
   UNIQUE QUESTION TRANSITIONS
   ───────────────────────────────────────────────────────────── */

/* ZOOM ANIMATIONS (Question 1 → 2) */
@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.7);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes zoomOut {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.7);
    }
}

/* FLIP ANIMATIONS (Question 2 → 3) */
@keyframes flipIn {
    from {
        opacity: 0;
        transform: perspective(600px) rotateY(-90deg);
    }

    to {
        opacity: 1;
        transform: perspective(600px) rotateY(0deg);
    }
}

@keyframes flipOut {
    from {
        opacity: 1;
        transform: perspective(600px) rotateY(0deg);
    }

    to {
        opacity: 0;
        transform: perspective(600px) rotateY(90deg);
    }
}

/* ROTATE ANIMATIONS (Question 3 → 4) */
@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-15deg) scale(0.9);
    }

    to {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
}

@keyframes rotateOut {
    from {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }

    to {
        opacity: 0;
        transform: rotate(15deg) scale(0.9);
    }
}

/* BOUNCE ANIMATIONS (Question 4 → 5) */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }

    50% {
        transform: scale(1.05);
    }

    70% {
        transform: scale(0.95);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounceOut {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    25% {
        transform: scale(1.05);
    }

    100% {
        opacity: 0;
        transform: scale(0.3);
    }
}

/* SWING ANIMATIONS (Question 5 → Proposal) */
@keyframes swingIn {
    0% {
        opacity: 0;
        transform: rotate(-10deg) translateY(-50px);
    }

    50% {
        transform: rotate(5deg) translateY(0);
    }

    70% {
        transform: rotate(-3deg);
    }

    100% {
        opacity: 1;
        transform: rotate(0deg);
    }
}

/* SLIDE ANIMATIONS (for backward navigation) */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(50px);
    }
}

/* ─────────────────────────────────────────────────────────────
   ANIMATION CLASSES FOR QUESTION TRANSITIONS
   ───────────────────────────────────────────────────────────── */

/* Zoom */
.question-card.anim-zoomIn {
    animation: zoomIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.question-card.anim-zoomOut {
    animation: zoomOut 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Flip */
.question-card.anim-flipIn {
    animation: flipIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.question-card.anim-flipOut {
    animation: flipOut 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Rotate */
.question-card.anim-rotateIn {
    animation: rotateIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.question-card.anim-rotateOut {
    animation: rotateOut 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Bounce */
.question-card.anim-bounceIn {
    animation: bounceIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.question-card.anim-bounceOut {
    animation: bounceOut 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Swing */
.question-card.anim-swingIn {
    animation: swingIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Fade */
.question-card.anim-fadeOut {
    animation: fadeOut 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Slide (for going back) */
.question-card.anim-slideInLeft {
    animation: slideInLeft 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.question-card.anim-slideOutRight {
    animation: slideOutRight 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ─────────────────────────────────────────────────────────────
   PROPOSAL SCREEN ANIMATIONS
   ───────────────────────────────────────────────────────────── */

/* Orbiting hearts ring */
@keyframes orbitHeart {
    0% {
        transform: translate(-50%, -50%) rotate(calc(var(--i) * 45deg)) translateX(70px) rotate(calc(var(--i) * -45deg));
    }

    100% {
        transform: translate(-50%, -50%) rotate(calc(var(--i) * 45deg + 360deg)) translateX(70px) rotate(calc(var(--i) * -45deg - 360deg));
    }
}

/* Proposal screen entrance */
@keyframes proposalEntrance {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(30px);
    }

    50% {
        transform: scale(1.02) translateY(-5px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.proposal-screen.active .proposal-content {
    animation: proposalEntrance 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─────────────────────────────────────────────────────────────
   SUCCESS SCREEN ANIMATIONS
   ───────────────────────────────────────────────────────────── */

/* Celebrate heart (for YES response) */
@keyframes celebrateHeart {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1.3);
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Confetti burst */
@keyframes confetti {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(-100px) rotate(720deg);
        opacity: 0;
    }
}

/* Sparkle positions */
.success-screen.active .sparkle:nth-child(1) {
    top: 10%;
    left: 10%;
    animation-delay: 0.1s;
}

.success-screen.active .sparkle:nth-child(2) {
    top: 10%;
    right: 10%;
    animation-delay: 0.3s;
}

.success-screen.active .sparkle:nth-child(3) {
    bottom: 10%;
    left: 10%;
    animation-delay: 0.5s;
}

.success-screen.active .sparkle:nth-child(4) {
    bottom: 10%;
    right: 10%;
    animation-delay: 0.7s;
}

.success-screen.active .sparkle:nth-child(5) {
    top: 50%;
    left: 0;
    animation-delay: 0.2s;
}

.success-screen.active .sparkle:nth-child(6) {
    top: 50%;
    right: 0;
    animation-delay: 0.4s;
}

.success-screen.active .sparkle:nth-child(7) {
    top: 0;
    left: 50%;
    animation-delay: 0.6s;
}

.success-screen.active .sparkle:nth-child(8) {
    bottom: 0;
    left: 50%;
    animation-delay: 0.8s;
}

/* ─────────────────────────────────────────────────────────────
   SCREEN TRANSITIONS
   ───────────────────────────────────────────────────────────── */

.screen.entering {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.screen.exiting {
    animation: fadeOutDown 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ─────────────────────────────────────────────────────────────
   BUTTON RIPPLE EFFECT
   ───────────────────────────────────────────────────────────── */

.btn .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ─────────────────────────────────────────────────────────────
   ANSWER SELECTION ANIMATION
   ───────────────────────────────────────────────────────────── */

.answer-option.selected .answer-label {
    animation: selectPop 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes selectPop {
    0% {
        transform: translateX(4px) scale(1);
    }

    50% {
        transform: translateX(4px) scale(1.02);
    }

    100% {
        transform: translateX(4px) scale(1);
    }
}

/* ─────────────────────────────────────────────────────────────
   REDUCED MOTION
   ───────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .floating-heart,
    .ring-heart {
        display: none;
    }
}