/* ========================================
   Moraya Engineering Solutions - Animations
   ======================================== */

/* ========================================
   AOS-like Animations
   ======================================== */
[data-aos] {
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-aos].aos-animate {
    opacity: 1;
}

[data-aos="fade-up"] {
    transform: translateY(50px);
}

[data-aos="fade-up"].aos-animate {
    transform: translateY(0);
}

[data-aos="fade-down"] {
    transform: translateY(-50px);
}

[data-aos="fade-down"].aos-animate {
    transform: translateY(0);
}

[data-aos="fade-left"] {
    transform: translateX(50px);
}

[data-aos="fade-left"].aos-animate {
    transform: translateX(0);
}

[data-aos="fade-right"] {
    transform: translateX(-50px);
}

[data-aos="fade-right"].aos-animate {
    transform: translateX(0);
}

[data-aos="zoom-in"] {
    transform: scale(0.9);
}

[data-aos="zoom-in"].aos-animate {
    transform: scale(1);
}

[data-aos="flip-up"] {
    transform: perspective(2500px) rotateX(-100deg);
}

[data-aos="flip-up"].aos-animate {
    transform: perspective(2500px) rotateX(0);
}

/* Delay classes */
[data-aos-delay="100"] {
    transition-delay: 0.1s;
}

[data-aos-delay="150"] {
    transition-delay: 0.15s;
}

[data-aos-delay="200"] {
    transition-delay: 0.2s;
}

[data-aos-delay="250"] {
    transition-delay: 0.25s;
}

[data-aos-delay="300"] {
    transition-delay: 0.3s;
}

[data-aos-delay="350"] {
    transition-delay: 0.35s;
}

[data-aos-delay="400"] {
    transition-delay: 0.4s;
}

/* ========================================
   Hover Animations
   ======================================== */

/* Float Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

.float-animation {
    animation: float 3s ease-in-out infinite;
}

/* Pulse Animation */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(243, 156, 18, 0.7);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 15px rgba(243, 156, 18, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(243, 156, 18, 0);
    }
}

.pulse-animation {
    animation: pulse 2s infinite;
}

/* Shake Animation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake-animation:hover {
    animation: shake 0.5s ease-in-out;
}

/* Bounce Animation */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

.bounce-animation {
    animation: bounce 2s infinite;
}

/* Spin Animation */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.spin-animation {
    animation: spin 10s linear infinite;
}

/* Fade In Up */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease forwards;
}

/* Fade In Down */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-down {
    animation: fadeInDown 0.6s ease forwards;
}

/* Fade In Left */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in-left {
    animation: fadeInLeft 0.6s ease forwards;
}

/* Fade In Right */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in-right {
    animation: fadeInRight 0.6s ease forwards;
}

/* Scale In */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.scale-in {
    animation: scaleIn 0.5s ease forwards;
}

/* ========================================
   Text Animations
   ======================================== */

/* Typing Effect */
@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--secondary-color); }
}

.typing-effect {
    overflow: hidden;
    border-right: 3px solid var(--secondary-color);
    white-space: nowrap;
    animation: 
        typing 3.5s steps(40, end),
        blink-caret 0.75s step-end infinite;
}

/* Gradient Text Animation */
@keyframes gradient-text {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.gradient-text {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--primary-color));
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-text 3s linear infinite;
}

/* ========================================
   Button Animations
   ======================================== */

/* Ripple Effect */
@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: scale(0);
    pointer-events: none;
}

.btn-ripple:active::after {
    animation: ripple 0.6s ease-out;
}

/* Shine Effect */
@keyframes shine {
    from {
        left: -150%;
    }
    to {
        left: 150%;
    }
}

.btn-shine {
    position: relative;
    overflow: hidden;
}

.btn-shine::before {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    transition: none;
}

.btn-shine:hover::before {
    animation: shine 0.7s ease;
}

/* ========================================
   Card Animations
   ======================================== */

/* Card Hover Lift */
.card-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-lift:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* Card Hover Tilt */
.card-tilt {
    transition: transform 0.3s ease;
    transform-style: preserve-3d;
}

.card-tilt:hover {
    transform: perspective(1000px) rotateX(5deg) rotateY(5deg);
}

/* ========================================
   Image Animations
   ======================================== */

/* Image Zoom */
.img-zoom {
    overflow: hidden;
}

.img-zoom img {
    transition: transform 0.5s ease;
}

.img-zoom:hover img {
    transform: scale(1.1);
}

/* Image Reveal */
@keyframes imageReveal {
    from {
        clip-path: inset(0 100% 0 0);
    }
    to {
        clip-path: inset(0 0 0 0);
    }
}

.img-reveal {
    animation: imageReveal 1s ease forwards;
}

/* ========================================
   Loading Animations
   ======================================== */

/* Spinner */
@keyframes spinner {
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--light-gray);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spinner 0.8s linear infinite;
}

/* Dots Loading */
@keyframes dotPulse {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

.dots-loading {
    display: flex;
    gap: 5px;
}

.dots-loading span {
    width: 10px;
    height: 10px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: dotPulse 1.4s ease-in-out infinite;
}

.dots-loading span:nth-child(1) { animation-delay: -0.32s; }
.dots-loading span:nth-child(2) { animation-delay: -0.16s; }

/* ========================================
   Scroll Animations
   ======================================== */

/* Parallax (scroll attachment avoids viewport-fixed bugs with transforms/overlays) */
.parallax {
    background-attachment: scroll;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

/* Progress Bar Animation */
@keyframes progressBar {
    from {
        width: 0;
    }
}

.progress-animated .progress-bar {
    animation: progressBar 1.5s ease forwards;
}

/* ========================================
   Number Counter Animation
   ======================================== */
.counter {
    font-variant-numeric: tabular-nums;
}

/* ========================================
   Stagger Animations
   ======================================== */
.stagger-animation > * {
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
}

.stagger-animation > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-animation > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-animation > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-animation > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-animation > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-animation > *:nth-child(6) { animation-delay: 0.6s; }

/* ========================================
   Page Transition
   ======================================== */
.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-color);
    z-index: 9999;
    transform: scaleX(0);
    transform-origin: right;
}

.page-transition.active {
    animation: pageSlide 0.8s ease;
}

@keyframes pageSlide {
    0% {
        transform: scaleX(0);
        transform-origin: right;
    }
    50% {
        transform: scaleX(1);
        transform-origin: right;
    }
    50.1% {
        transform-origin: left;
    }
    100% {
        transform: scaleX(0);
        transform-origin: left;
    }
}

/* ========================================
   Cursor Animation
   ======================================== */
.cursor-dot,
.cursor-outline {
    pointer-events: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    opacity: 1;
    z-index: 9999;
    transition: opacity 0.3s, transform 0.3s;
}

.cursor-dot {
    width: 8px;
    height: 8px;
    background: var(--secondary-color);
}

.cursor-outline {
    width: 40px;
    height: 40px;
    border: 2px solid var(--primary-color);
    transition: all 0.1s ease-out;
}

/* ========================================
   Smooth Reveal
   ======================================== */
.reveal {
    position: relative;
    overflow: hidden;
}

.reveal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-color);
    transform: translateX(-101%);
    z-index: 1;
}

.reveal.active::before {
    animation: revealSlide 1s ease forwards;
}

@keyframes revealSlide {
    0% {
        transform: translateX(-101%);
    }
    50% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(101%);
    }
}

/* ========================================
   Morphing Shape
   ======================================== */
@keyframes morph {
    0% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    50% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
    100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
}

.morph-shape {
    animation: morph 8s ease-in-out infinite;
}

/* ========================================
   Glowing Effect
   ======================================== */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px var(--secondary-color),
                    0 0 10px var(--secondary-color),
                    0 0 15px var(--secondary-color);
    }
    50% {
        box-shadow: 0 0 10px var(--secondary-color),
                    0 0 20px var(--secondary-color),
                    0 0 30px var(--secondary-color);
    }
}

.glow-effect {
    animation: glow 2s ease-in-out infinite;
}

/* ========================================
   Underline Animation
   ======================================== */
.underline-animation {
    position: relative;
    display: inline-block;
}

.underline-animation::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--secondary-color);
    transition: width 0.3s ease;
}

.underline-animation:hover::after {
    width: 100%;
}

/* ========================================
   Border Animation
   ======================================== */
.border-animation {
    position: relative;
}

.border-animation::before,
.border-animation::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border: 2px solid transparent;
    box-sizing: border-box;
}

.border-animation::before {
    top: 0;
    left: 0;
}

.border-animation::after {
    bottom: 0;
    right: 0;
}

.border-animation:hover::before,
.border-animation:hover::after {
    width: 100%;
    height: 100%;
}

.border-animation:hover::before {
    border-top-color: var(--secondary-color);
    border-right-color: var(--secondary-color);
    transition: width 0.25s ease-out, height 0.25s ease-out 0.25s;
}

.border-animation:hover::after {
    border-bottom-color: var(--secondary-color);
    border-left-color: var(--secondary-color);
    transition: border-color 0s ease-out 0.5s, width 0.25s ease-out 0.5s, height 0.25s ease-out 0.75s;
}

@media (prefers-reduced-motion: reduce) {
    [data-aos] {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}
