/* ===== ADVANCED ANIMATIONS & MICRO-INTERACTIONS ===== */

/* ===== PARALLAX EFFECTS ===== */
.parallax-element {
    transform: translateZ(0);
    will-change: transform;
}

/* ===== HOVER ANIMATIONS ===== */
.work-card {
    position: relative;
    overflow: hidden;
}

.work-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 107, 53, 0.1), transparent);
    transition: left 0.6s ease;
    z-index: 1;
}

.work-card:hover::before {
    left: 100%;
}

.work-card-content {
    position: relative;
    z-index: 2;
}

/* ===== BUTTON ANIMATIONS ===== */
.btn-primary,
.btn-secondary {
    position: relative;
    overflow: hidden;
}

.btn-primary::before,
.btn-secondary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover::before,
.btn-secondary:hover::before {
    left: 100%;
}

/* ===== TEXT ANIMATIONS ===== */
.animate-text-reveal {
    overflow: hidden;
}

.animate-text-reveal .word {
    display: inline-block;
    opacity: 0;
    transform: translateY(100%);
    animation: wordReveal 0.8s ease-out forwards;
}

.animate-text-reveal .word:nth-child(1) { animation-delay: 0.1s; }
.animate-text-reveal .word:nth-child(2) { animation-delay: 0.2s; }
.animate-text-reveal .word:nth-child(3) { animation-delay: 0.3s; }
.animate-text-reveal .word:nth-child(4) { animation-delay: 0.4s; }
.animate-text-reveal .word:nth-child(5) { animation-delay: 0.5s; }

@keyframes wordReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== LOADING ANIMATIONS ===== */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top: 3px solid var(--color-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== FLOATING ELEMENTS ===== */
.floating {
    animation: float 6s ease-in-out infinite;
}

.floating:nth-child(2) {
    animation-delay: -2s;
}

.floating:nth-child(3) {
    animation-delay: -4s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* ===== GLITCH EFFECT ===== */
.glitch {
    position: relative;
    color: var(--color-text-primary);
    font-size: 2rem;
    font-weight: bold;
    text-transform: uppercase;
    animation: glitch 2s infinite;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    animation: glitch-1 0.5s infinite;
    color: var(--color-accent);
    z-index: -1;
}

.glitch::after {
    animation: glitch-2 0.5s infinite;
    color: var(--color-accent-alt);
    z-index: -2;
}

@keyframes glitch {
    0%, 100% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(-2px, -2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(2px, -2px);
    }
}

@keyframes glitch-1 {
    0%, 100% {
        transform: translate(0);
    }
    20% {
        transform: translate(2px, -2px);
    }
    40% {
        transform: translate(-2px, 2px);
    }
    60% {
        transform: translate(-2px, -2px);
    }
    80% {
        transform: translate(2px, 2px);
    }
}

@keyframes glitch-2 {
    0%, 100% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(2px, -2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(-2px, -2px);
    }
}

/* ===== MORPHING SHAPES ===== */
.morphing-shape {
    width: 100px;
    height: 100px;
    background: linear-gradient(45deg, var(--color-accent), var(--color-accent-alt));
    border-radius: 50%;
    animation: morph 4s ease-in-out infinite;
}

@keyframes morph {
    0%, 100% {
        border-radius: 50%;
        transform: rotate(0deg);
    }
    25% {
        border-radius: 20%;
        transform: rotate(90deg);
    }
    50% {
        border-radius: 50%;
        transform: rotate(180deg);
    }
    75% {
        border-radius: 20%;
        transform: rotate(270deg);
    }
}

/* ===== TYPING ANIMATION ===== */
.typing-animation {
    overflow: hidden;
    border-right: 2px solid var(--color-accent);
    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); }
}

/* ===== SCALE ON HOVER ===== */
.scale-on-hover {
    transition: transform var(--transition-normal);
}

.scale-on-hover:hover {
    transform: scale(1.05);
}

/* ===== ROTATE ON HOVER ===== */
.rotate-on-hover {
    transition: transform var(--transition-normal);
}

.rotate-on-hover:hover {
    transform: rotate(5deg);
}

/* ===== SLIDE IN ANIMATIONS ===== */
.slide-in-left {
    opacity: 0;
    transform: translateX(-50px);
    animation: slideInLeft 0.8s ease-out forwards;
}

.slide-in-right {
    opacity: 0;
    transform: translateX(50px);
    animation: slideInRight 0.8s ease-out forwards;
}

.slide-in-up {
    opacity: 0;
    transform: translateY(50px);
    animation: slideInUp 0.8s ease-out forwards;
}

.slide-in-down {
    opacity: 0;
    transform: translateY(-50px);
    animation: slideInDown 0.8s ease-out forwards;
}

@keyframes slideInLeft {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== PULSE ANIMATION ===== */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ===== BOUNCE ANIMATION ===== */
.bounce {
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* ===== SHAKE ANIMATION ===== */
.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* ===== FADE IN STAGGERED ===== */
.fade-in-staggered > * {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInStaggered 0.6s ease-out forwards;
}

.fade-in-staggered > *:nth-child(1) { animation-delay: 0.1s; }
.fade-in-staggered > *:nth-child(2) { animation-delay: 0.2s; }
.fade-in-staggered > *:nth-child(3) { animation-delay: 0.3s; }
.fade-in-staggered > *:nth-child(4) { animation-delay: 0.4s; }
.fade-in-staggered > *:nth-child(5) { animation-delay: 0.5s; }
.fade-in-staggered > *:nth-child(6) { animation-delay: 0.6s; }

@keyframes fadeInStaggered {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== MAGNETIC HOVER EFFECT ===== */
.magnetic {
    transition: transform var(--transition-fast);
}

.magnetic:hover {
    transform: translate(var(--mouse-x, 0), var(--mouse-y, 0));
}

/* ===== GRADIENT ANIMATION ===== */
.gradient-animation {
    background: linear-gradient(-45deg, var(--color-accent), var(--color-accent-alt), var(--color-accent-gold), var(--color-accent));
    background-size: 400% 400%;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ===== PARTICLE TRAIL ===== */
.particle-trail {
    position: absolute;
    width: 4px;
    height: 4px;
    background-color: var(--color-accent);
    border-radius: 50%;
    pointer-events: none;
    animation: particleTrail 1s ease-out forwards;
}

@keyframes particleTrail {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0);
    }
}

/* ===== RESPONSIVE ANIMATIONS ===== */
@media (prefers-reduced-motion: reduce) {
    .floating,
    .glitch,
    .morphing-shape,
    .typing-animation,
    .pulse,
    .bounce,
    .shake,
    .gradient-animation {
        animation: none;
    }
    
    .scale-on-hover:hover,
    .rotate-on-hover:hover {
        transform: none;
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
    perspective: 1000px;
}

/* ===== CUSTOM EASING FUNCTIONS ===== */
.ease-out-expo {
    transition-timing-function: cubic-bezier(0.19, 1, 0.22, 1);
}

.ease-out-back {
    transition-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ease-in-out-circ {
    transition-timing-function: cubic-bezier(0.85, 0, 0.15, 1);
}
