/* ============================================
   HARISON HOMES - Motion Animations
   21st.dev / Framer Motion Style Effects
   ============================================ */

/* -------------------- Animation Keyframes -------------------- */

/* Fade In Up - Primary reveal animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

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

/* Fade In Down */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-40px);
    }

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

/* Fade In Scale - Subtle zoom effect */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.92);
    }

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

/* Fade In Left */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }

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

/* Fade In Right */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

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

/* Blur In */
@keyframes blurIn {
    from {
        opacity: 0;
        filter: blur(10px);
        transform: translateY(20px);
    }

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

/* Subtle Float */
@keyframes float {

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

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

/* Pulse Glow */
@keyframes pulseGlow {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(200, 169, 106, 0.4);
    }

    50% {
        box-shadow: 0 0 20px 10px rgba(200, 169, 106, 0);
    }
}

/* Shimmer Effect */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

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

/* Rotate In */
@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-10deg) scale(0.9);
    }

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

/* Slide In Bounce */
@keyframes slideInBounce {
    0% {
        opacity: 0;
        transform: translateY(60px);
    }

    60% {
        opacity: 1;
        transform: translateY(-10px);
    }

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

/* Counter Spin */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Background Pan */
@keyframes bgPan {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Text Reveal */
@keyframes textReveal {
    from {
        clip-path: inset(0 100% 0 0);
    }

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

/* Line Grow */
@keyframes lineGrow {
    from {
        transform: scaleX(0);
    }

    to {
        transform: scaleX(1);
    }
}

/* -------------------- Animation Classes -------------------- */

/* Base animation setup - Hidden by default until triggered */
.animate {
    opacity: 0;
    will-change: transform, opacity;
}

.animate.in-view {
    animation-fill-mode: forwards;
    animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Fade In Up */
.animate-fade-up {
    opacity: 0;
    transform: translateY(40px);
}

.animate-fade-up.in-view {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Fade In Down */
.animate-fade-down {
    opacity: 0;
    transform: translateY(-40px);
}

.animate-fade-down.in-view {
    animation: fadeInDown 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Fade In Scale */
.animate-fade-scale {
    opacity: 0;
    transform: scale(0.92);
}

.animate-fade-scale.in-view {
    animation: fadeInScale 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Fade In Left */
.animate-fade-left {
    opacity: 0;
    transform: translateX(-40px);
}

.animate-fade-left.in-view {
    animation: fadeInLeft 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Fade In Right */
.animate-fade-right {
    opacity: 0;
    transform: translateX(40px);
}

.animate-fade-right.in-view {
    animation: fadeInRight 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Blur In */
.animate-blur-in {
    opacity: 0;
    filter: blur(10px);
    transform: translateY(20px);
}

.animate-blur-in.in-view {
    animation: blurIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Slide In Bounce */
.animate-bounce-in {
    opacity: 0;
    transform: translateY(60px);
}

.animate-bounce-in.in-view {
    animation: slideInBounce 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* -------------------- Stagger Delays -------------------- */
.stagger-1 {
    animation-delay: 0.1s;
}

.stagger-2 {
    animation-delay: 0.2s;
}

.stagger-3 {
    animation-delay: 0.3s;
}

.stagger-4 {
    animation-delay: 0.4s;
}

.stagger-5 {
    animation-delay: 0.5s;
}

.stagger-6 {
    animation-delay: 0.6s;
}

.stagger-7 {
    animation-delay: 0.7s;
}

.stagger-8 {
    animation-delay: 0.8s;
}

/* Animation Durations */
.duration-fast {
    animation-duration: 0.4s;
}

.duration-normal {
    animation-duration: 0.6s;
}

.duration-slow {
    animation-duration: 1s;
}

.duration-slower {
    animation-duration: 1.4s;
}

/* -------------------- Hero Animations -------------------- */
.hero-animate .hero-title {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 1s cubic-bezier(0.16, 1, 0.3, 1) 5s forwards;
}

.hero-animate .hero-subtitle {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 1s cubic-bezier(0.16, 1, 0.3, 1) 5.2s forwards;
}

.hero-animate .hero-search {
    opacity: 0;
    transform: translateY(40px);
    animation: fadeInUp 1s cubic-bezier(0.16, 1, 0.3, 1) 0.6s forwards;
}

/* -------------------- Hover Animations -------------------- */

/* Card Lift */
.hover-lift {
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

/* Card Tilt */
.hover-tilt {
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transform-style: preserve-3d;
    perspective: 1000px;
}

/* Scale Up */
.hover-scale {
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.hover-scale:hover {
    transform: scale(1.03);
}

/* Image Zoom */
.hover-zoom {
    overflow: hidden;
}

.hover-zoom img {
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.hover-zoom:hover img {
    transform: scale(1.1);
}

/* Glow Effect */
.hover-glow {
    transition: box-shadow 0.4s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(200, 169, 106, 0.3);
}

/* Button Shine */
.btn-shine {
    position: relative;
    overflow: hidden;
}

.btn-shine::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.3),
            transparent);
    transition: left 0.5s ease;
}

.btn-shine:hover::before {
    left: 100%;
}

/* Underline Grow */
.hover-underline {
    position: relative;
}

.hover-underline::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--color-secondary);
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.hover-underline:hover::after {
    width: 100%;
}

/* Arrow Move */
.hover-arrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.hover-arrow svg {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.hover-arrow:hover svg {
    transform: translateX(6px);
}

/* -------------------- Scroll-Triggered Parallax -------------------- */
.parallax-bg {
    will-change: transform;
    transition: transform 0.1s linear;
}

/* -------------------- Loading States -------------------- */
.skeleton {
    background: linear-gradient(90deg,
            var(--color-gray-200) 25%,
            var(--color-gray-100) 50%,
            var(--color-gray-200) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

/* -------------------- Micro Interactions -------------------- */

/* Focus Ring */
.focus-ring:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(200, 169, 106, 0.4);
}

/* Tap Scale (for mobile) */
.tap-scale:active {
    transform: scale(0.97);
}

/* Icon Spin on Hover */
.icon-spin:hover svg {
    animation: spin 0.8s ease;
}

/* -------------------- Text Animations -------------------- */

/* Gradient Text Animation */
.text-gradient-animate {
    background: linear-gradient(90deg,
            var(--color-primary),
            var(--color-secondary),
            var(--color-primary));
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: bgPan 4s linear infinite;
}

/* Character by character reveal */
.text-reveal {
    clip-path: inset(0 100% 0 0);
}

.text-reveal.in-view {
    animation: textReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* -------------------- Section Transitions -------------------- */

/* Fade section background */
.section-fade {
    opacity: 0;
    transition: opacity 0.8s ease;
}

.section-fade.in-view {
    opacity: 1;
}

/* Line decoration animation */
.line-animated {
    transform: scaleX(0);
    transform-origin: left;
}

.line-animated.in-view {
    animation: lineGrow 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* -------------------- Floating Elements -------------------- */
.float-slow {
    animation: float 6s ease-in-out infinite;
}

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

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

/* -------------------- Counter Animation -------------------- */
.counter-animate {
    display: inline-block;
    transition: all 0.3s ease;
}

/* -------------------- Filter Animations -------------------- */
.property-grid {
    transition: opacity 0.3s ease;
}

.property-grid.filtering {
    opacity: 0.5;
}

.property-card-animated {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.property-card-animated.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.property-card-animated.hide {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    position: absolute;
}

/* -------------------- Page Transition -------------------- */
.page-transition {
    opacity: 0;
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.1s forwards;
}

/* -------------------- Reduced Motion -------------------- */
@media (prefers-reduced-motion: reduce) {

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

    .animate,
    .animate-fade-up,
    .animate-fade-down,
    .animate-fade-scale,
    .animate-fade-left,
    .animate-fade-right,
    .animate-blur-in,
    .animate-bounce-in {
        opacity: 1;
        transform: none;
        filter: none;
    }

    .hero-animate .hero-title,
    .hero-animate .hero-subtitle,
    .hero-animate .hero-search {
        opacity: 1;
        transform: none;
    }
}

/* -------------------- Mobile Visibility Fix -------------------- */
/* Disable fragile scroll-triggered animations on mobile to prevent "white/blank" screen issue */
@media (max-width: 768px) {

    .animate,
    .animate-fade-up,
    .animate-fade-down,
    .animate-fade-scale,
    .animate-fade-left,
    .animate-fade-right,
    .animate-blur-in,
    .animate-bounce-in,
    .hero-animate .hero-title,
    .hero-animate .hero-subtitle,
    .hero-animate .hero-search,
    .text-reveal,
    .section-fade,
    .property-card-animated,
    .wait-on-scroll {
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
        animation: none !important;
        transition: none !important;
        visibility: visible !important;
    }

    /* Ensure stagger items are also visible */
    [data-stagger-item] {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
    }
}