/* ===================================
   Ultra-Premium 3D Portfolio - Advanced Animations
   ================================= */

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

/* Fade In Up */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

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

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale In */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Rotate */
@keyframes rotate {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }

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

/* Pulse Glow */
@keyframes pulseGlow {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
    }

    50% {
        box-shadow: 0 0 40px rgba(0, 212, 255, 0.8);
    }
}

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

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Scroll Wheel */
@keyframes scroll-wheel {
    0% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(15px);
    }
}

/* Wave Motion */
@keyframes wave-motion {

    0%,
    100% {
        d: path('M0,0 C150,100 350,0 600,50 C850,100 1050,0 1200,50 L1200,120 L0,120 Z');
    }

    50% {
        d: path('M0,50 C150,0 350,100 600,0 C850,0 1050,100 1200,50 L1200,120 L0,120 Z');
    }
}

/* Float */
@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-20px);
    }
}

/* Bounce */
@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

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

    100% {
        background-position: 1000px 0;
    }
}

/* Glitch */
@keyframes glitch {
    0% {
        transform: translate(0);
    }

    20% {
        transform: translate(-2px, 2px);
    }

    40% {
        transform: translate(-2px, -2px);
    }

    60% {
        transform: translate(2px, 2px);
    }

    80% {
        transform: translate(2px, -2px);
    }

    100% {
        transform: translate(0);
    }
}

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

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Tilt Animation */
@keyframes tilt {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(1deg);
    }

    75% {
        transform: rotate(-1deg);
    }
}

/* Neon Pulse */
@keyframes neonPulse {

    0%,
    100% {
        text-shadow:
            0 0 5px rgba(0, 212, 255, 0.5),
            0 0 10px rgba(0, 212, 255, 0.5),
            0 0 20px rgba(0, 212, 255, 0.5);
    }

    50% {
        text-shadow:
            0 0 10px rgba(0, 212, 255, 0.8),
            0 0 20px rgba(0, 212, 255, 0.8),
            0 0 30px rgba(0, 212, 255, 0.8),
            0 0 40px rgba(0, 212, 255, 0.8);
    }
}

/* Border Glow */
@keyframes borderGlow {

    0%,
    100% {
        border-color: rgba(0, 212, 255, 0.3);
        box-shadow: 0 0 10px rgba(0, 212, 255, 0.2);
    }

    50% {
        border-color: rgba(0, 212, 255, 0.8);
        box-shadow: 0 0 20px rgba(0, 212, 255, 0.6);
    }
}

/* === Animation Utility Classes === */

/* Fade Animations */
.fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

.fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
}

.slide-in-left {
    animation: slideInLeft 0.8s ease-out forwards;
}

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

.scale-in {
    animation: scaleIn 0.6s ease-out forwards;
}

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

/* Set initial state for animated elements */
.fade-in,
.fade-in-up,
.slide-in-left,
.slide-in-right,
.scale-in {
    opacity: 0;
}

/* === Advanced Hover Effects === */

/* 3D Card Tilt */
.magnetic {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.magnetic:hover {
    transform: translateY(-8px) scale(1.02);
}

/* Hover Glow Effect */
.hover-glow {
    position: relative;
    overflow: hidden;
}

.hover-glow::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.2) 0%, transparent 70%);
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.5s ease-out;
    pointer-events: none;
}

.hover-glow:hover::after {
    transform: translate(-50%, -50%) scale(2);
}

/* Shimmer Effect */
.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: 200% 100%;
    animation: shimmer 3s infinite;
}

/* Animated Gradient Background */
.animated-gradient {
    background: linear-gradient(-45deg,
            var(--primary-cyan),
            var(--primary-blue),
            var(--secondary-purple),
            var(--secondary-magenta));
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

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

/* Pulse Animation */
.pulse {
    animation: pulseGlow 2s ease-in-out infinite;
}

/* Bounce Animation */
.bounce {
    animation: bounce 2s ease infinite;
}

/* === Scroll Animation Classes === */
.scroll-reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.scroll-fade {
    opacity: 0;
    transition: opacity 1s ease-out;
}

.scroll-fade.revealed {
    opacity: 1;
}

.scroll-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-scale.revealed {
    opacity: 1;
    transform: scale(1);
}

/* === Parallax Effects === */
.parallax {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Loading Animations === */

/* Skeleton Loading */
.skeleton {
    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: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

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

/* === Text Effects === */

/* Gradient Text with Animation */
.gradient-text-animated {
    background: linear-gradient(90deg,
            var(--primary-cyan),
            var(--secondary-purple),
            var(--secondary-magenta),
            var(--accent-green),
            var(--primary-cyan));
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientText 3s linear infinite;
}

/* Typing Effect */
.typing-effect {
    overflow: hidden;
    border-right: 2px solid var(--primary-cyan);
    white-space: nowrap;
    animation: typing 3.5s steps(40) 1s 1 normal both,
        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(--primary-cyan);
    }
}

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

.glitch:hover {
    animation: glitch 0.3s infinite;
}

/* Neon Text */
.neon-text {
    animation: neonPulse 2s ease-in-out infinite;
}

/* === Particle Effects === */

/* Particle Dot */
.particle-dot {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary-cyan);
    border-radius: 50%;
    opacity: 0.6;
    animation: float 3s ease-in-out infinite;
}

/* === Button Ripple Effect === */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

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

.btn-ripple:active::after {
    width: 300px;
    height: 300px;
}

/* === Card 3D Transform === */
.card-3d {
    transform-style: preserve-3d;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-3d:hover {
    transform:
        perspective(1000px) rotateX(var(--rotate-x, 0deg)) rotateY(var(--rotate-y, 0deg)) scale3d(1.05, 1.05, 1.05);
}

/* === Smooth Reveal on Scroll === */
@media (prefers-reduced-motion: no-preference) {
    .animate-on-scroll {
        opacity: 0;
        transform: translateY(20px);
        transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    }

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

/* === Progress Bar Animation === */
.progress-animated {
    position: relative;
    overflow: hidden;
}

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

@keyframes progress-shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(400%);
    }
}

/* === Image Zoom on Hover === */
.image-zoom {
    overflow: hidden;
}

.image-zoom img {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-zoom:hover img {
    transform: scale(1.1) rotate(2deg);
}

/* === Stagger Animation === */
.stagger-1 {
    animation-delay: 0.1s;
}

.stagger-2 {
    animation-delay: 0.2s;
}

.stagger-3 {
    animation-delay: 0.3s;
}

.stagger-4 {
    animation-delay: 0.4s;
}

.stagger-5 {
    animation-delay: 0.5s;
}

.stagger-6 {
    animation-delay: 0.6s;
}

.stagger-7 {
    animation-delay: 0.7s;
}

.stagger-8 {
    animation-delay: 0.8s;
}

/* === Breathing Animation === */
.breathing {
    animation: breathing 3s ease-in-out infinite;
}

@keyframes breathing {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* === Border Animation === */
.animated-border {
    position: relative;
    border: 2px solid transparent;
}

.animated-border::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg,
            var(--primary-cyan),
            var(--secondary-purple),
            var(--secondary-magenta),
            var(--accent-green));
    background-size: 300% 300%;
    border-radius: inherit;
    z-index: -1;
    animation: gradientShift 3s ease infinite;
}

/* === Slide In Animations === */
.slide-in-bottom {
    animation: slideInBottom 0.6s ease-out forwards;
}

@keyframes slideInBottom {
    from {
        opacity: 0;
        transform: translateY(50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Blob Animation === */
.blob {
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    animation: blob-morph 8s ease-in-out infinite;
}

@keyframes blob-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% 60% 30% 60% / 30% 30% 70% 70%;
    }

    75% {
        border-radius: 60% 40% 60% 40% / 70% 50% 40% 50%;
    }
}

/* === Perspective Card === */
.perspective-card {
    perspective: 1000px;
}

.perspective-card-inner {
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.perspective-card:hover .perspective-card-inner {
    transform: rotateY(10deg) rotateX(10deg);
}

/* === Rainbow Border === */
.rainbow-border {
    position: relative;
    background: var(--bg-dark-card);
    border-radius: var(--radius-lg);
}

.rainbow-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: conic-gradient(from 0deg,
            var(--primary-cyan),
            var(--secondary-purple),
            var(--secondary-magenta),
            var(--accent-green),
            var(--primary-cyan));
    border-radius: inherit;
    z-index: -1;
    animation: rotate 4s linear infinite;
}

/* === Glow Effect === */
.glow-effect {
    position: relative;
}

.glow-effect::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle,
            rgba(0, 212, 255, 0.3) 0%,
            transparent 70%);
    transform: translate(-50%, -50%);
    filter: blur(20px);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    z-index: -1;
}

.glow-effect:hover::before {
    opacity: 1;
}

/* === Performance Optimizations === */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
}

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}