/* ==========================================================================
   Franco Store — Animations & Transitions
   ========================================================================== */

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

/* ----- Motion Tokens ----- */
:root {
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
    --ease-spring: cubic-bezier(0.2, 0, 0, 1);
    --duration-fast: 150ms;
    --duration-base: 250ms;
    --duration-slow: 400ms;
}

/* ----- Live Indicator Pulse ----- */
@keyframes live-pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.live-pulse {
    animation: live-pulse 2s infinite;
}

/* ----- Fade In Up ----- */
@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fade-in-up 0.5s var(--ease-spring) forwards;
}

/* ----- Fade In ----- */
@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fade-in 0.3s var(--ease-spring) forwards;
}

/* ----- Slide In (Sidebar) ----- */
@keyframes slide-in-right {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes slide-out-right {
    from { transform: translateX(0); }
    to { transform: translateX(100%); }
}

.slide-in-right {
    animation: slide-in-right 0.3s var(--ease-spring) forwards;
}

.slide-out-right {
    animation: slide-out-right 0.3s var(--ease-spring) forwards;
}

@keyframes slide-in-left {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

@keyframes slide-out-left {
    from { transform: translateX(0); }
    to { transform: translateX(-100%); }
}

.slide-in-left {
    animation: slide-in-left 0.3s var(--ease-spring) forwards;
}

/* ----- Scale Up ----- */
@keyframes scale-up {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.scale-up {
    animation: scale-up 0.2s var(--ease-spring) forwards;
}

/* ----- Scroll Reveal Engine (Single, Premium Definition) ----- */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(24px);
    filter: blur(4px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                filter 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform, filter;
}

.reveal-on-scroll.revealed {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

/* Stagger Utilities for Reveal */
.delay-100 { transition-delay: 100ms; }
.delay-200 { transition-delay: 200ms; }
.delay-300 { transition-delay: 300ms; }
.delay-400 { transition-delay: 400ms; }

/* ----- 3D Premium Card Hover ----- */
.hover-3d {
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
    transform-origin: top center;
}
.hover-3d:hover {
    transform: scale(1.02);
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.3), 0 0 20px 0 var(--color-primary-fixed-dim);
    z-index: 20;
}

/* ----- Countdown Tick ----- */
@keyframes tick {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.tick {
    animation: tick 1s ease-in-out;
}

/* ----- Shimmer Loading ----- */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.shimmer {
    background: linear-gradient(90deg,
        var(--color-surface-container) 25%,
        var(--color-surface-container-high) 50%,
        var(--color-surface-container) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* ----- Hover Lift for Cards ----- */
.hover-lift {
    transition: transform var(--duration-base) var(--ease-out-quart),
                box-shadow var(--duration-base) var(--ease-out-quart);
    will-change: transform;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-elevated);
}

/* ----- Smooth Theme Transition ----- */
.theme-transition,
.theme-transition *,
.theme-transition *::before,
.theme-transition *::after {
    transition: none !important;
}

/* ----- Staggered Animation Delays ----- */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }

/* ----- Nav Link Underline Animation ----- */
.fs-nav-link {
    position: relative;
    padding-bottom: 2px;
}

.fs-nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--color-primary);
    transition: width var(--duration-base) var(--ease-out-expo),
                left var(--duration-base) var(--ease-out-expo);
    border-radius: 2px;
}

.fs-nav-link:hover::after,
.fs-nav-link.text-primary::after {
    width: 100%;
    left: 0;
}

/* ----- Premium Button Glow ----- */
.emerald-gradient {
    position: relative;
    overflow: hidden;
}

.emerald-gradient::before {
    content: '';
    position: absolute;
    inset: 0;
    background: inherit;
    filter: blur(12px);
    opacity: 0;
    transition: opacity var(--duration-base);
    z-index: -1;
    transform: translateY(4px);
}

.emerald-gradient:hover::before {
    opacity: 0.4;
}

/* ----- Bottom Nav Tap Animation ----- */
.fs-bottom-nav__item {
    transition: transform var(--duration-fast) var(--ease-spring),
                color var(--duration-fast);
}

.fs-bottom-nav__item:active {
    transform: scale(0.9);
}

/* ----- Sidebar Link Hover ----- */
.fs-sidebar__links a {
    transition: background var(--duration-fast),
                padding-left var(--duration-fast) var(--ease-spring);
}

.fs-sidebar__links a:hover {
    padding-left: 2rem;
}

/* ----- Footer Link Hover ----- */
footer a {
    transition: color var(--duration-fast),
                transform var(--duration-fast);
}

footer a:hover {
    transform: translateX(2px);
}

/* ----- Card Interaction Premium Glow ----- */
.fs-card,
[class*="bg-surface-container-lowest"][class*="rounded-xl"] {
    transition: transform var(--duration-base) var(--ease-out-quart),
                box-shadow var(--duration-base) var(--ease-out-quart),
                border-color var(--duration-base);
}

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

.animate-spin {
    animation: spin 1s linear infinite;
}

/* ----- Image Load Transition ----- */
img {
    opacity: 1;
    transition: opacity var(--duration-base);
}

img[data-src] {
    opacity: 0;
}

img[data-src].loaded {
    opacity: 1;
}

/* ----- Focus Ring ----- */
*:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* On mobile, reduce motion intensity */
@media (max-width: 768px) {
    .hover-lift:hover {
        transform: translateY(-2px);
    }
    
    .reveal-on-scroll {
        transform: translateY(12px);
        filter: none;
    }

    .fs-card:hover {
        transform: translateY(-2px) !important;
    }
}
