/* ===========================
   PixieFinder Magical Animations
   =========================== */

/* ===========================
   Keyframe Animations
   =========================== */

@keyframes twinkle {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

@keyframes sparkle-rotate {
    0% {
        transform: rotate(0deg) scale(1);
    }
    25% {
        transform: rotate(90deg) scale(1.1);
    }
    50% {
        transform: rotate(180deg) scale(1);
    }
    75% {
        transform: rotate(270deg) scale(1.1);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

@keyframes starfield {
    0% {
        transform: translateX(0) translateY(0);
    }
    100% {
        transform: translateX(-100px) translateY(-100px);
    }
}

@keyframes trail-flow {
    0% {
        transform: translateX(-100%) rotate(-5deg);
        opacity: 0;
    }
    50% {
        opacity: 0.6;
    }
    100% {
        transform: translateX(100vw) rotate(-5deg);
        opacity: 0;
    }
}

@keyframes glow-pulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(212, 175, 55, 0.6);
    }
}

@keyframes card-entrance {
    0% {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes star-burst {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(180deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(360deg);
        opacity: 0.8;
    }
}

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

@keyframes timeline-entrance {
    0% {
        opacity: 0;
        transform: translateX(-50px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes stat-counter {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes constellation-draw {
    0% {
        stroke-dashoffset: 100;
        opacity: 0;
    }
    50% {
        opacity: 0.6;
    }
    100% {
        stroke-dashoffset: 0;
        opacity: 1;
    }
}

/* ===========================
   Scroll-triggered Animations
   =========================== */

.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.fade-in-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in-left.animate {
    opacity: 1;
    transform: translateX(0);
}

.fade-in-right {
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in-right.animate {
    opacity: 1;
    transform: translateX(0);
}

.scale-in {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.scale-in.animate {
    opacity: 1;
    transform: scale(1);
}

/* ===========================
   Interactive Animations
   =========================== */

.magical-hover {
    position: relative;
    overflow: hidden;
}

.magical-hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.2), transparent);
    transition: left 0.6s;
}

.magical-hover:hover::before {
    left: 100%;
}

.sparkle-trail {
    position: relative;
}

.sparkle-trail::after {
    content: '✨';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    font-size: 1.5rem;
    pointer-events: none;
    transition: all 0.3s ease;
}

.sparkle-trail:hover::after {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.5);
    animation: twinkle 0.6s ease-in-out;
}

/* ===========================
   Loading States
   =========================== */

.loading-shimmer {
    background: linear-gradient(90deg, 
        rgba(212, 175, 55, 0.1) 0%, 
        rgba(212, 175, 55, 0.3) 50%, 
        rgba(212, 175, 55, 0.1) 100%);
    background-size: 200% 100%;
    animation: magical-shimmer 2s ease-in-out infinite;
}

/* ===========================
   Particle Effects
   =========================== */

.particle-container {
    position: relative;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--starlight-yellow);
    border-radius: 50%;
    pointer-events: none;
    animation: particle-float 3s linear infinite;
}

@keyframes particle-float {
    0% {
        transform: translateY(100vh) translateX(0) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
        transform: translateY(90vh) translateX(10px) scale(1);
    }
    90% {
        opacity: 1;
        transform: translateY(10vh) translateX(-10px) scale(1);
    }
    100% {
        transform: translateY(0vh) translateX(0) scale(0);
        opacity: 0;
    }
}

/* ===========================
   Button Animations
   =========================== */

.btn-magical {
    position: relative;
    overflow: hidden;
}

.btn-magical::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(247, 233, 142, 0.3) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    transition: all 0.5s ease;
    border-radius: 50%;
}

.btn-magical:hover::before {
    width: 300px;
    height: 300px;
}

.btn-magical:active {
    transform: scale(0.95);
}

/* ===========================
   Constellation Effects
   =========================== */

.constellation-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.constellation-line {
    position: absolute;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--magical-gold), transparent);
    opacity: 0.3;
    animation: constellation-draw 2s ease-in-out infinite;
}

/* ===========================
   Text Effects
   =========================== */

.magical-text {
    background: linear-gradient(45deg, var(--magical-gold), var(--starlight-yellow), var(--magical-gold));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: magical-shimmer 3s ease-in-out infinite;
}

.glowing-text {
    text-shadow: 0 0 10px var(--magical-gold), 0 0 20px var(--magical-gold), 0 0 30px var(--magical-gold);
    animation: glow-pulse 2s ease-in-out infinite alternate;
}

/* ===========================
   Stagger Animations for Lists
   =========================== */

.stagger-animation > * {
    opacity: 0;
    transform: translateY(20px);
    animation: card-entrance 0.6s forwards;
}

.stagger-animation > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-animation > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-animation > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-animation > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-animation > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-animation > *:nth-child(6) { animation-delay: 0.6s; }

/* Timeline specific animations */
.timeline-item.animate {
    animation: timeline-entrance 0.8s ease-out forwards;
}

.timeline-stat .stat-number.animate {
    animation: stat-counter 1s ease-out forwards;
}

/* ===========================
   Responsive Animation Controls
   =========================== */

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

@media (max-width: 768px) {
    .particle {
        display: none;
    }
    
    .stars {
        animation-duration: 30s;
    }
    
    .star-trail {
        animation-duration: 12s;
    }
}

/* ===========================
   Performance Optimizations
   =========================== */

.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000;
}

.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}