/* ============================================
   ADZIO - Animations & Motion
   ============================================ */

/* ============================================
   Scroll-Triggered Animations
   ============================================ */

.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    will-change: transform;
    transition:
        opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1),
        transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

.animate-on-scroll.fly-in-left {
    transform: translateX(-100px);
}

.animate-on-scroll.fly-in-right {
    transform: translateX(100px);
}

/* On mobile the horizontal fly-in pushes cards off-screen (clipped overflow
   while unrevealed). Use a vertical-only entrance so nothing leaks sideways. */
@media (max-width: 768px) {

    .animate-on-scroll.fly-in-left,
    .animate-on-scroll.fly-in-right {
        transform: translateY(30px);
    }

    .animate-on-scroll.fly-in-left.visible,
    .animate-on-scroll.fly-in-right.visible {
        transform: translate(0, 0);
    }
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translate(0, 0);
}

/* Staggered delays for grid items */
.animate-on-scroll:nth-child(1) {
    transition-delay: 0s;
}

.animate-on-scroll:nth-child(2) {
    transition-delay: 0.1s;
}

.animate-on-scroll:nth-child(3) {
    transition-delay: 0.2s;
}

.animate-on-scroll:nth-child(4) {
    transition-delay: 0.3s;
}

.animate-on-scroll:nth-child(5) {
    transition-delay: 0.4s;
}

.animate-on-scroll:nth-child(6) {
    transition-delay: 0.5s;
}

/* Service Card specific stagger delays */
.service-card.animate-on-scroll:nth-child(1) {
    transition-delay: 0s;
}

.service-card.animate-on-scroll:nth-child(2) {
    transition-delay: 0.2s;
}

.service-card.animate-on-scroll:nth-child(3) {
    transition-delay: 0.4s;
}

.service-card.animate-on-scroll:nth-child(4) {
    transition-delay: 0.6s;
}

/* ============================================
   Hero Entrance Animations
   ============================================ */

.animate-fade-up {
    opacity: 0;
    transform: translateY(40px);
    animation: fadeUp 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.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;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }

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

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

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

/* ============================================
   Floating Animations
   ============================================ */

@keyframes float {

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

    25% {
        transform: translateY(-10px) rotate(1deg);
    }

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

@keyframes floatSlow {

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

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

.float {
    animation: float 6s ease-in-out infinite;
}

.float-slow {
    animation: floatSlow 8s ease-in-out infinite;
}

/* ============================================
   Glow Animations
   ============================================ */

@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 20px var(--accent-glow);
    }

    50% {
        box-shadow: 0 0 40px var(--accent-glow), 0 0 60px var(--accent-glow);
    }
}

@keyframes glowPulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

.glow {
    animation: glow 3s ease-in-out infinite;
}

/* ============================================
   Text Animations
   ============================================ */

@keyframes textShimmer {
    0% {
        background-position: -200% center;
    }

    100% {
        background-position: 200% center;
    }
}

.text-shimmer {
    background: linear-gradient(90deg,
            var(--text-primary) 0%,
            var(--accent-primary) 50%,
            var(--text-primary) 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textShimmer 3s linear infinite;
}

/* Typing effect */
@keyframes typing {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

@keyframes blinkCursor {

    from,
    to {
        border-color: transparent;
    }

    50% {
        border-color: var(--accent-primary);
    }
}

@keyframes cursorBlink {

    0%,
    49% {
        opacity: 1;
    }

    50%,
    100% {
        opacity: 0;
    }
}

.typing {
    overflow: hidden;
    white-space: nowrap;
    border-right: 3px solid var(--accent-primary);
    animation:
        typing 3s steps(30, end),
        blinkCursor 0.75s step-end infinite;
}

/* ============================================
   Button & Interactive Animations
   ============================================ */

@keyframes buttonShine {
    0% {
        transform: translateX(-100%) skewX(-15deg);
    }

    100% {
        transform: translateX(200%) skewX(-15deg);
    }
}

.btn-shine::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.3),
            transparent);
    animation: buttonShine 3s ease-in-out infinite;
}

/* Ripple effect */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }

    100% {
        transform: scale(4);
        opacity: 0;
    }
}

.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    pointer-events: none;
}

.ripple:active::after {
    animation: ripple 0.6s ease-out;
}

/* ============================================
   Card Hover Effects
   ============================================ */

@keyframes cardHover {

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

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

/* Tilt effect classes */
.tilt {
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

.tilt:hover {
    transform: perspective(1000px) rotateX(5deg) rotateY(5deg);
}

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

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
    }

    50% {
        transform: translateY(-25%);
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}

@keyframes ping {

    75%,
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.spinner {
    animation: spin 1s linear infinite;
}

.bounce {
    animation: bounce 1s infinite;
}

.ping {
    animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

/* ============================================
   Progress Animations
   ============================================ */

@keyframes progressFill {
    from {
        width: 0%;
    }

    to {
        width: var(--progress);
    }
}

@keyframes countUp {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.progress-bar {
    animation: progressFill 1.5s ease-out forwards;
}

/* ============================================
   Marquee Animation
   ============================================ */

@keyframes marquee {
    0% {
        transform: translateX(0%);
    }

    100% {
        transform: translateX(-50%);
    }
}

.marquee {
    animation: marquee 30s linear infinite;
}

.marquee:hover {
    animation-play-state: paused;
}

/* ============================================
   3D Card Effects
   ============================================ */

.card-3d {
    transform-style: preserve-3d;
    perspective: 1000px;
}

.card-3d-content {
    transition: transform 0.5s;
}

.card-3d:hover .card-3d-content {
    transform: translateZ(20px);
}

/* ============================================
   Reveal Animations
   ============================================ */

@keyframes reveal {
    from {
        clip-path: inset(0 100% 0 0);
    }

    to {
        clip-path: inset(0 0 0 0);
    }
}

@keyframes revealUp {
    from {
        clip-path: inset(100% 0 0 0);
    }

    to {
        clip-path: inset(0 0 0 0);
    }
}

.reveal {
    animation: reveal 1s ease-out forwards;
}

.reveal-up {
    animation: revealUp 1s ease-out forwards;
}

/* ============================================
   Parallax Base Classes
   ============================================ */

.parallax {
    will-change: transform;
}

.parallax-slow {
    transition: transform 0.1s linear;
}

/* ============================================
   SVG Path Animations
   ============================================ */

@keyframes drawLine {
    to {
        stroke-dashoffset: 0;
    }
}

.draw-line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawLine 2s ease-out forwards;
}

/* ============================================
   Blob Morphing Animation
   ============================================ */

@keyframes morphBlob {

    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% 60% 70% 40%;
    }

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

.blob {
    animation: morphBlob 8s ease-in-out infinite;
}

/* ============================================
   Counter Animation Support
   ============================================ */

.counter {
    display: inline-flex;
    overflow: hidden;
}

.counter-digit {
    display: inline-block;
    animation: countSlide 0.5s ease-out forwards;
}

@keyframes countSlide {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

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

/* ============================================
   Attention Seekers
   ============================================ */

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

@keyframes wiggle {

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

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

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

@keyframes heartbeat {

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

    14% {
        transform: scale(1.1);
    }

    28% {
        transform: scale(1);
    }

    42% {
        transform: scale(1.1);
    }

    70% {
        transform: scale(1);
    }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

.wiggle {
    animation: wiggle 0.5s ease-in-out infinite;
}

.heartbeat {
    animation: heartbeat 1.5s ease-in-out infinite;
}

/* ============================================
   Reduced Motion Support
   ============================================ */

@media (prefers-reduced-motion: reduce) {

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

    .animate-on-scroll {
        opacity: 1;
        transform: none;
    }

    .animate-fade-up {
        opacity: 1;
        transform: none;
        animation: none;
    }
}