/* ============================================
   DIAGAPNEE v2 — Animations & Keyframes
   ============================================ */

/* ---------- Breathing Animation ---------- */
@keyframes breathe {
    0%, 100% {
        transform: translate(-50%, -50%) scale(0.85);
        opacity: 0.4;
    }
    50% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.85;
    }
}

/* ---------- Particle Orbit ---------- */
@keyframes orbit {
    from {
        transform: translate(-50%, -50%) rotate(var(--angle)) translateX(var(--orbit)) rotate(calc(-1 * var(--angle)));
    }
    to {
        transform: translate(-50%, -50%) rotate(calc(var(--angle) + 360deg)) translateX(var(--orbit)) rotate(calc(-1 * (var(--angle) + 360deg)));
    }
}

/* ---------- Floating Shapes ---------- */
@keyframes float-shape {
    from { transform: translate(0, 0) rotate(0deg); }
    to { transform: translate(30px, -25px) rotate(8deg); }
}

/* ---------- Pulse Dot (badge) ---------- */
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}

/* ---------- Spin (loading) ---------- */
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- Pulse Urgent (high risk) ---------- */
@keyframes pulse-urgent {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.15), 0 10px 30px rgba(11, 29, 58, 0.1); }
    50% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0), 0 10px 30px rgba(11, 29, 58, 0.1); }
}

/* ---------- Bounce In ---------- */
@keyframes bounceIn {
    0% { transform: scale(0.95); opacity: 0; }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); opacity: 1; }
}

/* ---------- Fade In Up ---------- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   SCROLL-TRIGGERED ANIMATIONS
   ============================================ */

/* Base state: hidden, shifted down */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Visible state (added by IntersectionObserver) */
.fade-in-up.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delays via data-delay */
.fade-in-up[data-delay="1"] { transition-delay: 0.1s; }
.fade-in-up[data-delay="2"] { transition-delay: 0.2s; }
.fade-in-up[data-delay="3"] { transition-delay: 0.3s; }
.fade-in-up[data-delay="4"] { transition-delay: 0.4s; }
.fade-in-up[data-delay="5"] { transition-delay: 0.5s; }
.fade-in-up[data-delay="6"] { transition-delay: 0.6s; }
.fade-in-up[data-delay="7"] { transition-delay: 0.7s; }
.fade-in-up[data-delay="8"] { transition-delay: 0.8s; }

/* Scale fade in (for special elements) */
.fade-in-scale {
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in-scale.is-visible {
    opacity: 1;
    transform: scale(1);
}

/* ============================================
   BUTTON CLICK FEEDBACK
   ============================================ */
.answer-btn.click-feedback {
    animation: bounceIn 0.3s ease;
}

/* ============================================
   RESULT CARD ENTRANCE
   ============================================ */
.result-card-inner.animate-in {
    animation: bounceIn 0.5s cubic-bezier(0.4, 0, 0.2, 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;
    }

    .fade-in-up, .fade-in-scale {
        opacity: 1;
        transform: none;
    }

    .breath-ring--outer,
    .breath-ring--middle,
    .breath-ring--inner {
        animation: none;
        opacity: 0.7;
        transform: translate(-50%, -50%) scale(0.95);
    }

    .breath-particle {
        animation: none;
        display: none;
    }
}
