/* 
 * Animation Styles for Digital Canvas
 * Advanced animations and transitions for enhanced user experience
 */

/* Scroll 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 fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

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

@keyframes slideInRight {
    from {
        transform: translateX(100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

@keyframes zoomOut {
    from {
        transform: scale(1.2);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes rotateIn {
    from {
        transform: rotate(-180deg);
        opacity: 0;
    }
    to {
        transform: rotate(0);
        opacity: 1;
    }
}

@keyframes flipInX {
    from {
        transform: perspective(400px) rotateX(90deg);
        opacity: 0;
    }
    to {
        transform: perspective(400px) rotateX(0);
        opacity: 1;
    }
}

@keyframes flipInY {
    from {
        transform: perspective(400px) rotateY(90deg);
        opacity: 0;
    }
    to {
        transform: perspective(400px) rotateY(0);
        opacity: 1;
    }
}

/* Floating and Bobbing Animations */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

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

@keyframes sway {
    0%, 100% {
        transform: rotate(0deg);
    }
    50% {
        transform: rotate(5deg);
    }
}

@keyframes wobble {
    0%, 100% {
        transform: translateX(0%);
    }
    15% {
        transform: translateX(-25%) rotate(-5deg);
    }
    30% {
        transform: translateX(20%) rotate(3deg);
    }
    45% {
        transform: translateX(-15%) rotate(-3deg);
    }
    60% {
        transform: translateX(10%) rotate(2deg);
    }
    75% {
        transform: translateX(-5%) rotate(-1deg);
    }
}

/* Glitch Effects */
@keyframes glitch {
    0%, 100% {
        transform: translate(0);
        opacity: 1;
    }
    2% {
        transform: translate(-2px, 2px);
        opacity: 0.8;
    }
    4% {
        transform: translate(2px, -2px);
        opacity: 0.8;
    }
    6% {
        transform: translate(-2px, -2px);
        opacity: 0.8;
    }
    8% {
        transform: translate(2px, 2px);
        opacity: 0.8;
    }
    10% {
        transform: translate(0);
        opacity: 1;
    }
}

@keyframes textGlitch {
    0%, 100% {
        clip: rect(0, 9999px, 0, 0);
        transform: translate(0);
    }
    2% {
        clip: rect(10px, 9999px, 40px, 0);
        transform: translate(-2px, 0);
    }
    4% {
        clip: rect(30px, 9999px, 20px, 0);
        transform: translate(2px, 0);
    }
    6% {
        clip: rect(20px, 9999px, 30px, 0);
        transform: translate(-2px, 0);
    }
    8% {
        clip: rect(40px, 9999px, 10px, 0);
        transform: translate(2px, 0);
    }
    10% {
        clip: rect(0, 9999px, 0, 0);
        transform: translate(0);
    }
}

/* Neon Glow Effects */
@keyframes neonFlicker {
    0%, 100% {
        box-shadow: 0 0 5px var(--neon-blue), 0 0 10px var(--neon-blue), 0 0 15px var(--neon-blue), 0 0 20px var(--neon-blue);
    }
    50% {
        box-shadow: 0 0 10px var(--neon-blue), 0 0 20px var(--neon-blue), 0 0 30px var(--neon-blue), 0 0 40px var(--neon-blue);
    }
}

@keyframes neonPulse {
    0%, 100% {
        text-shadow: 0 0 5px var(--neon-blue), 0 0 10px var(--neon-blue), 0 0 15px var(--neon-blue);
    }
    50% {
        text-shadow: 0 0 10px var(--neon-blue), 0 0 20px var(--neon-blue), 0 0 30px var(--neon-blue);
    }
}

@keyframes colorShift {
    0% {
        background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple));
    }
    33% {
        background: linear-gradient(135deg, var(--neon-purple), var(--neon-pink));
    }
    66% {
        background: linear-gradient(135deg, var(--neon-pink), var(--neon-cyan));
    }
    100% {
        background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
    }
}

/* Particle Effects */
@keyframes particleFloat {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

@keyframes starTwinkle {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Loading Animations */
@keyframes loadingSlide {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

@keyframes loadingPulse {
    0%, 100% {
        opacity: 0.4;
    }
    50% {
        opacity: 1;
    }
}

@keyframes loadingRotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Scroll-triggered Animations */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.animate-fade-in-up {
    animation: fadeInUp 0.8s ease forwards;
}

.animate-on-scroll.animate-fade-in-left {
    animation: fadeInLeft 0.8s ease forwards;
}

.animate-on-scroll.animate-fade-in-right {
    animation: fadeInRight 0.8s ease forwards;
}

.animate-on-scroll.animate-slide-in-up {
    animation: slideInUp 0.8s ease forwards;
}

.animate-on-scroll.animate-slide-in-down {
    animation: slideInDown 0.8s ease forwards;
}

.animate-on-scroll.animate-slide-in-left {
    animation: slideInLeft 0.8s ease forwards;
}

.animate-on-scroll.animate-slide-in-right {
    animation: slideInRight 0.8s ease forwards;
}

.animate-on-scroll.animate-zoom-in {
    animation: zoomIn 0.8s ease forwards;
}

.animate-on-scroll.animate-zoom-out {
    animation: zoomOut 0.8s ease forwards;
}

.animate-on-scroll.animate-rotate-in {
    animation: rotateIn 0.8s ease forwards;
}

.animate-on-scroll.animate-flip-in-x {
    animation: flipInX 0.8s ease forwards;
}

.animate-on-scroll.animate-flip-in-y {
    animation: flipInY 0.8s ease forwards;
}

/* Floating Elements */
.floating {
    animation: float 3s ease-in-out infinite;
}

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

.drifting {
    animation: drift 4s ease-in-out infinite;
}

.swaying {
    animation: sway 6s ease-in-out infinite;
}

.wobbling {
    animation: wobble 1.5s ease-in-out infinite;
}

/* Neon Effects */
.glitch-effect {
    animation: glitch 1s infinite;
}

.text-glitch {
    position: relative;
}

.text-glitch::before {
    content: attr(data-text);
    position: absolute;
    left: 0;
    text-shadow: 1px 0 var(--neon-blue);
    animation: textGlitch 2s infinite;
    clip: rect(0, 9999px, 0, 0);
}

.text-glitch::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    text-shadow: -1px 0 var(--neon-purple);
    animation: textGlitch 3s infinite reverse;
    clip: rect(0, 9999px, 0, 0);
}

.neon-glow {
    animation: neonFlicker 2s infinite;
}

.neon-pulse {
    animation: neonPulse 2s infinite;
}

.color-shifting {
    animation: colorShift 10s linear infinite;
}

/* Particle Effects */
.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--neon-blue);
    border-radius: 50%;
    pointer-events: none;
}

.particle::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 50%;
    background: var(--neon-blue);
    opacity: 0.3;
    filter: blur(2px);
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    animation: starTwinkle 3s ease-in-out infinite;
}

/* Loading Animations */
.loading-bar {
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--neon-blue), transparent);
    animation: loadingSlide 1.5s ease-in-out infinite;
}

.loading-dot {
    width: 8px;
    height: 8px;
    background: var(--neon-blue);
    border-radius: 50%;
    animation: loadingPulse 1s ease-in-out infinite;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid var(--neon-blue);
    border-radius: 50%;
    animation: loadingRotate 1s linear infinite;
}

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

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

.hover-grow {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

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

.hover-shrink {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.hover-shrink:hover {
    transform: scale(0.95);
    opacity: 0.8;
}

.hover-tilt {
    transition: transform 0.3s ease;
    transform-origin: center;
}

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

.hover-tilt-reverse {
    transition: transform 0.3s ease;
    transform-origin: center;
}

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

/* Background Effects */
.background-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.5;
    z-index: -1;
}

.background-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        linear-gradient(90deg, transparent 50%, rgba(0, 243, 255, 0.1) 50%),
        linear-gradient(0deg, transparent 50%, rgba(0, 243, 255, 0.1) 50%);
    background-size: 20px 20px;
    opacity: 0.3;
    z-index: -1;
}

/* Special Effects */
.scanline {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0),
        rgba(255, 255, 255, 0) 50%,
        rgba(0, 0, 0, 0.2) 50%,
        rgba(0, 0, 0, 0.2)
    );
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 10;
}

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

.vhs-effect::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        transparent 40%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 60%
    );
    animation: vhsGlitch 0.5s infinite;
    pointer-events: none;
    z-index: 5;
}

@keyframes vhsGlitch {
    0%, 100% {
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
}

/* Parallax Effects */
.parallax-layer {
    position: absolute;
    will-change: transform;
}

.parallax-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

/* Depth and Layering */
.layer-1 { z-index: 1; }
.layer-2 { z-index: 2; }
.layer-3 { z-index: 3; }
.layer-4 { z-index: 4; }
.layer-5 { z-index: 5; }

.depth-1 { transform: translateZ(-100px) scale(2); }
.depth-2 { transform: translateZ(-50px) scale(1.5); }
.depth-3 { transform: translateZ(0) scale(1); }
.depth-4 { transform: translateZ(50px) scale(0.8); }
.depth-5 { transform: translateZ(100px) scale(0.6); }

/* Responsive Animations */
@media (max-width: 768px) {
    .floating {
        animation-duration: 4s;
    }
    
    .bobbing {
        animation-duration: 3s;
    }
    
    .drifting {
        animation-duration: 6s;
    }
    
    .swaying {
        animation-duration: 8s;
    }
    
    .wobbling {
        animation-duration: 2s;
    }
}

/* Performance Optimizations */
.transform-3d {
    transform: translate3d(0, 0, 0);
    will-change: transform;
}

.preserve-3d {
    transform-style: preserve-3d;
}

/* Accessibility Considerations */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .floating,
    .bobbing,
    .drifting,
    .swaying,
    .wobbling,
    .neon-glow,
    .neon-pulse,
    .color-shifting,
    .particle,
    .star,
    .loading-bar,
    .loading-dot,
    .loading-spinner,
    .vhs-effect::before {
        animation: none !important;
    }
}