/* ===================================
   TILLRUN Homepage - Animations
   Advanced CSS Animations & Effects
   =================================== */

/* Keyframe Animations */
@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);
    }
}

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

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

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 217, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(0, 217, 255, 0.6);
    }
}

@keyframes dataFlow {
    0% {
        stroke-dashoffset: 1000;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

@keyframes scanLine {
    0% {
        top: 0%;
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        top: 100%;
        opacity: 0;
    }
}

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

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

@keyframes slideInFromRight {
    0% {
        transform: translateX(100%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Scroll Animation Classes */
.fade-in {
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
}

.fade-in-left {
    animation: fadeInLeft 0.8s ease-out forwards;
    opacity: 0;
}

.fade-in-right {
    animation: fadeInRight 0.8s ease-out forwards;
    opacity: 0;
}

.scale-in {
    animation: scaleIn 0.8s ease-out forwards;
    opacity: 0;
}

/* Stagger Animation Delays */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }
.delay-6 { animation-delay: 0.6s; }

/* Floating Animation for Hero Elements */
.float-element {
    animation: float 3s ease-in-out infinite;
}

/* Rotating Border Effect */
.rotating-border {
    position: relative;
}

.rotating-border::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: conic-gradient(
        from 0deg,
        transparent 0deg 90deg,
        var(--color-accent-cyan) 90deg 180deg,
        transparent 180deg 270deg,
        var(--color-accent-purple) 270deg 360deg
    );
    border-radius: inherit;
    animation: rotate 4s linear infinite;
    z-index: -1;
}

/* Glowing Text Effect */
.glow-text {
    animation: glowPulse 2s ease-in-out infinite;
}

/* Tech Grid Background Animation */
.tech-grid {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 217, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 217, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(50px, 50px);
    }
}

/* Data Stream Effect */
.data-stream {
    position: absolute;
    width: 2px;
    height: 100px;
    background: linear-gradient(
        to bottom,
        transparent,
        var(--color-accent-cyan),
        transparent
    );
    animation: dataStreamFlow 3s linear infinite;
    opacity: 0.3;
}

@keyframes dataStreamFlow {
    0% {
        transform: translateY(-100px);
        opacity: 0;
    }
    50% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(calc(100vh + 100px));
        opacity: 0;
    }
}

/* Circuit Lines Animation */
.circuit-line {
    stroke-dasharray: 10;
    animation: dataFlow 2s linear infinite;
}

/* Scan Line Effect for Tech Sections */
.scan-effect {
    position: relative;
    overflow: hidden;
}

.scan-effect::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--color-accent-cyan),
        transparent
    );
    animation: scanLine 3s ease-in-out infinite;
}

/* Particle Effect */
.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--color-accent-cyan);
    border-radius: 50%;
    animation: particleFloat 5s ease-in-out infinite;
}

@keyframes particleFloat {
    0%, 100% {
        transform: translate(0, 0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translate(var(--particle-x, 100px), var(--particle-y, -100px));
        opacity: 0;
    }
}

/* Hover Effects for Interactive Elements */
.interactive-hover {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.interactive-hover::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(0, 217, 255, 0.2) 0%,
        transparent 70%
    );
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

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

/* Typing Effect */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

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

/* Shimmer Loading Effect */
.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Neon Border Effect */
.neon-border {
    position: relative;
    border: 1px solid var(--color-accent-cyan);
    box-shadow: 
        0 0 5px var(--color-accent-cyan),
        inset 0 0 5px var(--color-accent-cyan);
    animation: neonPulse 2s ease-in-out infinite;
}

@keyframes neonPulse {
    0%, 100% {
        box-shadow: 
            0 0 5px var(--color-accent-cyan),
            inset 0 0 5px var(--color-accent-cyan);
    }
    50% {
        box-shadow: 
            0 0 20px var(--color-accent-cyan),
            inset 0 0 10px var(--color-accent-cyan);
    }
}

/* Wave Effect */
.wave-effect {
    position: relative;
}

.wave-effect::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(
        90deg,
        var(--color-accent-cyan) 0%,
        var(--color-accent-purple) 50%,
        var(--color-accent-cyan) 100%
    );
    background-size: 200% 100%;
    animation: waveMove 3s linear infinite;
}

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

/* Parallax Scroll Effect */
.parallax-slow {
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.parallax-fast {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 217, 255, 0.1);
    border-top-color: var(--color-accent-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Glitch Effect */
.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.8;
}

.glitch::before {
    animation: glitch-1 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
    color: var(--color-accent-cyan);
    z-index: -1;
}

.glitch::after {
    animation: glitch-2 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
    color: var(--color-accent-purple);
    z-index: -2;
}

@keyframes glitch-1 {
    0%, 100% {
        transform: translate(0);
    }
    33% {
        transform: translate(-2px, 2px);
    }
    66% {
        transform: translate(2px, -2px);
    }
}

@keyframes glitch-2 {
    0%, 100% {
        transform: translate(0);
    }
    33% {
        transform: translate(2px, -2px);
    }
    66% {
        transform: translate(-2px, 2px);
    }
}

/* Reveal Animation for Sections */
.reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Gradient Animation */
.animated-gradient {
    background: linear-gradient(
        270deg,
        var(--color-accent-cyan),
        var(--color-accent-purple),
        var(--color-accent-blue)
    );
    background-size: 600% 600%;
    animation: gradientShift 8s ease infinite;
}

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

/* Bounce Effect */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

/* Slide In Animations for Content */
.slide-in-left {
    animation: slideInFromLeft 0.8s ease-out forwards;
}

.slide-in-right {
    animation: slideInFromRight 0.8s ease-out forwards;
}

/* Counter Animation (for numbers) */
@keyframes countUp {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.count-up {
    animation: countUp 1s ease-out forwards;
}

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