/**
 * Messiah 2027 - Professional Animation System
 * Smooth transitions, micro-interactions, and visual enhancements
 */

/* Intersection Observer Animation Classes */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.animate-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.animate-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.animate-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

/* Staggered Animation Delays */
.animate-delay-1 { transition-delay: 0.1s; }
.animate-delay-2 { transition-delay: 0.2s; }
.animate-delay-3 { transition-delay: 0.3s; }
.animate-delay-4 { transition-delay: 0.4s; }
.animate-delay-5 { transition-delay: 0.5s; }

/* Hero Section Animations */
.year-display {
    animation: yearPulse 4s ease-in-out infinite;
    background: linear-gradient(135deg, var(--divine-gold) 0%, var(--urgent-red) 100%);
    background-size: 200% 200%;
    animation: yearPulse 4s ease-in-out infinite, gradientShift 8s ease-in-out infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes yearPulse {
    0%, 100% {
        transform: scale(1);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.02);
        filter: brightness(1.2);
    }
}

@keyframes gradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* Card Hover Enhancements */
.point-card,
.card,
.confirmation-box {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
}

.point-card::before,
.card::before,
.confirmation-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(251, 191, 36, 0.1), transparent);
    transition: left 0.6s ease;
    z-index: 1;
}

.point-card:hover::before,
.card:hover::before,
.confirmation-box:hover::before {
    left: 100%;
}

.point-card:hover,
.card:hover,
.confirmation-box:hover {
    transform: translateY(-8px) rotateX(5deg);
    box-shadow: 0 20px 60px rgba(251, 191, 36, 0.3);
    border-color: var(--divine-gold);
}

/* Button Enhancements */
.btn {
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.btn:hover::after {
    width: 300px;
    height: 300px;
}

.btn:active {
    transform: translateY(2px);
}

/* Table Animations */
.calculation-table {
    animation: slideUp 0.8s ease forwards;
}

.calculation-table table {
    border-collapse: separate;
    border-spacing: 0;
}

.calculation-table tr {
    opacity: 0;
    animation: tableRowSlide 0.6s ease forwards;
}

.calculation-table tr:nth-child(1) { animation-delay: 0.1s; }
.calculation-table tr:nth-child(2) { animation-delay: 0.2s; }
.calculation-table tr:nth-child(3) { animation-delay: 0.3s; }
.calculation-table tr:nth-child(4) { animation-delay: 0.4s; }
.calculation-table tr:nth-child(5) { animation-delay: 0.5s; }
.calculation-table tr:nth-child(6) { animation-delay: 0.6s; }
.calculation-table tr:nth-child(7) { animation-delay: 0.7s; }
.calculation-table tr:nth-child(8) { animation-delay: 0.8s; }

@keyframes tableRowSlide {
    0% {
        opacity: 0;
        transform: translateX(-30px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.calculation-table tr.highlight {
    position: relative;
    background: linear-gradient(90deg, 
        rgba(251, 191, 36, 0.1), 
        rgba(251, 191, 36, 0.05), 
        rgba(251, 191, 36, 0.1)
    );
    background-size: 200% 100%;
    animation: highlightShimmer 3s ease-in-out infinite;
}

@keyframes highlightShimmer {
    0%, 100% {
        background-position: 200% 0;
    }
    50% {
        background-position: -200% 0;
    }
}

/* Timeline Animations */
.beast-timeline {
    perspective: 1000px;
}

.beast-date {
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform-style: preserve-3d;
}

.beast-date:hover {
    transform: translateY(-10px) rotateY(10deg);
}

.beast-year {
    position: relative;
    overflow: hidden;
}

.beast-year::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(220, 38, 38, 0.4), transparent);
    animation: yearSweep 4s ease-in-out infinite;
}

@keyframes yearSweep {
    0% { left: -100%; }
    50% { left: 100%; }
    100% { left: 100%; }
}

/* Scroll Indicators */
.scroll-indicator {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--divine-gold), var(--urgent-red));
    z-index: 1001;
    transition: width 0.1s ease;
}

/* Parallax Effects for Hero Background */
.hero {
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 70%, rgba(107, 70, 193, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 70% 30%, rgba(251, 191, 36, 0.05) 0%, transparent 50%);
    animation: floatingOrbs 20s ease-in-out infinite;
    z-index: 0;
}

@keyframes floatingOrbs {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    33% {
        transform: translate(30px, -30px) rotate(120deg);
    }
    66% {
        transform: translate(-20px, 20px) rotate(240deg);
    }
}

.hero-content {
    position: relative;
    z-index: 1;
}

/* Typewriter Effect for Key Text */
.typewriter {
    overflow: hidden;
    border-right: 3px solid var(--divine-gold);
    white-space: nowrap;
    margin: 0 auto;
    animation: typing 3s steps(40, end), blink-caret 1s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--divine-gold); }
}

/* Sacred Name Glow Effect */
.sacred-name {
    position: relative;
    display: inline-block;
    animation: sacredGlow 3s ease-in-out infinite;
}

@keyframes sacredGlow {
    0%, 100% {
        text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
    }
    50% {
        text-shadow: 0 0 20px rgba(251, 191, 36, 0.8), 0 0 30px rgba(251, 191, 36, 0.3);
    }
}

/* Number Counter Animation */
.counter {
    opacity: 0;
}

.counter.counting {
    opacity: 1;
    animation: countUp 2s ease-out forwards;
}

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

/* Smooth Page Transitions */
.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--midnight), var(--deep-space));
    z-index: 9998;
    transform: translateY(-100%);
    transition: transform 0.6s cubic-bezier(0.77, 0, 0.175, 1);
}

.page-transition.active {
    transform: translateY(0);
}

/* Enhanced Loading States */
.loading-shimmer {
    background: linear-gradient(90deg, 
        rgba(255,255,255,0) 0%, 
        rgba(255,255,255,0.1) 50%, 
        rgba(255,255,255,0) 100%
    );
    background-size: 200px 100%;
    animation: shimmer 2s infinite;
}

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

/* Error State Animations */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

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

/* Success State Animation */
@keyframes checkmark {
    0% {
        stroke-dasharray: 0 100;
    }
    100% {
        stroke-dasharray: 100 0;
    }
}

.success-checkmark {
    animation: checkmark 1s ease-in-out forwards;
}

/* Reduced Motion Preference */
@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;
    }
    
    .year-display {
        animation: none;
    }
    
    .typewriter {
        border-right: none;
        animation: none;
        white-space: normal;
    }
}