/* =====================================================
   THE TEMPORAL HEALER - Animations
   ===================================================== */

/* =====================================================
   KEYFRAME ANIMATIONS
   ===================================================== */

@keyframes rotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes rotateVortex {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

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

@keyframes emerge {
    0% {
        transform: translateX(-50%) translateY(20px) scale(0.9);
        opacity: 0.5;
    }
    100% {
        transform: translateX(-50%) translateY(0) scale(1);
        opacity: 1;
    }
}

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

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

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-20px) rotate(5deg);
    }
    50% {
        transform: translateY(-10px) rotate(-3deg);
    }
    75% {
        transform: translateY(-25px) rotate(3deg);
    }
}

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

@keyframes drawLine {
    to {
        stroke-dashoffset: 0;
    }
}

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

@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 245, 255, 0.3),
                    0 0 40px rgba(0, 245, 255, 0.1);
    }
    50% {
        box-shadow: 0 0 30px rgba(0, 245, 255, 0.5),
                    0 0 60px rgba(0, 245, 255, 0.2);
    }
}

@keyframes textGlow {
    0%, 100% {
        text-shadow: 0 0 10px rgba(0, 245, 255, 0.5),
                     0 0 20px rgba(0, 245, 255, 0.3);
    }
    50% {
        text-shadow: 0 0 20px rgba(0, 245, 255, 0.8),
                     0 0 40px rgba(0, 245, 255, 0.5);
    }
}

@keyframes warpIn {
    0% {
        transform: perspective(1000px) rotateX(90deg) scale(0.5);
        opacity: 0;
    }
    100% {
        transform: perspective(1000px) rotateX(0deg) scale(1);
        opacity: 1;
    }
}

@keyframes dataStream {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

/* =====================================================
   PARTICLE EFFECTS (CSS-based fallback)
   ===================================================== */

.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--color-accent-cyan);
    border-radius: 50%;
    animation: float 20s ease-in-out infinite;
}

/* =====================================================
   BLACK HOLE ENHANCED ANIMATIONS
   ===================================================== */

.blackhole {
    animation: pulse 4s ease-in-out infinite;
}

.accretion-disk {
    animation: rotate 8s linear infinite;
}

.accretion-disk::after {
    content: '';
    position: absolute;
    top: -10%;
    left: -10%;
    right: -10%;
    bottom: -10%;
    background: inherit;
    border-radius: 50%;
    filter: blur(15px);
    opacity: 0.5;
    animation: pulse 3s ease-in-out infinite alternate;
}

.event-horizon {
    animation: pulse 5s ease-in-out infinite;
}

/* Gravitational Lensing Effect */
.blackhole-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 250px;
    height: 250px;
    transform: translate(-50%, -50%);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    animation: gravitationalLens 4s ease-in-out infinite;
}

@keyframes gravitationalLens {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        border-color: rgba(255, 255, 255, 0.05);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
        border-color: rgba(0, 245, 255, 0.1);
    }
}

/* =====================================================
   DATA VORTEX ANIMATIONS
   ===================================================== */

.data-fragment {
    animation: fragmentFloat 3s ease-in-out infinite;
}

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

.ring-1 .data-fragment:nth-child(1) { animation-delay: 0s; }
.ring-1 .data-fragment:nth-child(2) { animation-delay: 0.5s; }
.ring-1 .data-fragment:nth-child(3) { animation-delay: 1s; }
.ring-2 .data-fragment:nth-child(1) { animation-delay: 0.3s; }
.ring-2 .data-fragment:nth-child(2) { animation-delay: 0.8s; }
.ring-2 .data-fragment:nth-child(3) { animation-delay: 1.3s; }
.ring-3 .data-fragment:nth-child(1) { animation-delay: 0.6s; }
.ring-3 .data-fragment:nth-child(2) { animation-delay: 1.1s; }
.ring-3 .data-fragment:nth-child(3) { animation-delay: 1.6s; }

/* =====================================================
   ABILITY CARDS ANIMATION
   ===================================================== */

.ability-card {
    animation: none;
}

.ability-card.visible {
    animation: warpIn 0.8s ease forwards;
}

.ability-card:nth-child(1).visible { animation-delay: 0s; }
.ability-card:nth-child(2).visible { animation-delay: 0.1s; }
.ability-card:nth-child(3).visible { animation-delay: 0.2s; }
.ability-card:nth-child(4).visible { animation-delay: 0.3s; }

.ability-icon svg {
    transition: all 0.3s ease;
}

.ability-card:hover .ability-icon svg {
    animation: glowPulse 1.5s ease-in-out infinite;
}

/* =====================================================
   SILOS CONNECTION ANIMATION
   ===================================================== */

/* Staggered animations for silo wrappers */
.silo-wrapper:nth-child(1) .connection-line-vertical {
    transition-delay: 0s;
}

.silo-wrapper:nth-child(2) .connection-line-vertical {
    transition-delay: 0.1s;
}

.silo-wrapper:nth-child(3) .connection-line-vertical {
    transition-delay: 0.2s;
}

.silo-wrapper:nth-child(4) .connection-line-vertical {
    transition-delay: 0.3s;
}

.silo-wrapper:nth-child(5) .connection-line-vertical {
    transition-delay: 0.4s;
}

.silo-wrapper:nth-child(1) .silo {
    transition-delay: 0s;
}

.silo-wrapper:nth-child(2) .silo {
    transition-delay: 0.1s;
}

.silo-wrapper:nth-child(3) .silo {
    transition-delay: 0.2s;
}

.silo-wrapper:nth-child(4) .silo {
    transition-delay: 0.3s;
}

.silo-wrapper:nth-child(5) .silo {
    transition-delay: 0.4s;
}

.silo {
    transition: all 0.5s ease;
}

.silos-animation.connected .silo:nth-child(1) {
    transition-delay: 0s;
}

.silos-animation.connected .silo:nth-child(2) {
    transition-delay: 0.2s;
}

.silos-animation.connected .silo:nth-child(3) {
    transition-delay: 0.4s;
}

.silos-animation.connected .silo:nth-child(4) {
    transition-delay: 0.6s;
}

.silos-animation.connected .silo:nth-child(5) {
    transition-delay: 0.8s;
}

/* =====================================================
   QUANTUM BUTTON ANIMATION
   ===================================================== */

.quantum-button {
    position: relative;
    overflow: hidden;
}

.quantum-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(0, 245, 255, 0.2),
        transparent
    );
    transition: left 0.5s ease;
}

.quantum-button:hover::before {
    left: 100%;
}

/* =====================================================
   SCROLL-TRIGGERED REVEAL VARIANTS
   ===================================================== */

.reveal.from-left {
    transform: translateX(-50px);
}

.reveal.from-left.visible {
    transform: translateX(0);
}

.reveal.from-right {
    transform: translateX(50px);
}

.reveal.from-right.visible {
    transform: translateX(0);
}

.reveal.from-scale {
    transform: scale(0.9);
}

.reveal.from-scale.visible {
    transform: scale(1);
}

/* Staggered reveals */
.reveal.stagger-1.visible { transition-delay: 0.1s; }
.reveal.stagger-2.visible { transition-delay: 0.2s; }
.reveal.stagger-3.visible { transition-delay: 0.3s; }
.reveal.stagger-4.visible { transition-delay: 0.4s; }
.reveal.stagger-5.visible { transition-delay: 0.5s; }

/* =====================================================
   LOADING ANIMATION
   ===================================================== */

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(0, 245, 255, 0.1);
    border-top-color: var(--color-accent-cyan);
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

/* =====================================================
   SPECIAL TEXT EFFECTS
   ===================================================== */

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

.typewriter {
    overflow: hidden;
    border-right: 2px solid var(--color-accent-cyan);
    white-space: nowrap;
    animation:
        typing 3s steps(40, end),
        blink-caret 0.75s step-end infinite;
}

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

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

/* =====================================================
   HOVER EFFECTS
   ===================================================== */

.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.hover-glow {
    transition: box-shadow 0.3s ease;
}

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

/* =====================================================
   RESPONSIVE ANIMATION ADJUSTMENTS
   ===================================================== */

@media (max-width: 768px) {
    .float-icon {
        animation-duration: 30s;
    }

    .accretion-disk {
        animation-duration: 12s;
    }

    .data-vortex .vortex-ring {
        animation-duration: 25s;
    }
}

/* 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;
    }

    .accretion-disk,
    .vortex-ring,
    .float-icon {
        animation: none !important;
    }

    .reveal {
        opacity: 1 !important;
        transform: none !important;
    }
}
