/* ================================================
   FlavorQuest — Animations & Micro-interactions
   ================================================ */

/* ── Scroll Reveal ── */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s cubic-bezier(0.2, 0.8, 0.2, 1),
        transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-delay-1 {
    transition-delay: 0.1s;
}

.reveal-delay-2 {
    transition-delay: 0.2s;
}

.reveal-delay-3 {
    transition-delay: 0.3s;
}

.reveal-delay-4 {
    transition-delay: 0.4s;
}

/* ── Scale-up reveal (for cards) ── */
.reveal-scale {
    opacity: 0;
    transform: scale(0.97);
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.reveal-scale.visible {
    opacity: 1;
    transform: scale(1);
}

/* ── Fade-in from left/right ── */
.reveal-left {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-right {
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-left.visible,
.reveal-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* ── Elegant Card hover lift ── */
.card-hover {
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.4s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.08);
    /* Minimal soft shadow */
}

.dark .card-hover:hover {
    box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.5);
}

/* ── Stagger animation for grid children ── */
.stagger-grid>* {
    opacity: 0;
    transform: translateY(20px);
    animation: staggerFadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.stagger-grid>*:nth-child(1) {
    animation-delay: 0.05s;
}

.stagger-grid>*:nth-child(2) {
    animation-delay: 0.1s;
}

.stagger-grid>*:nth-child(3) {
    animation-delay: 0.15s;
}

.stagger-grid>*:nth-child(4) {
    animation-delay: 0.2s;
}

.stagger-grid>*:nth-child(5) {
    animation-delay: 0.25s;
}

.stagger-grid>*:nth-child(6) {
    animation-delay: 0.3s;
}

.stagger-grid>*:nth-child(7) {
    animation-delay: 0.35s;
}

.stagger-grid>*:nth-child(8) {
    animation-delay: 0.4s;
}

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

/* ── Pulse glow (for CTA buttons) ── */
.pulse-glow {
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(242, 108, 13, 0.4);
    }

    50% {
        box-shadow: 0 0 20px 6px rgba(242, 108, 13, 0.15);
    }
}

/* ── Shimmer loading skeleton (Fintech Style) ── */
.skeleton {
    background: linear-gradient(90deg,
            rgba(0, 0, 0, 0.04) 25%,
            rgba(0, 0, 0, 0.08) 50%,
            rgba(0, 0, 0, 0.04) 75%);
    background-size: 200% 100%;
    animation: shimmer 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    border-radius: 8px;
}

.dark .skeleton {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.03) 25%,
            rgba(255, 255, 255, 0.06) 50%,
            rgba(255, 255, 255, 0.03) 75%);
    background-size: 200% 100%;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ── Bounce animation (for hearts, badges) ── */
@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }

    50% {
        transform: scale(1.15);
    }

    70% {
        transform: scale(0.9);
    }

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

.animate-bounce-in {
    animation: bounceIn 0.5s cubic-bezier(0.47, 1.64, 0.41, 0.8);
}

/* ── Floating animation (Subtle) ── */
@keyframes floatSubtle {

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

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

.animate-float {
    animation: floatSubtle 4s ease-in-out infinite;
}

/* ── Magnetic Button Hover (Simulated soft pull) ── */
.btn-magnetic {
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.btn-magnetic:hover {
    transform: scale(1.02);
}

/* ── Confetti/Pop effect for hearts ── */
@keyframes popHeart {
    0% {
        transform: scale(1);
    }

    40% {
        transform: scale(1.25);
    }

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

.heart-pop {
    animation: popHeart 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ── Counter spin (for XP numbers) ── */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.animate-count {
    animation: countUp 0.4s ease-out both;
}

/* ── Elegant Page transition fade ── */
.page-enter {
    animation: pageEnter 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

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

/* ── Nav glass shimmer on scroll ── */
.nav-scrolled {
    backdrop-filter: blur(12px) saturate(1.5);
    box-shadow: 0 1px 20px rgba(0, 0, 0, 0.08);
}

/* ── Tooltip on hover ── */
[data-tip]:hover::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 99;
    pointer-events: none;
    animation: tooltipIn 0.15s ease-out;
}

@keyframes tooltipIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ── Smooth image reveal ── */
.img-reveal {
    opacity: 0;
    transition: opacity 0.6s ease;
}

.img-reveal.loaded {
    opacity: 1;
}

/* ── Ripple effect on buttons ── */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(255, 255, 255, 0.3) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
}

.ripple:active::after {
    opacity: 1;
}

/* ── Allergen marking (recipe cards) ── */
.allergen-flagged {
    border: 2px solid #ef4444 !important;
    border-radius: 12px;
    position: relative;
}

.allergen-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 9999px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    animation: badgePop 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes badgePop {
    from { transform: scale(0.7); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}