/* ============================================
   MI HONG | 宓宏 - Animations Stylesheet
   ============================================ */

/* ============================================
   SCROLL REVEAL ANIMATIONS
   ============================================ */

/* Base states for animated elements */
[data-animate] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

[data-animate].animated {
    opacity: 1;
    transform: translateY(0);
}

/* Different animation variants */
[data-animate="fade-up"] {
    opacity: 0;
    transform: translateY(40px);
}

[data-animate="fade-up"].animated {
    opacity: 1;
    transform: translateY(0);
}

[data-animate="fade-down"] {
    opacity: 0;
    transform: translateY(-40px);
}

[data-animate="fade-down"].animated {
    opacity: 1;
    transform: translateY(0);
}

[data-animate="fade-left"] {
    opacity: 0;
    transform: translateX(-40px);
}

[data-animate="fade-left"].animated {
    opacity: 1;
    transform: translateX(0);
}

[data-animate="fade-right"] {
    opacity: 0;
    transform: translateX(40px);
}

[data-animate="fade-right"].animated {
    opacity: 1;
    transform: translateX(0);
}

[data-animate="fade-in"] {
    opacity: 0;
    transform: none;
}

[data-animate="fade-in"].animated {
    opacity: 1;
}

[data-animate="scale-up"] {
    opacity: 0;
    transform: scale(0.9);
}

[data-animate="scale-up"].animated {
    opacity: 1;
    transform: scale(1);
}

[data-animate="zoom-in"] {
    opacity: 0;
    transform: scale(0.8);
}

[data-animate="zoom-in"].animated {
    opacity: 1;
    transform: scale(1);
}

/* Animation delays for staggered effects */
[data-delay="100"] {
    transition-delay: 100ms;
}

[data-delay="200"] {
    transition-delay: 200ms;
}

[data-delay="300"] {
    transition-delay: 300ms;
}

[data-delay="400"] {
    transition-delay: 400ms;
}

[data-delay="500"] {
    transition-delay: 500ms;
}

[data-delay="600"] {
    transition-delay: 600ms;
}

[data-delay="700"] {
    transition-delay: 700ms;
}

[data-delay="800"] {
    transition-delay: 800ms;
}

/* Animation durations */
[data-duration="fast"] {
    transition-duration: 0.3s;
}

[data-duration="normal"] {
    transition-duration: 0.6s;
}

[data-duration="slow"] {
    transition-duration: 0.9s;
}

[data-duration="slower"] {
    transition-duration: 1.2s;
}

/* ============================================
   HERO SECTION ANIMATIONS
   ============================================ */
.hero-content>* {
    opacity: 0;
    transform: translateY(30px);
}

.hero-loaded .hero-content>* {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-loaded .hero-title {
    transition-delay: 0.1s;
}

.hero-loaded .hero-subtitle {
    transition-delay: 0.2s;
}

.hero-loaded .hero-cta {
    transition-delay: 0.3s;
}

.hero-loaded .hero-testimonial {
    transition-delay: 0.5s;
}

.hero-image {
    opacity: 0;
    transform: translate3d(50px, 0, 0);
    will-change: transform, opacity;
    backface-visibility: hidden;
}

.hero-loaded .hero-image {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    transition: opacity 0.8s ease-out 0.3s, transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.3s;
}

/* Use vertical animation on mobile to prevent overflow */
@media (max-width: 768px) {
    .hero-image {
        opacity: 0;
        transform: translate3d(0, 30px, 0);
    }

    .hero-loaded .hero-image {
        opacity: 1;
        transform: translate3d(0, 0, 0);
        transition: opacity 0.6s ease-out 0.3s, transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.3s;
    }
}

.hero-badge {
    opacity: 0;
    transform: translateY(-50%) scale(0.5);
}

.hero-loaded .hero-badge {
    opacity: 1;
    transform: translateY(-50%) scale(1);
    transition: opacity 0.6s ease 0.6s, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.6s;
}

/* ============================================
   COUNTER ANIMATION
   ============================================ */
.stat-number {
    display: inline-block;
}

.stat-number.counting {
    animation: countPulse 0.3s ease-out;
}

@keyframes countPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* ============================================
   TIMELINE ANIMATION
   ============================================ */
.process-timeline::before {
    transform-origin: top;
    transform: scaleY(0);
    transition: transform 1.5s ease-out;
}

.process-timeline.animated::before {
    transform: scaleY(1);
}

.process-step {
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.5s ease-out;
}

.process-timeline.animated .process-step {
    opacity: 1;
    transform: translateX(0);
}

.process-timeline.animated .process-step:nth-child(1) {
    transition-delay: 0.1s;
}

.process-timeline.animated .process-step:nth-child(2) {
    transition-delay: 0.3s;
}

.process-timeline.animated .process-step:nth-child(3) {
    transition-delay: 0.5s;
}

.process-timeline.animated .process-step:nth-child(4) {
    transition-delay: 0.7s;
}

.process-timeline.animated .process-step:nth-child(5) {
    transition-delay: 0.9s;
}

.process-step-number {
    transform: scale(0);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.process-timeline.animated .process-step-number {
    transform: scale(1);
}

.process-timeline.animated .process-step:nth-child(1) .process-step-number {
    transition-delay: 0.2s;
}

.process-timeline.animated .process-step:nth-child(2) .process-step-number {
    transition-delay: 0.4s;
}

.process-timeline.animated .process-step:nth-child(3) .process-step-number {
    transition-delay: 0.6s;
}

.process-timeline.animated .process-step:nth-child(4) .process-step-number {
    transition-delay: 0.8s;
}

.process-timeline.animated .process-step:nth-child(5) .process-step-number {
    transition-delay: 1s;
}

/* ============================================
   CARD STAGGER ANIMATIONS
   ============================================ */
.service-card,
.category-card {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out, box-shadow 0.3s ease;
}

.services-grid.animated .service-card,
.categories-grid.animated .category-card {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger for service cards */
.services-grid.animated .service-card:nth-child(1) {
    transition-delay: 0.1s;
}

.services-grid.animated .service-card:nth-child(2) {
    transition-delay: 0.2s;
}

.services-grid.animated .service-card:nth-child(3) {
    transition-delay: 0.3s;
}

/* Stagger for category cards */
.categories-grid.animated .category-card:nth-child(1) {
    transition-delay: 0.05s;
}

.categories-grid.animated .category-card:nth-child(2) {
    transition-delay: 0.1s;
}

.categories-grid.animated .category-card:nth-child(3) {
    transition-delay: 0.15s;
}

.categories-grid.animated .category-card:nth-child(4) {
    transition-delay: 0.2s;
}

.categories-grid.animated .category-card:nth-child(5) {
    transition-delay: 0.25s;
}

.categories-grid.animated .category-card:nth-child(6) {
    transition-delay: 0.3s;
}

.categories-grid.animated .category-card:nth-child(7) {
    transition-delay: 0.35s;
}

.categories-grid.animated .category-card:nth-child(8) {
    transition-delay: 0.4s;
}

/* ============================================
   ABOUT SECTION ANIMATIONS
   ============================================ */
.about-collage {
    opacity: 0;
    transform: translateX(-40px);
    transition: all 0.8s ease-out;
}

.about-collage.animated {
    opacity: 1;
    transform: translateX(0);
}

.about-content {
    opacity: 0;
    transform: translateX(40px);
    transition: all 0.8s ease-out 0.2s;
}

.about-content.animated {
    opacity: 1;
    transform: translateX(0);
}

.about-badge {
    transform: scale(0) rotate(-10deg);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.5s;
}

.about-collage.animated .about-badge {
    transform: scale(1) rotate(0deg);
}

.about-feature {
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.4s ease-out;
}

.about-content.animated .about-feature:nth-child(1) {
    transition-delay: 0.4s;
}

.about-content.animated .about-feature:nth-child(2) {
    transition-delay: 0.5s;
}

.about-content.animated .about-feature:nth-child(3) {
    transition-delay: 0.6s;
}

.about-content.animated .about-feature {
    opacity: 1;
    transform: translateX(0);
}

/* ============================================
   TESTIMONIAL ANIMATIONS
   ============================================ */
.testimonial-image {
    opacity: 0;
    transform: translateX(-40px);
    transition: all 0.8s ease-out;
}

.testimonial-image.animated {
    opacity: 1;
    transform: translateX(0);
}

.testimonial-content {
    opacity: 0;
    transform: translateX(40px);
    transition: all 0.8s ease-out 0.2s;
}

.testimonial-content.animated {
    opacity: 1;
    transform: translateX(0);
}

/* ============================================
   CONTACT FORM ANIMATIONS
   ============================================ */
.contact-image {
    opacity: 0;
    transform: translateX(-40px);
    transition: all 0.8s ease-out;
}

.contact-image.animated {
    opacity: 1;
    transform: translateX(0);
}

.contact-form-wrapper {
    opacity: 0;
    transform: translateX(40px);
    transition: all 0.8s ease-out 0.2s;
}

.contact-form-wrapper.animated {
    opacity: 1;
    transform: translateX(0);
}

/* ============================================
   BUTTON ANIMATIONS
   ============================================ */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

/* ============================================
   LOADING SPINNER
   ============================================ */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   FLOATING ANIMATION
   ============================================ */
.float {
    animation: float 6s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* ============================================
   SHAKE ANIMATION (for form errors)
   ============================================ */
.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

/* ============================================
   GLOW ANIMATION
   ============================================ */
.glow {
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 0 5px var(--color-primary), 0 0 10px var(--color-primary);
    }

    to {
        box-shadow: 0 0 10px var(--color-primary), 0 0 20px var(--color-primary);
    }
}

/* ============================================
   PREFERS REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {

    [data-animate],
    .hero-content>*,
    .hero-image,
    .hero-badge,
    .process-timeline::before,
    .process-step,
    .process-step-number,
    .service-card,
    .category-card,
    .about-collage,
    .about-content,
    .about-badge,
    .about-feature,
    .testimonial-image,
    .testimonial-content,
    .contact-image,
    .contact-form-wrapper {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
        animation: none !important;
    }
}