/*!
 * MR Blocks Animation CSS
 * Based on Otter Blocks Animate.css
 * Complete animation library with 60+ animations
 */

/* CSS Custom Properties */
:root {
    --animate-duration: 1s;
    --animate-delay: 1s;
    --animate-repeat: 1;
}

/* Base animation class */
.animated {
    animation-duration: 1s;
    animation-duration: var(--animate-duration);
    animation-fill-mode: both;
}

/* Hiding mechanism for performance - CRITICAL */
.animated:not(.mr-anim-ready) {
    visibility: hidden;
    animation-play-state: paused;
    animation: none !important;
}

/* Frontend animation engine states */
.animated.mr-anim-hidden {
    opacity: 0;
    visibility: hidden;
    animation-play-state: paused;
}

.animated.mr-anim-ready {
    opacity: 1;
    visibility: visible;
    animation-play-state: running;
}

/* Reduced motion support for frontend */
.mr-anim-reduced-motion .animated {
    animation-duration: 0.01s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01s !important;
}

/* Mobile optimizations */
.mr-anim-mobile .animated {
    animation-duration: 0.8s;
    animation-duration: calc(var(--animate-duration) * 0.8);
}

/* Paused state for page visibility */
.mr-anim-paused .animated {
    animation-play-state: paused;
}

/* Infinite animations */
.animated.infinite {
    animation-iteration-count: infinite;
}

/* Repeat classes */
.animated.repeat-1 {
    animation-iteration-count: 1;
    animation-iteration-count: var(--animate-repeat);
}

.animated.repeat-2 {
    animation-iteration-count: 2;
    animation-iteration-count: calc(var(--animate-repeat) * 2);
}

.animated.repeat-3 {
    animation-iteration-count: 3;
    animation-iteration-count: calc(var(--animate-repeat) * 3);
}

/* Delay classes */
.animated.delay-1s {
    animation-delay: 1s;
    animation-delay: var(--animate-delay);
}

.animated.delay-2s {
    animation-delay: 2s;
    animation-delay: calc(var(--animate-delay) * 2);
}

.animated.delay-3s {
    animation-delay: 3s;
    animation-delay: calc(var(--animate-delay) * 3);
}

.animated.delay-4s {
    animation-delay: 4s;
    animation-delay: calc(var(--animate-delay) * 4);
}

.animated.delay-5s {
    animation-delay: 5s;
    animation-delay: calc(var(--animate-delay) * 5);
}

/* Speed classes */
.animated.faster {
    animation-duration: 0.5s;
    animation-duration: calc(var(--animate-duration) / 2);
}

.animated.fast {
    animation-duration: 0.8s;
    animation-duration: calc(var(--animate-duration) * 0.8);
}

.animated.slow {
    animation-duration: 2s;
    animation-duration: calc(var(--animate-duration) * 2);
}

.animated.slower {
    animation-duration: 3s;
    animation-duration: calc(var(--animate-duration) * 3);
}

/* Accessibility: Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce), print {
    .animated {
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 1ms !important;
    }
    .animated[class*="Out"] {
        opacity: 0;
    }
}

/* Additional delay classes for fine control */
.animated.delay-100ms {
    animation-delay: 0.1s;
}

.animated.delay-200ms {
    animation-delay: 0.2s;
}

.animated.delay-500ms {
    animation-delay: 0.5s;
}

/* =================
   ATTENTION SEEKERS
   ================= */

@keyframes bounce {
    0%, 20%, 53%, to {
        animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
        transform: translateZ(0);
    }
    40%, 43% {
        animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
        transform: translate3d(0, -30px, 0) scaleY(1.1);
    }
    70% {
        animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
        transform: translate3d(0, -15px, 0) scaleY(1.05);
    }
    80% {
        transform: translateZ(0) scaleY(0.95);
        transition-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
    }
    90% {
        transform: translate3d(0, -4px, 0) scaleY(1.02);
    }
}

.bounce {
    animation-name: bounce;
    transform-origin: center bottom;
}

@keyframes flash {
    0%, 50%, to {
        opacity: 1;
    }
    25%, 75% {
        opacity: 0;
    }
}

.flash {
    animation-name: flash;
}

@keyframes pulse {
    0% {
        transform: scaleX(1);
    }
    50% {
        transform: scale3d(1.05, 1.05, 1.05);
    }
    to {
        transform: scaleX(1);
    }
}

.pulse {
    animation-name: pulse;
    animation-timing-function: ease-in-out;
}

@keyframes rubberBand {
    0% {
        transform: scaleX(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);
    }
    to {
        transform: scaleX(1);
    }
}

.rubberBand {
    animation-name: rubberBand;
}

@keyframes shakeX {
    0%, to {
        transform: translateZ(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translate3d(-10px, 0, 0);
    }
    20%, 40%, 60%, 80% {
        transform: translate3d(10px, 0, 0);
    }
}

.shakeX {
    animation-name: shakeX;
}

@keyframes shakeY {
    0%, to {
        transform: translateZ(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translate3d(0, -10px, 0);
    }
    20%, 40%, 60%, 80% {
        transform: translate3d(0, 10px, 0);
    }
}

.shakeY {
    animation-name: shakeY;
}

@keyframes headShake {
    0% {
        transform: translateX(0);
    }
    6.5% {
        transform: translateX(-6px) rotateY(-9deg);
    }
    18.5% {
        transform: translateX(5px) rotateY(7deg);
    }
    31.5% {
        transform: translateX(-3px) rotateY(-5deg);
    }
    43.5% {
        transform: translateX(2px) rotateY(3deg);
    }
    50% {
        transform: translateX(0);
    }
}

.headShake {
    animation-name: headShake;
    animation-timing-function: ease-in-out;
}

@keyframes swing {
    20% {
        transform: rotate(15deg);
    }
    40% {
        transform: rotate(-10deg);
    }
    60% {
        transform: rotate(5deg);
    }
    80% {
        transform: rotate(-5deg);
    }
    to {
        transform: rotate(0deg);
    }
}

.swing {
    animation-name: swing;
    transform-origin: top center;
}

@keyframes tada {
    0% {
        transform: scaleX(1);
    }
    10%, 20% {
        transform: scale3d(0.9, 0.9, 0.9) rotate(-3deg);
    }
    30%, 50%, 70%, 90% {
        transform: scale3d(1.1, 1.1, 1.1) rotate(3deg);
    }
    40%, 60%, 80% {
        transform: scale3d(1.1, 1.1, 1.1) rotate(-3deg);
    }
    to {
        transform: scaleX(1);
    }
}

.tada {
    animation-name: tada;
}

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

.wobble {
    animation-name: wobble;
}

@keyframes jello {
    0%, 11.1%, to {
        transform: translateZ(0);
    }
    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);
    }
}

.jello {
    animation-name: jello;
    transform-origin: center;
}

@keyframes heartBeat {
    0% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.3);
    }
    28% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.3);
    }
    70% {
        transform: scale(1);
    }
}

.heartBeat {
    animation-duration: 1.3s;
    animation-duration: calc(var(--animate-duration) * 1.3);
    animation-name: heartBeat;
    animation-timing-function: ease-in-out;
} /* =================
   BACK ENTRANCES
   ================= */

@keyframes backInDown {
    0% {
        opacity: 0.7;
        transform: translateY(-1200px) scale(0.7);
    }
    80% {
        opacity: 0.7;
        transform: translateY(0) scale(0.7);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.backInDown {
    animation-name: backInDown;
}

@keyframes backInLeft {
    0% {
        opacity: 0.7;
        transform: translateX(-2000px) scale(0.7);
    }
    80% {
        opacity: 0.7;
        transform: translateX(0) scale(0.7);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.backInLeft {
    animation-name: backInLeft;
}

@keyframes backInRight {
    0% {
        opacity: 0.7;
        transform: translateX(2000px) scale(0.7);
    }
    80% {
        opacity: 0.7;
        transform: translateX(0) scale(0.7);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.backInRight {
    animation-name: backInRight;
}

@keyframes backInUp {
    0% {
        opacity: 0.7;
        transform: translateY(1200px) scale(0.7);
    }
    80% {
        opacity: 0.7;
        transform: translateY(0) scale(0.7);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.backInUp {
    animation-name: backInUp;
}

/* =================
   BOUNCE ENTRANCES
   ================= */

@keyframes bounceIn {
    0%, 20%, 40%, 60%, 80%, to {
        animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
    }
    0% {
        opacity: 0;
        transform: scale3d(0.3, 0.3, 0.3);
    }
    20% {
        transform: scale3d(1.1, 1.1, 1.1);
    }
    40% {
        transform: scale3d(0.9, 0.9, 0.9);
    }
    60% {
        opacity: 1;
        transform: scale3d(1.03, 1.03, 1.03);
    }
    80% {
        transform: scale3d(0.97, 0.97, 0.97);
    }
    to {
        opacity: 1;
        transform: scaleX(1);
    }
}

.bounceIn {
    animation-duration: 0.75s;
    animation-duration: calc(var(--animate-duration) * 0.75);
    animation-name: bounceIn;
}

@keyframes bounceInDown {
    0%, 60%, 75%, 90%, to {
        animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
    }
    0% {
        opacity: 0;
        transform: translate3d(0, -3000px, 0) scaleY(3);
    }
    60% {
        opacity: 1;
        transform: translate3d(0, 25px, 0) scaleY(0.9);
    }
    75% {
        transform: translate3d(0, -10px, 0) scaleY(0.95);
    }
    90% {
        transform: translate3d(0, 5px, 0) scaleY(0.985);
    }
    to {
        transform: translateZ(0);
    }
}

.bounceInDown {
    animation-name: bounceInDown;
}

@keyframes bounceInLeft {
    0%, 60%, 75%, 90%, to {
        animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
    }
    0% {
        opacity: 0;
        transform: translate3d(-3000px, 0, 0) scaleX(3);
    }
    60% {
        opacity: 1;
        transform: translate3d(25px, 0, 0) scaleX(1);
    }
    75% {
        transform: translate3d(-10px, 0, 0) scaleX(0.98);
    }
    90% {
        transform: translate3d(5px, 0, 0) scaleX(0.995);
    }
    to {
        transform: translateZ(0);
    }
}

.bounceInLeft {
    animation-name: bounceInLeft;
}

@keyframes bounceInRight {
    0%, 60%, 75%, 90%, to {
        animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
    }
    0% {
        opacity: 0;
        transform: translate3d(3000px, 0, 0) scaleX(3);
    }
    60% {
        opacity: 1;
        transform: translate3d(-25px, 0, 0) scaleX(1);
    }
    75% {
        transform: translate3d(10px, 0, 0) scaleX(0.98);
    }
    90% {
        transform: translate3d(-5px, 0, 0) scaleX(0.995);
    }
    to {
        transform: translateZ(0);
    }
}

.bounceInRight {
    animation-name: bounceInRight;
}

@keyframes bounceInUp {
    0%, 60%, 75%, 90%, to {
        animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
    }
    0% {
        opacity: 0;
        transform: translate3d(0, 3000px, 0) scaleY(5);
    }
    60% {
        opacity: 1;
        transform: translate3d(0, -20px, 0) scaleY(0.9);
    }
    75% {
        transform: translate3d(0, 10px, 0) scaleY(0.95);
    }
    90% {
        transform: translate3d(0, -5px, 0) scaleY(0.985);
    }
    to {
        transform: translateZ(0);
    }
}

.bounceInUp {
    animation-name: bounceInUp;
}

/* =================
   FADE ENTRANCES
   ================= */

@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.fadeIn {
    animation-name: fadeIn;
}

@keyframes fadeInDown {
    0% {
        opacity: 0;
        transform: translate3d(0, -100%, 0);
    }
    to {
        opacity: 1;
        transform: translateZ(0);
    }
}

.fadeInDown {
    animation-name: fadeInDown;
}

@keyframes fadeInDownBig {
    0% {
        opacity: 0;
        transform: translate3d(0, -2000px, 0);
    }
    to {
        opacity: 1;
        transform: translateZ(0);
    }
}

.fadeInDownBig {
    animation-name: fadeInDownBig;
}

@keyframes fadeInLeft {
    0% {
        opacity: 0;
        transform: translate3d(-100%, 0, 0);
    }
    to {
        opacity: 1;
        transform: translateZ(0);
    }
}

.fadeInLeft {
    animation-name: fadeInLeft;
}

@keyframes fadeInLeftBig {
    0% {
        opacity: 0;
        transform: translate3d(-2000px, 0, 0);
    }
    to {
        opacity: 1;
        transform: translateZ(0);
    }
}

.fadeInLeftBig {
    animation-name: fadeInLeftBig;
}

@keyframes fadeInRight {
    0% {
        opacity: 0;
        transform: translate3d(100%, 0, 0);
    }
    to {
        opacity: 1;
        transform: translateZ(0);
    }
}

.fadeInRight {
    animation-name: fadeInRight;
}

@keyframes fadeInRightBig {
    0% {
        opacity: 0;
        transform: translate3d(2000px, 0, 0);
    }
    to {
        opacity: 1;
        transform: translateZ(0);
    }
}

.fadeInRightBig {
    animation-name: fadeInRightBig;
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translate3d(0, 100%, 0);
    }
    to {
        opacity: 1;
        transform: translateZ(0);
    }
}

.fadeInUp {
    animation-name: fadeInUp;
}

@keyframes fadeInUpBig {
    0% {
        opacity: 0;
        transform: translate3d(0, 2000px, 0);
    }
    to {
        opacity: 1;
        transform: translateZ(0);
    }
}

.fadeInUpBig {
    animation-name: fadeInUpBig;
}

@keyframes fadeInTopLeft {
    0% {
        opacity: 0;
        transform: translate3d(-100%, -100%, 0);
    }
    to {
        opacity: 1;
        transform: translateZ(0);
    }
}

.fadeInTopLeft {
    animation-name: fadeInTopLeft;
}

@keyframes fadeInTopRight {
    0% {
        opacity: 0;
        transform: translate3d(100%, -100%, 0);
    }
    to {
        opacity: 1;
        transform: translateZ(0);
    }
}

.fadeInTopRight {
    animation-name: fadeInTopRight;
}

@keyframes fadeInBottomLeft {
    0% {
        opacity: 0;
        transform: translate3d(-100%, 100%, 0);
    }
    to {
        opacity: 1;
        transform: translateZ(0);
    }
}

.fadeInBottomLeft {
    animation-name: fadeInBottomLeft;
}

@keyframes fadeInBottomRight {
    0% {
        opacity: 0;
        transform: translate3d(100%, 100%, 0);
    }
    to {
        opacity: 1;
        transform: translateZ(0);
    }
}

.fadeInBottomRight {
    animation-name: fadeInBottomRight;
}

/* =================
   EXIT ANIMATIONS
   ================= */

@keyframes fadeOut {
    0% {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.fadeOut {
    animation-name: fadeOut;
}

@keyframes bounceOut {
    20% {
        transform: scale3d(0.9, 0.9, 0.9);
    }
    50%, 55% {
        opacity: 1;
        transform: scale3d(1.1, 1.1, 1.1);
    }
    to {
        opacity: 0;
        transform: scale3d(0.3, 0.3, 0.3);
    }
}

.bounceOut {
    animation-duration: 0.75s;
    animation-duration: calc(var(--animate-duration) * 0.75);
    animation-name: bounceOut;
}

/* =================
   SLIDE ANIMATIONS
   ================= */

@keyframes slideInDown {
    0% {
        transform: translate3d(0, -100%, 0);
        visibility: visible;
    }
    to {
        transform: translateZ(0);
    }
}

.slideInDown {
    animation-name: slideInDown;
}

@keyframes slideInLeft {
    0% {
        transform: translate3d(-100%, 0, 0);
        visibility: visible;
    }
    to {
        transform: translateZ(0);
    }
}

.slideInLeft {
    animation-name: slideInLeft;
}

@keyframes slideInRight {
    0% {
        transform: translate3d(100%, 0, 0);
        visibility: visible;
    }
    to {
        transform: translateZ(0);
    }
}

.slideInRight {
    animation-name: slideInRight;
}

@keyframes slideInUp {
    0% {
        transform: translate3d(0, 100%, 0);
        visibility: visible;
    }
    to {
        transform: translateZ(0);
    }
}

.slideInUp {
    animation-name: slideInUp;
}

/* =================
   ZOOM ANIMATIONS
   ================= */

@keyframes zoomIn {
    0% {
        opacity: 0;
        transform: scale3d(0.3, 0.3, 0.3);
    }
    50% {
        opacity: 1;
    }
}

.zoomIn {
    animation-name: zoomIn;
}

@keyframes zoomInDown {
    0% {
        animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);
        opacity: 0;
        transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -1000px, 0);
    }
    60% {
        animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);
        opacity: 1;
        transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);
    }
}

.zoomInDown {
    animation-name: zoomInDown;
}

/* =================
   SPECIAL ANIMATIONS
   ================= */

@keyframes flip {
    0% {
        animation-timing-function: ease-out;
        transform: perspective(400px) scaleX(1) translateZ(0) rotateY(-1turn);
    }
    40% {
        animation-timing-function: ease-out;
        transform: perspective(400px) scaleX(1) translateZ(150px) rotateY(-190deg);
    }
    50% {
        animation-timing-function: ease-in;
        transform: perspective(400px) scaleX(1) translateZ(150px) rotateY(-170deg);
    }
    80% {
        animation-timing-function: ease-in;
        transform: perspective(400px) scale3d(0.95, 0.95, 0.95) translateZ(0) rotateY(0deg);
    }
    to {
        animation-timing-function: ease-in;
        transform: perspective(400px) scaleX(1) translateZ(0) rotateY(0deg);
    }
}

.animated.flip {
    animation-name: flip;
    backface-visibility: visible;
}

@keyframes hinge {
    0% {
        animation-timing-function: ease-in-out;
    }
    20%, 60% {
        animation-timing-function: ease-in-out;
        transform: rotate(80deg);
    }
    40%, 80% {
        animation-timing-function: ease-in-out;
        opacity: 1;
        transform: rotate(60deg);
    }
    to {
        opacity: 0;
        transform: translate3d(0, 700px, 0);
    }
}

.hinge {
    animation-duration: 2s;
    animation-duration: calc(var(--animate-duration) * 2);
    animation-name: hinge;
    transform-origin: top left;
}

@keyframes jackInTheBox {
    0% {
        opacity: 0;
        transform: scale(0.1) rotate(30deg);
        transform-origin: center bottom;
    }
    50% {
        transform: rotate(-10deg);
    }
    70% {
        transform: rotate(3deg);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.jackInTheBox {
    animation-name: jackInTheBox;
}

@keyframes rollIn {
    0% {
        opacity: 0;
        transform: translate3d(-100%, 0, 0) rotate(-120deg);
    }
    to {
        opacity: 1;
        transform: translateZ(0);
    }
}

.rollIn {
    animation-name: rollIn;
}

@keyframes rollOut {
    0% {
        opacity: 1;
    }
    to {
        opacity: 0;
        transform: translate3d(100%, 0, 0) rotate(120deg);
    }
}

.rollOut {
    animation-name: rollOut;
}

/* =================
   ROTATE ANIMATIONS
   ================= */

@keyframes rotateIn {
    0% {
        opacity: 0;
        transform: rotate(-200deg);
    }
    to {
        opacity: 1;
        transform: translateZ(0);
    }
}

.rotateIn {
    animation-name: rotateIn;
    transform-origin: center;
}

/* =================
   EDITOR INTEGRATION
   ================= */

/* Hide elements until animations are ready */
@media screen {
    .hidden-animated {
        animation-play-state: paused;
        visibility: hidden;
    }
    .animated .wp-block-navigation,
    .animated.wp-block-navigation {
        animation-fill-mode: none;
    }
}

/* Editor specific styles */
.block-editor .animated,
.block-editor-block-list__layout .animated {
    animation-play-state: running;
    visibility: initial;
} 