/* Advanced CSS Animations for The Heedful */

/* ===== Keyframe Animations ===== */

/* Gradient Animation */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Text Glitch Effect */
@keyframes glitch {
    0%, 100% {
        text-shadow: 
            0.02em 0 0 rgba(0, 212, 255, 0.75),
            -0.02em -0 0 rgba(124, 58, 237, 0.75),
            0.025em 0.05em 0 rgba(249, 115, 22, 0.75);
    }
    14% {
        text-shadow: 
            0.02em 0 0 rgba(0, 212, 255, 0.75),
            -0.02em -0 0 rgba(124, 58, 237, 0.75),
            0.025em 0.05em 0 rgba(249, 115, 22, 0.75);
    }
    15% {
        text-shadow: 
            -0.02em -0.025em 0 rgba(0, 212, 255, 0.75),
            0.025em 0.025em 0 rgba(124, 58, 237, 0.75),
            -0.05em -0.05em 0 rgba(249, 115, 22, 0.75);
    }
    49% {
        text-shadow: 
            -0.02em -0.025em 0 rgba(0, 212, 255, 0.75),
            0.025em 0.025em 0 rgba(124, 58, 237, 0.75),
            -0.05em -0.05em 0 rgba(249, 115, 22, 0.75);
    }
    50% {
        text-shadow: 
            0.025em 0.05em 0 rgba(0, 212, 255, 0.75),
            0.02em 0 0 rgba(124, 58, 237, 0.75),
            0 -0.05em 0 rgba(249, 115, 22, 0.75);
    }
    99% {
        text-shadow: 
            0.025em 0.05em 0 rgba(0, 212, 255, 0.75),
            0.02em 0 0 rgba(124, 58, 237, 0.75),
            0 -0.05em 0 rgba(249, 115, 22, 0.75);
    }
}

/* Typing Cursor */
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Pulse Animation */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Float Up Animation */
@keyframes floatUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide In From Left */
@keyframes slideInLeft {
    0% {
        opacity: 0;
        transform: translateX(-50px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide In From Right */
@keyframes slideInRight {
    0% {
        opacity: 0;
        transform: translateX(50px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale In */
@keyframes scaleIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Shimmer Effect */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* Morphing Blob */
@keyframes morph {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    25% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
    50% {
        border-radius: 50% 50% 50% 50% / 50% 50% 50% 50%;
    }
    75% {
        border-radius: 40% 60% 60% 40% / 70% 30% 40% 60%;
    }
}

/* Particle Float */
@keyframes particleFloat {
    0%, 100% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) translateX(100px) rotate(720deg);
        opacity: 0;
    }
}

/* Wave Animation */
@keyframes wave {
    0%, 100% {
        transform: translateY(0);
    }
    25% {
        transform: translateY(-20px);
    }
    75% {
        transform: translateY(5px);
    }
}

/* ===== Enhanced Components ===== */

/* Animated Gradient Background */
.animated-gradient-bg {
    background: linear-gradient(-45deg, #00d4ff, #7c3aed, #f97316, #00d4ff);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

/* Glassmorphism Card */
.glass-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Neumorphic Elements */
.neumorphic {
    background: linear-gradient(145deg, #1a1d3a, #0f1020);
    box-shadow: 
        20px 20px 60px #0a0b18,
        -20px -20px 60px #1f2344,
        inset 1px 1px 2px rgba(255, 255, 255, 0.1);
    border-radius: 20px;
}

.neumorphic-pressed {
    background: linear-gradient(145deg, #0f1020, #1a1d3a);
    box-shadow: 
        inset 5px 5px 10px #0a0b18,
        inset -5px -5px 10px #1f2344;
}

/* Enhanced Hero Title Animation */
.hero-title {
    position: relative;
    display: inline-block;
}

.hero-title.typing::after {
    content: '|';
    position: absolute;
    right: -10px;
    animation: blink 1s infinite;
    color: var(--primary-cyan);
}

/* Glitch Text Effect */
.glitch-text {
    position: relative;
    color: var(--text-white);
    animation: glitch 2s infinite;
}

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

.glitch-text::before {
    animation: glitch 0.3s infinite;
    color: var(--primary-cyan);
    z-index: -1;
    animation-delay: 0.1s;
}

.glitch-text::after {
    animation: glitch 0.3s infinite reverse;
    color: var(--primary-purple);
    z-index: -2;
    animation-delay: 0.2s;
}

/* 3D Card Hover Effect */
.card-3d {
    transform-style: preserve-3d;
    transition: transform 0.6s;
    transform: perspective(1000px) rotateY(0deg) rotateX(0deg);
}

.card-3d:hover {
    transform: perspective(1000px) rotateY(5deg) rotateX(-5deg);
}

.card-3d::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        105deg,
        transparent 40%,
        rgba(255, 255, 255, 0.1) 45%,
        transparent 50%
    );
    transform: translateZ(2px);
    opacity: 0;
    transition: opacity 0.6s;
}

.card-3d:hover::before {
    opacity: 1;
}

/* Animated Border */
.animated-border {
    position: relative;
    overflow: hidden;
}

.animated-border::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(0, 212, 255, 0.4),
        transparent
    );
    transition: left 0.5s;
}

.animated-border:hover::before {
    left: 100%;
}

/* Shimmer Loading Effect */
.shimmer-loading {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 25%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 75%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* Morphing Background Blob */
.morph-blob {
    position: absolute;
    width: 500px;
    height: 500px;
    background: var(--gradient-primary);
    opacity: 0.1;
    filter: blur(40px);
    animation: morph 8s ease-in-out infinite;
}

/* Particle System */
.particle-system {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary-cyan);
    border-radius: 50%;
    animation: particleFloat 10s linear infinite;
}

/* Enhanced Button Styles */
.btn-animated {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

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

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

/* Magnetic Button Effect */
.btn-magnetic {
    transition: transform 0.3s ease;
}

/* Text Reveal Animation */
.text-reveal {
    position: relative;
    overflow: hidden;
}

.text-reveal::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--dark-bg);
    transform: translateX(-100%);
    transition: transform 0.8s ease;
}

.text-reveal.animate::after {
    transform: translateX(100%);
}

/* Scroll Progress Indicator */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--gradient-primary);
    z-index: 10000;
    transition: width 0.2s ease;
}

/* Animated Underline */
.animated-underline {
    position: relative;
    display: inline-block;
}

.animated-underline::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: width 0.3s ease;
}

.animated-underline:hover::after {
    width: 100%;
}

/* Perspective Text */
.perspective-text {
    transform-style: preserve-3d;
    transform: perspective(1000px) rotateX(20deg);
    transition: transform 0.3s ease;
}

.perspective-text:hover {
    transform: perspective(1000px) rotateX(0deg);
}

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

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

/* Stagger Animation Classes */
.stagger-animation > * {
    opacity: 0;
    animation: floatUp 0.6s ease 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; }

/* Wave Text Animation */
.wave-text span {
    display: inline-block;
    animation: wave 2s ease-in-out infinite;
    animation-delay: calc(0.1s * var(--char-index));
}

/* Parallax Layers */
.parallax-layer {
    position: absolute;
    width: 100%;
    height: 100%;
}

.parallax-layer-1 {
    transform: translateZ(-1px) scale(2);
}

.parallax-layer-2 {
    transform: translateZ(-2px) scale(3);
}

.parallax-layer-3 {
    transform: translateZ(-3px) scale(4);
}

/* Enhanced Focus States */
*:focus-visible {
    outline: 2px solid var(--primary-cyan);
    outline-offset: 4px;
    transition: outline-offset 0.2s ease;
}

/* Smooth Scroll Behavior */
html {
    scroll-behavior: smooth;
}

/* Performance Optimizations */
.hardware-accelerated {
    will-change: transform;
    transform: translateZ(0);
}

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