/* ==========================================================
   HOMIE DESIGN SYSTEM
   ANIMATION.CSS
   Version: 1.0
========================================================== */


/* ==========================================================
   KEYFRAMES
========================================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

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

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

@keyframes fadeDown {
    from {
        opacity: 0;
        transform: translateY(-24px);
    }

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

@keyframes slideLeft {
    from {
        opacity: 0;
        transform: translateX(36px);
    }

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

@keyframes slideRight {
    from {
        opacity: 0;
        transform: translateX(-36px);
    }

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

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

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

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

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


/* ==========================================================
   ANIMATION UTILITY
========================================================== */

.animate-fade-in {
    animation: fadeIn 0.7s ease both;
}

.animate-fade-up {
    animation: fadeUp 0.75s ease both;
}

.animate-fade-down {
    animation: fadeDown 0.7s ease both;
}

.animate-slide-left {
    animation: slideLeft 0.7s ease both;
}

.animate-slide-right {
    animation: slideRight 0.7s ease both;
}

.animate-scale-in {
    animation: scaleIn 0.65s ease both;
}

.animate-float {
    animation: floatY 3.5s ease-in-out infinite;
}


/* ==========================================================
   CURRENT HOME ANIMATION
========================================================== */

.homie-brand {
    animation: fadeDown 0.6s ease both;
}

.hero-content {
    animation: fadeUp 0.8s ease both;
}

.hero-card {
    opacity: 0;
    animation: slideLeft 0.65s ease forwards;
}

.hero-card:nth-child(1) {
    animation-delay: 0.15s;
}

.hero-card:nth-child(2) {
    animation-delay: 0.28s;
}

.hero-card:nth-child(3) {
    animation-delay: 0.41s;
}

.hero-card:nth-child(4) {
    animation-delay: 0.54s;
}


/* ==========================================================
   REDUCED MOTION
========================================================== */

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

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

/* ==========================================================
   PHASE 2 — SCROLL REVEAL ANIMATION
========================================================== */

/*
   JavaScript จะเพิ่ม Class .is-visible
   เมื่อองค์ประกอบเลื่อนเข้ามาในหน้าจอ
*/

.reveal-up,
.reveal-left,
.reveal-right,
.reveal-scale {
    opacity: 0;
    transition:
        opacity 0.75s ease,
        transform 0.75s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: opacity, transform;
}


/* เลื่อนขึ้น */

.reveal-up {
    transform: translateY(38px);
}


/* เลื่อนจากซ้าย */

.reveal-left {
    transform: translateX(-42px);
}


/* เลื่อนจากขวา */

.reveal-right {
    transform: translateX(42px);
}


/* ขยายเข้ามา */

.reveal-scale {
    transform: scale(0.94);
}


/* เมื่อปรากฏบนหน้าจอ */

.reveal-up.is-visible,
.reveal-left.is-visible,
.reveal-right.is-visible,
.reveal-scale.is-visible {
    opacity: 1;
    transform: none;
}


/* ==========================================================
   STAGGER DELAY
========================================================== */

.reveal-delay-1 {
    transition-delay: 0.08s;
}

.reveal-delay-2 {
    transition-delay: 0.16s;
}

.reveal-delay-3 {
    transition-delay: 0.24s;
}

.reveal-delay-4 {
    transition-delay: 0.32s;
}

.reveal-delay-5 {
    transition-delay: 0.40s;
}


/* ==========================================================
   HOVER REFINEMENT
========================================================== */

.service-card,
.portfolio-card,
.news-card,
.about-feature {
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}


/* ==========================================================
   REDUCED MOTION
========================================================== */

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

    .reveal-up,
    .reveal-left,
    .reveal-right,
    .reveal-scale {
        opacity: 1;
        transform: none;
        transition: none;
    }
}