/* Adeprimo Animations - Frontend Styles */

/* Base animation class */
.adeprimo-animated {
    animation-fill-mode: both;
    animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94); /* Soft easing */
}

/* Fade In Animation */
@keyframes adeprimoFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.adeprimo-fadeIn {
    animation-name: adeprimoFadeIn;
}

/* Slide Up Animation */
@keyframes adeprimoSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.adeprimo-slideUp {
    animation-name: adeprimoSlideUp;
}

/* Slide Right Animation */
@keyframes adeprimoSlideRight {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.adeprimo-slideRight {
    animation-name: adeprimoSlideRight;
}

/* Slide Left Animation */
@keyframes adeprimoSlideLeft {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.adeprimo-slideLeft {
    animation-name: adeprimoSlideLeft;
}

/* Zoom In Animation */
@keyframes adeprimoZoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.adeprimo-zoomIn {
    animation-name: adeprimoZoomIn;
}

/* Utility classes for hiding elements before animation */
.adeprimo-animate-pending {
    opacity: 0;
    transition: none;
    transform: none;
}

/* Emergency fallback - make all pending elements visible after 3 seconds if JS fails */
@keyframes adeprimo-emergency-reveal {
    0% { opacity: 0; }
    100% { opacity: 1 !important; }
}

/* Emergency fallback animation - only applies if element is still pending after 3s */
.adeprimo-animate-pending:not(.adeprimo-animated) {
    animation: adeprimo-emergency-reveal 0.1s ease-in-out 3s forwards;
}

/* Respect user preferences for reduced motion */
@media (prefers-reduced-motion: reduce) {
    .adeprimo-animated {
        animation: none !important;
    }

    .adeprimo-animate-pending {
        opacity: 1;
    }
}

/* Ensure animations work well with common WordPress themes */
.adeprimo-animated {
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Special handling for images to prevent layout shift */
img.adeprimo-animate-pending {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img.adeprimo-animated {
    opacity: 1;
}

/* EXIT ANIMATIONS */

/* Fade Out Animation */
@keyframes adeprimoFadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.adeprimo-fadeOut {
    animation-name: adeprimoFadeOut;
}

/* Slide Down Exit Animation */
@keyframes adeprimoSlideDown {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(30px);
    }
}

.adeprimo-slideDown {
    animation-name: adeprimoSlideDown;
}

/* Slide Left Exit Animation */
@keyframes adeprimoSlideLeftExit {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-30px);
    }
}

.adeprimo-slideLeftExit {
    animation-name: adeprimoSlideLeftExit;
}

/* Slide Right Exit Animation */
@keyframes adeprimoSlideRightExit {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(30px);
    }
}

.adeprimo-slideRightExit {
    animation-name: adeprimoSlideRightExit;
}

/* Zoom Out Animation */
@keyframes adeprimoZoomOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.8);
    }
}

.adeprimo-zoomOut {
    animation-name: adeprimoZoomOut;
}

/* HOVER ANIMATIONS */

/* Elements that should animate on hover */
.adeprimo-hover-enabled {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Hover Scale Animation */
.adeprimo-hover-scale:hover {
    transform: scale(1.05);
}

/* Hover Float Animation */
.adeprimo-hover-float:hover {
    transform: translateY(-5px);
}

/* Hover Glow Animation */
.adeprimo-hover-glow:hover {
    box-shadow: 0 0 20px rgba(0, 123, 255, 0.5);
}

/* Hover Rotate Animation */
.adeprimo-hover-rotate:hover {
    transform: rotate(5deg);
}

/* Hover Pulse Animation */
@keyframes adeprimoHoverPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.adeprimo-hover-pulse:hover {
    animation: adeprimoHoverPulse 0.6s ease-in-out;
}

/* RESPONSIVE CONTROLS */

/* Desktop-only animations */
@media (min-width: 769px) {
    .adeprimo-desktop-only {
        /* Animation will be applied */
    }

    .adeprimo-mobile-only {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* Mobile-only animations */
@media (max-width: 768px) {
    .adeprimo-mobile-only {
        /* Animation will be applied */
    }

    .adeprimo-desktop-only {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    /* Reduce animation intensity on mobile for performance */
    .adeprimo-animated {
        animation-duration: 0.4s !important;
    }

    /* Disable hover effects on mobile */
    .adeprimo-hover-enabled {
        transition: none;
    }

    .adeprimo-hover-scale:hover,
    .adeprimo-hover-float:hover,
    .adeprimo-hover-glow:hover,
    .adeprimo-hover-rotate:hover {
        transform: none;
        box-shadow: none;
    }
}

/* Text Animation Classes */
.adeprimo-text-animate-pending {
    opacity: 0 !important;
    transition: none !important;
}

.adeprimo-text-animated {
    opacity: 1;
}

/* Ensure text animation spans display correctly */
.adeprimo-text-animated span {
    display: inline-block;
    white-space: pre;
}

/* Typewriter cursor effect (optional) */
.adeprimo-typewriter-cursor::after {
    content: '|';
    animation: adeprimoTypeCursor 1s infinite;
    color: currentColor;
}

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

/* Line reveal animation styles */
.adeprimo-line-reveal {
    overflow: hidden;
    position: relative;
}

/* Screen reader only class for accessibility */
.adeprimo-sr-only:not(:focus):not(:active) {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

/* Mobile optimizations for text animations */
@media (max-width: 768px) {
    /* Reduce animation complexity on mobile for performance */
    .adeprimo-text-animated span,
    .adeprimo-line-reveal {
        will-change: opacity, transform;
    }

    /* Faster animations on mobile */
    .adeprimo-text-animate-pending {
        transition: opacity 0.3s ease !important;
    }

    /* Disable typewriter cursor on mobile to reduce reflows */
    .adeprimo-typewriter-cursor::after {
        display: none;
    }

    /* Reduce line reveal complexity on mobile */
    .adeprimo-line-reveal {
        overflow: visible;
    }
}