/* ========================================
   ANIMATIONS - Tuscan Sun Boutique
   ======================================== */

/* Preloader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-cream);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-preloader);
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader {
    text-align: center;
}

.sun-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    animation: spin-slow 4s linear infinite;
}

.sun-icon svg {
    width: 100%;
    height: 100%;
}

.mandala-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 1rem;
    animation: spin-slow 8s linear infinite;
}

.mandala-icon svg {
    width: 100%;
    height: 100%;
}

.loader-text {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--color-terracotta);
    letter-spacing: 0.1em;
    animation: pulse-text 1.5s ease-in-out infinite;
}

@keyframes spin-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pulse-text {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Fade Animations */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.fade-in:nth-child(1) { transition-delay: 0.1s; }
.fade-in:nth-child(2) { transition-delay: 0.3s; }
.fade-in:nth-child(3) { transition-delay: 0.5s; }
.fade-in:nth-child(4) { transition-delay: 0.7s; }
.fade-in:nth-child(5) { transition-delay: 0.9s; }

/* Reveal Animations */
.reveal-up {
    opacity: 0;
    transform: translateY(60px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-up.revealed {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-60px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-left.revealed {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(60px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-right.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* Hero Particles */
.hero-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: rgba(232, 193, 114, 0.35);
    animation: float-particle linear infinite;
}

.particle:nth-child(3n) {
    background: rgba(232, 148, 74, 0.3);
}

.particle:nth-child(3n+1) {
    background: rgba(212, 96, 122, 0.25);
}

.particle:nth-child(5n) {
    background: rgba(184, 137, 158, 0.22);
}

@keyframes float-particle {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-10vh) rotate(720deg);
        opacity: 0;
    }
}

/* Hero Scroll Indicator */
.hero-scroll-indicator {
    position: relative;
    margin-top: 3rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.scroll-arrow {
    margin-top: 0.5rem;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(10px); }
    60% { transform: translateY(5px); }
}

/* Live Pulse */
.live-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(225, 48, 108, 0.15);
    animation: live-pulse 2s ease-out infinite;
}

@keyframes live-pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.8);
        opacity: 0;
    }
}

/* Card Hover Effects */
.category-card {
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.category-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 25px 60px rgba(139, 90, 56, 0.15);
}

.category-card:hover .card-image {
    transform: scale(1.08);
}

.category-card:hover .card-overlay {
    opacity: 1;
}

.card-image {
    transition: transform 0.6s ease;
}

.card-overlay {
    transition: opacity 0.4s ease;
}

/* Showcase Items */
.showcase-item {
    transition: transform 0.3s ease;
}

.showcase-item:hover .showcase-image {
    box-shadow: 0 20px 50px rgba(139, 90, 56, 0.2);
}

.showcase-image {
    transition: box-shadow 0.4s ease;
}

/* Process Step Hover */
.process-step {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.process-step:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.process-step:hover .step-icon {
    transform: scale(1.1) rotate(5deg);
}

.step-icon {
    transition: transform 0.3s ease;
}

/* Back to Top Button */
.back-to-top {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(212, 149, 106, 0.4);
}

/* Shimmer effect for loading states */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.shimmer {
    background: linear-gradient(
        90deg,
        var(--color-sand) 25%,
        var(--color-cream) 50%,
        var(--color-sand) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

/* Gradient text animation */
@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.animated-gradient {
    background: linear-gradient(
        135deg,
        var(--color-terracotta),
        var(--color-coral),
        var(--color-gold),
        var(--color-terracotta)
    );
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-shift 4s ease infinite;
}

/* Smooth page transitions */
.page-transition-enter {
    opacity: 0;
    transform: translateY(20px);
}

.page-transition-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* Image lazy load fade-in */
img[data-src] {
    opacity: 0;
    transition: opacity 0.5s ease;
}

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

/* Stagger animation for grid items */
.stagger-item:nth-child(1) { transition-delay: 0.05s; }
.stagger-item:nth-child(2) { transition-delay: 0.1s; }
.stagger-item:nth-child(3) { transition-delay: 0.15s; }
.stagger-item:nth-child(4) { transition-delay: 0.2s; }
.stagger-item:nth-child(5) { transition-delay: 0.25s; }
.stagger-item:nth-child(6) { transition-delay: 0.3s; }
.stagger-item:nth-child(7) { transition-delay: 0.35s; }
.stagger-item:nth-child(8) { transition-delay: 0.4s; }
.stagger-item:nth-child(9) { transition-delay: 0.45s; }

/* Focus styles for accessibility */
:focus-visible {
    outline: 2px solid var(--color-terracotta);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--color-terracotta);
    outline-offset: 2px;
}

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

    .hero-particles,
    .particle {
        display: none !important;
    }

    .mandala-icon,
    .sun-icon {
        animation: none !important;
    }

    .loader-text {
        animation: none !important;
        opacity: 1 !important;
    }
}
