/**
 * MTC Theme - Advanced Animations
 * 
 * Additional animation styles for the Men That Cook theme
 * @package MTC_Theme
 */

/* ===================================
   ADVANCED KEYFRAME ANIMATIONS
   =================================== */

/* Slide Animations */
@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;
    }
}

@keyframes slideInFromTop {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInFromBottom {
    0% {
        transform: translateY(100%);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Zoom Animations */
@keyframes zoomIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes zoomOut {
    0% {
        transform: scale(1.5);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Flip Animations */
@keyframes flipInX {
    0% {
        transform: perspective(400px) rotateX(90deg);
        opacity: 0;
    }
    40% {
        transform: perspective(400px) rotateX(-10deg);
    }
    70% {
        transform: perspective(400px) rotateX(10deg);
    }
    100% {
        transform: perspective(400px) rotateX(0);
        opacity: 1;
    }
}

@keyframes flipInY {
    0% {
        transform: perspective(400px) rotateY(90deg);
        opacity: 0;
    }
    40% {
        transform: perspective(400px) rotateY(-10deg);
    }
    70% {
        transform: perspective(400px) rotateY(10deg);
    }
    100% {
        transform: perspective(400px) rotateY(0);
        opacity: 1;
    }
}

/* Bounce Variations */
@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes rubberBand {
    0% {
        transform: scale3d(1, 1, 1);
    }
    30% {
        transform: scale3d(1.25, 0.75, 1);
    }
    40% {
        transform: scale3d(0.75, 1.25, 1);
    }
    50% {
        transform: scale3d(1.15, 0.85, 1);
    }
    65% {
        transform: scale3d(0.95, 1.05, 1);
    }
    75% {
        transform: scale3d(1.05, 0.95, 1);
    }
    100% {
        transform: scale3d(1, 1, 1);
    }
}

/* Attention Seekers */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-10px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(10px);
    }
}

@keyframes swing {
    20% {
        transform: rotate3d(0, 0, 1, 15deg);
    }
    40% {
        transform: rotate3d(0, 0, 1, -10deg);
    }
    60% {
        transform: rotate3d(0, 0, 1, 5deg);
    }
    80% {
        transform: rotate3d(0, 0, 1, -5deg);
    }
    100% {
        transform: rotate3d(0, 0, 1, 0deg);
    }
}

@keyframes tada {
    0% {
        transform: scale3d(1, 1, 1);
    }
    10%, 20% {
        transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg);
    }
    30%, 50%, 70%, 90% {
        transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
    }
    40%, 60%, 80% {
        transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
    }
    100% {
        transform: scale3d(1, 1, 1);
    }
}

@keyframes wobble {
    0% {
        transform: translateX(0%);
    }
    15% {
        transform: translateX(-25%) rotate3d(0, 0, 1, -5deg);
    }
    30% {
        transform: translateX(20%) rotate3d(0, 0, 1, 3deg);
    }
    45% {
        transform: translateX(-15%) rotate3d(0, 0, 1, -3deg);
    }
    60% {
        transform: translateX(10%) rotate3d(0, 0, 1, 2deg);
    }
    75% {
        transform: translateX(-5%) rotate3d(0, 0, 1, -1deg);
    }
    100% {
        transform: translateX(0%);
    }
}

@keyframes jello {
    0%, 11.1%, 100% {
        transform: none;
    }
    22.2% {
        transform: skewX(-12.5deg) skewY(-12.5deg);
    }
    33.3% {
        transform: skewX(6.25deg) skewY(6.25deg);
    }
    44.4% {
        transform: skewX(-3.125deg) skewY(-3.125deg);
    }
    55.5% {
        transform: skewX(1.5625deg) skewY(1.5625deg);
    }
    66.6% {
        transform: skewX(-0.78125deg) skewY(-0.78125deg);
    }
    77.7% {
        transform: skewX(0.390625deg) skewY(0.390625deg);
    }
    88.8% {
        transform: skewX(-0.1953125deg) skewY(-0.1953125deg);
    }
}

/* Floating Animation */
@keyframes floating {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-10px) rotate(1deg);
    }
    50% {
        transform: translateY(-5px) rotate(0deg);
    }
    75% {
        transform: translateY(-15px) rotate(-1deg);
    }
}

/* Glow Animation */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(230, 126, 34, 0.5),
                    0 0 10px rgba(230, 126, 34, 0.3),
                    0 0 15px rgba(230, 126, 34, 0.1);
    }
    50% {
        box-shadow: 0 0 10px rgba(230, 126, 34, 0.8),
                    0 0 20px rgba(230, 126, 34, 0.5),
                    0 0 30px rgba(230, 126, 34, 0.3);
    }
}

/* Text Gradient Animation */
@keyframes textGradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Typewriter Effect */
@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    0%, 100% {
        border-color: transparent;
    }
    50% {
        border-color: var(--mtc-secondary);
    }
}

/* Background Pan */
@keyframes backgroundPan {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: -200% center;
    }
}

/* Ripple Effect */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* ===================================
   ANIMATION UTILITY CLASSES
   =================================== */

/* Duration Modifiers */
.animation-fast { animation-duration: 0.3s !important; }
.animation-normal { animation-duration: 0.6s !important; }
.animation-slow { animation-duration: 1s !important; }
.animation-slower { animation-duration: 1.5s !important; }

/* Delay Modifiers */
.animation-delay-100 { animation-delay: 0.1s; }
.animation-delay-200 { animation-delay: 0.2s; }
.animation-delay-300 { animation-delay: 0.3s; }
.animation-delay-400 { animation-delay: 0.4s; }
.animation-delay-500 { animation-delay: 0.5s; }
.animation-delay-600 { animation-delay: 0.6s; }
.animation-delay-700 { animation-delay: 0.7s; }
.animation-delay-800 { animation-delay: 0.8s; }
.animation-delay-900 { animation-delay: 0.9s; }
.animation-delay-1000 { animation-delay: 1s; }

/* Iteration Count */
.animation-infinite { animation-iteration-count: infinite; }
.animation-once { animation-iteration-count: 1; }
.animation-twice { animation-iteration-count: 2; }

/* Animation Classes */
.animate-slide-left {
    animation: slideInFromLeft 0.6s ease-out forwards;
}

.animate-slide-right {
    animation: slideInFromRight 0.6s ease-out forwards;
}

.animate-slide-up {
    animation: slideInFromBottom 0.6s ease-out forwards;
}

.animate-slide-down {
    animation: slideInFromTop 0.6s ease-out forwards;
}

.animate-zoom-in {
    animation: zoomIn 0.6s ease-out forwards;
}

.animate-zoom-out {
    animation: zoomOut 0.6s ease-out forwards;
}

.animate-flip-x {
    animation: flipInX 0.8s ease-out forwards;
}

.animate-flip-y {
    animation: flipInY 0.8s ease-out forwards;
}

.animate-bounce-in {
    animation: bounceIn 0.75s ease-out forwards;
}

.animate-floating {
    animation: floating 3s ease-in-out infinite;
}

.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

/* Hover Activated Animations */
.hover-shake:hover {
    animation: shake 0.8s ease-in-out;
}

.hover-swing:hover {
    animation: swing 1s ease-in-out;
    transform-origin: top center;
}

.hover-tada:hover {
    animation: tada 1s ease-in-out;
}

.hover-wobble:hover {
    animation: wobble 1s ease-in-out;
}

.hover-jello:hover {
    animation: jello 1s ease-in-out;
}

.hover-rubberband:hover {
    animation: rubberBand 1s ease-in-out;
}

/* Text Animation */
.text-gradient-animated {
    background: linear-gradient(90deg, var(--mtc-secondary), var(--mtc-accent), var(--mtc-secondary));
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: textGradient 3s linear infinite;
}

.typewriter-text {
    overflow: hidden;
    border-right: 3px solid var(--mtc-secondary);
    white-space: nowrap;
    animation: 
        typewriter 3s steps(40, end),
        blink 0.75s step-end infinite;
}

/* Button Ripple Effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
}

.btn-ripple:active::after {
    animation: ripple 0.6s ease-out;
}

/* ===================================
   SCROLL-BASED ANIMATIONS
   =================================== */

/* Reveal on Scroll */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-right.visible {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-scale.visible {
    opacity: 1;
    transform: scale(1);
}

/* ===================================
   LOADING ANIMATIONS
   =================================== */

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--mtc-light);
    border-top-color: var(--mtc-secondary);
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

.dots-loader {
    display: flex;
    gap: 8px;
}

.dots-loader span {
    width: 12px;
    height: 12px;
    background: var(--mtc-secondary);
    border-radius: 50%;
    animation: bounce 0.5s ease-in-out infinite alternate;
}

.dots-loader span:nth-child(2) {
    animation-delay: 0.1s;
}

.dots-loader span:nth-child(3) {
    animation-delay: 0.2s;
}

/* Pulse Loader */
.pulse-loader {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--mtc-secondary);
    animation: pulse 1.5s ease-in-out infinite;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--mtc-light) 25%,
        #e0e0e0 50%,
        var(--mtc-light) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-title {
    height: 2em;
    width: 60%;
    margin-bottom: 1em;
}

.skeleton-image {
    height: 200px;
    width: 100%;
}

/* ===================================
   PARALLAX HELPER CLASSES
   =================================== */

.parallax-slow {
    --parallax-speed: 0.3;
}

.parallax-medium {
    --parallax-speed: 0.5;
}

.parallax-fast {
    --parallax-speed: 0.7;
}

/* ===================================
   MICRO-INTERACTIONS
   =================================== */

/* Icon Hover Effects */
.icon-bounce:hover {
    animation: bounce 0.5s ease;
}

.icon-spin:hover {
    animation: rotate 0.5s ease;
}

.icon-pulse:hover {
    animation: pulse 0.5s ease;
}

/* Card Tilt Effect */
.card-tilt {
    transition: transform 0.3s ease;
    transform-style: preserve-3d;
}

.card-tilt:hover {
    transform: perspective(1000px) rotateX(5deg) rotateY(5deg);
}

/* Link Underline Animation */
.link-underline {
    position: relative;
    text-decoration: none;
}

.link-underline::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--mtc-secondary);
    transition: width 0.3s ease;
}

.link-underline:hover::after {
    width: 100%;
}

/* 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);
}

/* Color Shift Animation */
@keyframes colorShift {
    0% { background-color: var(--mtc-primary); }
    25% { background-color: var(--mtc-secondary); }
    50% { background-color: var(--mtc-accent); }
    75% { background-color: var(--mtc-secondary); }
    100% { background-color: var(--mtc-primary); }
}

.color-shift {
    animation: colorShift 10s ease infinite;
}
