/* ============================================================
   DXN TIENDA NATURAL — Animations & Motion
   ============================================================ */

/* ----------------------------------------------------------
   Scroll-triggered Fade/Slide Animations
   ---------------------------------------------------------- */

/* Base state — elements start invisible */
.reveal {
    opacity: 0;
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible { opacity: 1; }

/* Directional reveals */
.reveal-up    { transform: translateY(32px); }
.reveal-down  { transform: translateY(-32px); }
.reveal-left  { transform: translateX(-32px); }
.reveal-right { transform: translateX(32px); }
.reveal-scale { transform: scale(0.94); }

.reveal-up.visible,
.reveal-down.visible,
.reveal-left.visible,
.reveal-right.visible,
.reveal-scale.visible {
    transform: none;
}

/* Stagger delays for grid children */
.stagger > *:nth-child(1) { transition-delay: 0ms; }
.stagger > *:nth-child(2) { transition-delay: 80ms; }
.stagger > *:nth-child(3) { transition-delay: 160ms; }
.stagger > *:nth-child(4) { transition-delay: 240ms; }
.stagger > *:nth-child(5) { transition-delay: 320ms; }
.stagger > *:nth-child(6) { transition-delay: 400ms; }
.stagger > *:nth-child(7) { transition-delay: 480ms; }
.stagger > *:nth-child(8) { transition-delay: 560ms; }

/* ----------------------------------------------------------
   Page Load Animations
   ---------------------------------------------------------- */
@keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in-down {
    from { opacity: 0; transform: translateY(-24px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes scale-in {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes slide-in-right {
    from { opacity: 0; transform: translateX(60px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes slide-in-left {
    from { opacity: 0; transform: translateX(-60px); }
    to   { opacity: 1; transform: translateX(0); }
}

.animate-fade-in    { animation: fade-in 0.6s ease both; }
.animate-fade-in-up { animation: fade-in-up 0.7s ease both; }
.animate-scale-in   { animation: scale-in 0.5s ease both; }

/* ----------------------------------------------------------
   Hero Text Entrance
   ---------------------------------------------------------- */
.hero-slide__tag     { animation: fade-in-down 0.6s 0.1s ease both; }
.hero-slide__title   { animation: fade-in-up 0.7s 0.2s ease both; }
.hero-slide__desc    { animation: fade-in-up 0.7s 0.35s ease both; }
.hero-slide__actions { animation: fade-in-up 0.7s 0.50s ease both; }

/* ----------------------------------------------------------
   Hover Lift (Cards)
   ---------------------------------------------------------- */
.hover-lift {
    transition: transform 350ms cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 350ms ease;
}

.hover-lift:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 60px rgba(0,0,0,0.12);
}

/* ----------------------------------------------------------
   Number Counter Animation
   ---------------------------------------------------------- */
@keyframes count-up {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.counter { animation: count-up 0.5s ease both; }

/* ----------------------------------------------------------
   Cart Badge Bounce
   ---------------------------------------------------------- */
@keyframes badge-pop {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.5); }
    60%  { transform: scale(0.9); }
    100% { transform: scale(1); }
}

.badge-pop { animation: badge-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

/* ----------------------------------------------------------
   Floating WhatsApp Pulse
   ---------------------------------------------------------- */
@keyframes pulse-ring {
    0%   { transform: scale(1);   opacity: 0.5; }
    80%  { transform: scale(1.5); opacity: 0; }
    100% { transform: scale(1.5); opacity: 0; }
}

.whatsapp-float__btn::before {
    content: '';
    position: absolute;
    inset: -8px;
    background: rgba(37, 211, 102, 0.35);
    border-radius: 50%;
    animation: pulse-ring 2.5s ease-out infinite;
    pointer-events: none;
}

/* ----------------------------------------------------------
   Order Success Check Animation
   ---------------------------------------------------------- */
@keyframes check-draw {
    0%   { stroke-dashoffset: 100; }
    100% { stroke-dashoffset: 0; }
}

@keyframes circle-draw {
    0%   { stroke-dashoffset: 300; }
    100% { stroke-dashoffset: 0; }
}

.success-circle {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    animation: circle-draw 0.8s ease forwards;
}

.success-check {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: check-draw 0.5s 0.8s ease forwards;
}

/* ----------------------------------------------------------
   Skeleton Loading
   ---------------------------------------------------------- */
@keyframes shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

.skeleton-shimmer {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 37%,
        #f0f0f0 63%
    );
    background-size: 800px 100%;
    animation: shimmer 1.4s infinite;
    border-radius: 4px;
}

/* ----------------------------------------------------------
   Notification Toast
   ---------------------------------------------------------- */
@keyframes toast-in {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(-12px) scale(0.95); }
}

.toast {
    position: fixed;
    bottom: 100px;
    right: 1.5rem;
    z-index: 300;
    background: var(--color-primary);
    color: white;
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    font-weight: 500;
    max-width: 320px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    animation: toast-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toast.out { animation: toast-out 0.3s ease forwards; }
.toast-success { background: #16a34a; }
.toast-error   { background: #dc2626; }

/* ----------------------------------------------------------
   Mobile Navigation Slide
   ---------------------------------------------------------- */
@keyframes mobile-nav-in {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

.mobile-nav {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: flex;
}

.mobile-nav__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    animation: fade-in 0.25s ease both;
}

.mobile-nav__panel {
    position: relative;
    width: min(320px, 85vw);
    height: 100%;
    background: white;
    margin-left: auto;
    animation: mobile-nav-in 0.35s cubic-bezier(0.4, 0, 0.2, 1) both;
    overflow-y: auto;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ----------------------------------------------------------
   Accessibility: Respect reduced motion
   ---------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .reveal,
    .reveal-up,
    .reveal-down,
    .reveal-left,
    .reveal-right,
    .reveal-scale {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .hero-slide__tag,
    .hero-slide__title,
    .hero-slide__desc,
    .hero-slide__actions {
        animation: none !important;
    }

    .whatsapp-float__btn::before { animation: none !important; }
    .toast { animation: none !important; }
}
