/* WeTheNorth Wiki - Animations */

/* Scroll-triggered animations */
@keyframes fadeInUp {
    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);
    }
}

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

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

/* Animation classes */
.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

.animate-fade-in-left {
    animation: fadeInLeft 0.6s ease-out forwards;
}

.animate-fade-in-right {
    animation: fadeInRight 0.6s ease-out forwards;
}

.animate-scale-in {
    animation: scaleIn 0.6s ease-out forwards;
}

.animate-slide-in-down {
    animation: slideInDown 0.6s ease-out forwards;
}

/* Stagger delays for multiple elements */
.animate-delay-100 { animation-delay: 0.1s; }
.animate-delay-200 { animation-delay: 0.2s; }
.animate-delay-300 { animation-delay: 0.3s; }
.animate-delay-400 { animation-delay: 0.4s; }
.animate-delay-500 { animation-delay: 0.5s; }

/* Initial state for animated elements */
.animate-on-scroll {
    opacity: 0;
}

/* Hover animations */
.hover-lift {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

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

.hover-scale {
    transition: transform var(--transition-fast);
}

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

.hover-glow {
    transition: box-shadow var(--transition-normal);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(208, 0, 0, 0.3);
}

/* Loading animations */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

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

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

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

@keyframes blink {
    0%, 50% { border-color: transparent; }
    51%, 100% { border-color: var(--primary-red); }
}

.typewriter-text {
    overflow: hidden;
    border-right: 2px solid var(--primary-red);
    white-space: nowrap;
    animation: typewriter 3s steps(40, end), blink 0.75s step-end infinite;
}

/* Counter animation */
@keyframes countUp {
    from { opacity: 0; }
    to { opacity: 1; }
}

.counter-animate {
    animation: countUp 0.5s ease-out;
}

/* Progress bar animation */
@keyframes progressFill {
    from { width: 0%; }
    to { width: var(--progress-width, 100%); }
}

.progress-animate {
    animation: progressFill 1s ease-out forwards;
}

/* Particle effects */
@keyframes float-particle {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
        opacity: 0.7;
    }
}

.floating-particle {
    animation: float-particle 3s ease-in-out infinite;
}

/* Maple leaf animation */
@keyframes maple-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

.maple-leaf-fall {
    animation: maple-fall 8s linear infinite;
}

/* Glow effect */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(208, 0, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(208, 0, 0, 0.8), 0 0 30px rgba(208, 0, 0, 0.6);
    }
}

.glow-effect {
    animation: glow 2s ease-in-out infinite;
}

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

.shake-animation {
    animation: shake 0.5s ease-in-out;
}

/* Slide animations for mobile menu */
@keyframes slideInFromLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

.slide-in-left {
    animation: slideInFromLeft 0.3s ease-out forwards;
}

.slide-out-left {
    animation: slideOutToLeft 0.3s ease-out forwards;
}

/* Accordion animations */
@keyframes accordionOpen {
    from {
        max-height: 0;
        opacity: 0;
    }
    to {
        max-height: 1000px;
        opacity: 1;
    }
}

@keyframes accordionClose {
    from {
        max-height: 1000px;
        opacity: 1;
    }
    to {
        max-height: 0;
        opacity: 0;
    }
}

.accordion-open {
    animation: accordionOpen 0.3s ease-out forwards;
}

.accordion-close {
    animation: accordionClose 0.3s ease-out forwards;
}

/* Gallery transition animations */
@keyframes gallerySlideLeft {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

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

.gallery-slide-left {
    animation: gallerySlideLeft 0.5s ease-out;
}

.gallery-slide-right {
    animation: gallerySlideRight 0.5s ease-out;
}

/* Zoom animation for images */
@keyframes zoomIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.zoom-in {
    animation: zoomIn 0.3s ease-out;
}

/* Ripple effect */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

.ripple-effect {
    position: relative;
    overflow: hidden;
}

.ripple-effect::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple-effect:active::before {
    width: 300px;
    height: 300px;
}

/* Notification animations */
@keyframes slideInFromTop {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

.notification-enter {
    animation: slideInFromTop 0.3s ease-out;
}

.notification-exit {
    animation: slideOutToTop 0.3s ease-out;
}

/* Parallax scroll effect */
.parallax-element {
    transform: translateZ(0);
    transition: transform 0.1s ease-out;
}

/* Reduced motion preferences */
@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;
    }
    
    .snow-container {
        display: none;
    }
    
    .floating-particle,
    .maple-leaf-fall,
    .glow-effect {
        animation: none;
    }
}

/* Performance optimizations */
.will-change-transform {
    will-change: transform;
}

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

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

/* Intersection Observer animations */
.fade-in-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

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

.slide-in-left-on-scroll {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.slide-in-left-on-scroll.visible {
    opacity: 1;
    transform: translateX(0);
}

.slide-in-right-on-scroll {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.slide-in-right-on-scroll.visible {
    opacity: 1;
    transform: translateX(0);
}

.scale-in-on-scroll {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scale-in-on-scroll.visible {
    opacity: 1;
    transform: scale(1);
}

/* Stagger animation delays */
.stagger-delay-1 { transition-delay: 0.1s; }
.stagger-delay-2 { transition-delay: 0.2s; }
.stagger-delay-3 { transition-delay: 0.3s; }
.stagger-delay-4 { transition-delay: 0.4s; }
.stagger-delay-5 { transition-delay: 0.5s; }

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

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

/* Focus animations */
.focus-ring {
    transition: box-shadow var(--transition-fast);
}

.focus-ring:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(208, 0, 0, 0.3);
}

/* Micro-interactions */
.micro-bounce {
    transition: transform var(--transition-fast);
}

.micro-bounce:active {
    transform: scale(0.95);
}

.micro-rotate {
    transition: transform var(--transition-fast);
}

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

/* Theme transition */
.theme-transition {
    transition: background-color var(--transition-normal), 
                color var(--transition-normal),
                border-color var(--transition-normal);
}

/* Smooth scrolling enhancement */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

