/* Dinosaur Encyclopedia - Custom Animations */

/* Base Animation Variables */
:root {
    --animation-duration-fast: 0.3s;
    --animation-duration-normal: 0.6s;
    --animation-duration-slow: 1.2s;
    --animation-easing-ease: ease;
    --animation-easing-ease-in: ease-in;
    --animation-easing-ease-out: ease-out;
    --animation-easing-ease-in-out: ease-in-out;
}

/* Fade In Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide Animations */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Scale Animations */
@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes scaleInUp {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Rotation Animations */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-10px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(10px);
    }
}

/* Bounce Animations */
@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translateY(0);
    }
    40%, 43% {
        transform: translateY(-30px);
    }
    70% {
        transform: translateY(-15px);
    }
    90% {
        transform: translateY(-4px);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Dinosaur Specific Animations */
@keyframes dinosaurWalk {
    0%, 100% {
        transform: translateX(0) translateY(0);
    }
    25% {
        transform: translateX(5px) translateY(-3px);
    }
    50% {
        transform: translateX(0) translateY(0);
    }
    75% {
        transform: translateX(-5px) translateY(-3px);
    }
}

@keyframes dinosaurRoar {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.1) rotate(-2deg);
    }
    50% {
        transform: scale(1.2) rotate(0deg);
    }
    75% {
        transform: scale(1.1) rotate(2deg);
    }
}

@keyframes dinosaurStomp {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
    55% {
        transform: translateY(0);
    }
}

@keyframes pterodactylFly {
    0% {
        transform: translateX(-100px) translateY(0);
    }
    25% {
        transform: translateX(-50px) translateY(-20px);
    }
    50% {
        transform: translateX(0) translateY(-10px);
    }
    75% {
        transform: translateX(50px) translateY(-20px);
    }
    100% {
        transform: translateX(100px) translateY(0);
    }
}

/* Loading Animations */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes loadingPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes skeleton {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

/* Text Animations */
@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

@keyframes textGlow {
    0%, 100% {
        text-shadow: 0 0 5px rgba(13, 110, 253, 0.5);
    }
    50% {
        text-shadow: 0 0 20px rgba(13, 110, 253, 0.8);
    }
}

/* Background Animations */
@keyframes backgroundShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

@keyframes particleFloat {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) translateX(100px) rotate(360deg);
        opacity: 0;
    }
}

/* Hover Animations */
.hover-lift {
    transition: transform var(--animation-duration-fast) var(--animation-easing-ease-out);
}

.hover-lift:hover {
    transform: translateY(-5px);
}

.hover-scale {
    transition: transform var(--animation-duration-fast) var(--animation-easing-ease-out);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-rotate {
    transition: transform var(--animation-duration-normal) var(--animation-easing-ease-out);
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn var(--animation-duration-normal) var(--animation-easing-ease-out);
}

.animate-fade-in-up {
    animation: fadeInUp var(--animation-duration-normal) var(--animation-easing-ease-out);
}

.animate-fade-in-down {
    animation: fadeInDown var(--animation-duration-normal) var(--animation-easing-ease-out);
}

.animate-fade-in-left {
    animation: fadeInLeft var(--animation-duration-normal) var(--animation-easing-ease-out);
}

.animate-fade-in-right {
    animation: fadeInRight var(--animation-duration-normal) var(--animation-easing-ease-out);
}

.animate-slide-in-up {
    animation: slideInUp var(--animation-duration-normal) var(--animation-easing-ease-out);
}

.animate-slide-in-down {
    animation: slideInDown var(--animation-duration-normal) var(--animation-easing-ease-out);
}

.animate-slide-in-left {
    animation: slideInLeft var(--animation-duration-normal) var(--animation-easing-ease-out);
}

.animate-slide-in-right {
    animation: slideInRight var(--animation-duration-normal) var(--animation-easing-ease-out);
}

.animate-scale-in {
    animation: scaleIn var(--animation-duration-normal) var(--animation-easing-ease-out);
}

.animate-bounce {
    animation: bounce var(--animation-duration-slow) var(--animation-easing-ease);
}

.animate-pulse {
    animation: pulse 2s infinite var(--animation-easing-ease-in-out);
}

.animate-dinosaur-walk {
    animation: dinosaurWalk 2s infinite var(--animation-easing-ease-in-out);
}

.animate-dinosaur-roar {
    animation: dinosaurRoar 1s var(--animation-easing-ease-in-out);
}

.animate-dinosaur-stomp {
    animation: dinosaurStomp 1s infinite var(--animation-easing-ease-in-out);
}

.animate-pterodactyl-fly {
    animation: pterodactylFly 4s infinite linear;
}

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

.animate-loading-pulse {
    animation: loadingPulse 1.5s ease-in-out infinite;
}

/* Staggered Animations */
.stagger-animation > * {
    opacity: 0;
    animation: fadeInUp var(--animation-duration-normal) var(--animation-easing-ease-out) 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; }
.stagger-animation > *:nth-child(7) { animation-delay: 0.7s; }
.stagger-animation > *:nth-child(8) { animation-delay: 0.8s; }
.stagger-animation > *:nth-child(9) { animation-delay: 0.9s; }
.stagger-animation > *:nth-child(10) { animation-delay: 1.0s; }

/* Scroll-triggered Animations */
.scroll-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity var(--animation-duration-normal) var(--animation-easing-ease-out),
                transform var(--animation-duration-normal) var(--animation-easing-ease-out);
}

.scroll-animate.animated {
    opacity: 1;
    transform: translateY(0);
}

/* Parallax Effects */
.parallax {
    transition: transform 0.1s ease-out;
}

/* Loading States */
.skeleton-loader {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeleton 1.5s infinite;
}

/* Responsive Animation Control */
@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;
    }
    
    .animate-pulse,
    .animate-dinosaur-walk,
    .animate-dinosaur-stomp,
    .animate-pterodactyl-fly,
    .animate-spin,
    .animate-loading-pulse {
        animation: none !important;
    }
}

/* Mobile-specific Animations */
@media (max-width: 768px) {
    .animate-fade-in,
    .animate-slide-in-up,
    .animate-slide-in-down,
    .animate-slide-in-left,
    .animate-slide-in-right {
        animation-duration: var(--animation-duration-fast);
    }
}

/* Performance Optimization */
.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

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