/* ========================================
   IONIO RE-SOLUTIONS - Scroll Animations
   Dynamic & Modern Entry Animations
   ======================================== */

/* ========================================
   BASE ANIMATION SETUP
   ======================================== */
[data-animate] {
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-animate].animated {
    opacity: 1;
    transform: none !important;
}

/* Disable animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    [data-animate] {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}

/* ========================================
   ANIMATION TYPES
   ======================================== */

/* Fade Up - Default */
[data-animate="fade-up"] {
    transform: translateY(60px);
}

/* Fade Down */
[data-animate="fade-down"] {
    transform: translateY(-60px);
}

/* Fade Left */
[data-animate="fade-left"] {
    transform: translateX(60px);
}

/* Fade Right */
[data-animate="fade-right"] {
    transform: translateX(-60px);
}

/* Scale Up */
[data-animate="scale-up"] {
    transform: scale(0.85);
}

/* Scale Down */
[data-animate="scale-down"] {
    transform: scale(1.15);
}

/* Zoom In */
[data-animate="zoom-in"] {
    transform: scale(0.5);
}

/* Flip Up */
[data-animate="flip-up"] {
    transform: perspective(1000px) rotateX(20deg) translateY(40px);
}

/* Slide Up Big */
[data-animate="slide-up"] {
    transform: translateY(100px);
}

/* Slide In Left */
[data-animate="slide-left"] {
    transform: translateX(100px);
}

/* Slide In Right */
[data-animate="slide-right"] {
    transform: translateX(-100px);
}

/* Blur In */
[data-animate="blur-in"] {
    transform: translateY(30px);
    filter: blur(10px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                filter 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-animate="blur-in"].animated {
    filter: blur(0);
}

/* Rotate In */
[data-animate="rotate-in"] {
    transform: rotate(-10deg) scale(0.9);
}

/* ========================================
   ANIMATION DELAYS
   ======================================== */
[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.4s;
}

[data-duration="normal"] {
    transition-duration: 0.8s;
}

[data-duration="slow"] {
    transition-duration: 1.2s;
}

/* ========================================
   HERO SPECIFIC ANIMATIONS
   ======================================== */
.hero {
    overflow: hidden;
}

/* Hero Badge Animation */
.hero-badge {
    animation: slideInBadge 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

@keyframes slideInBadge {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Hero Title Animation */
.hero-title {
    animation: slideInTitle 1s cubic-bezier(0.16, 1, 0.3, 1) 0.4s both;
}

@keyframes slideInTitle {
    from {
        opacity: 0;
        transform: translateY(40px);
        filter: blur(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

/* Hero Title Span Highlight */
.hero-title span {
    position: relative;
    display: inline-block;
}

.hero-title span::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 8px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    opacity: 0.3;
    transform: scaleX(0);
    transform-origin: left;
    animation: underlineGrow 0.8s cubic-bezier(0.16, 1, 0.3, 1) 1s both;
    border-radius: 4px;
}

@keyframes underlineGrow {
    to {
        transform: scaleX(1);
    }
}

/* Hero Subtitle */
.hero-subtitle {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.6s both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Search Box Animation */
.search-box {
    animation: slideUpSearch 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.8s both;
}

@keyframes slideUpSearch {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Hero Stats Animation */
.hero-stats {
    animation: fadeInStats 0.8s cubic-bezier(0.16, 1, 0.3, 1) 1s both;
}

@keyframes fadeInStats {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-stats .stat {
    animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.hero-stats .stat:nth-child(1) { animation-delay: 1.1s; }
.hero-stats .stat:nth-child(2) { animation-delay: 1.2s; }
.hero-stats .stat:nth-child(3) { animation-delay: 1.3s; }

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Hero Background Shapes */
.hero-shapes .shape {
    animation: floatShape 20s ease-in-out infinite;
}

.hero-shapes .shape-1 {
    animation-delay: 0s;
}

.hero-shapes .shape-2 {
    animation-delay: -7s;
}

.hero-shapes .shape-3 {
    animation-delay: -14s;
}

@keyframes floatShape {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-20px) rotate(5deg);
    }
    50% {
        transform: translateY(0) rotate(0deg);
    }
    75% {
        transform: translateY(20px) rotate(-5deg);
    }
}

/* Hero Image Parallax Effect */
.hero-image {
    animation: heroImageIn 1.5s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
}

@keyframes heroImageIn {
    from {
        opacity: 0;
        transform: scale(1.1);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========================================
   SECTION HEADERS ANIMATION
   ======================================== */
.section-header {
    text-align: center;
}

.section-label {
    display: inline-block;
}

.section-title span {
    position: relative;
}

/* ========================================
   PROPERTY CARDS STAGGER ANIMATION
   ======================================== */
.properties-grid .property-card {
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.properties-grid .property-card:nth-child(1) { transition-delay: 0ms; }
.properties-grid .property-card:nth-child(2) { transition-delay: 100ms; }
.properties-grid .property-card:nth-child(3) { transition-delay: 200ms; }
.properties-grid .property-card:nth-child(4) { transition-delay: 300ms; }
.properties-grid .property-card:nth-child(5) { transition-delay: 400ms; }
.properties-grid .property-card:nth-child(6) { transition-delay: 500ms; }

/* ========================================
   WHY CARDS ANIMATION
   ======================================== */
.why-card {
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.why-grid[data-animated] .why-card:nth-child(1) { transition-delay: 0ms; }
.why-grid[data-animated] .why-card:nth-child(2) { transition-delay: 150ms; }
.why-grid[data-animated] .why-card:nth-child(3) { transition-delay: 300ms; }
.why-grid[data-animated] .why-card:nth-child(4) { transition-delay: 450ms; }

/* Why Icon Animation */
.why-card .why-icon {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.why-card:hover .why-icon {
    transform: scale(1.1) rotate(5deg);
}

.why-card .why-icon svg {
    transition: stroke 0.3s ease;
}

/* ========================================
   TESTIMONIALS ANIMATION
   ======================================== */
.testimonial-card {
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Stars Animation */
.testimonial-stars svg {
    animation: starPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.testimonial-card.animated .testimonial-stars svg:nth-child(1) { animation-delay: 0ms; }
.testimonial-card.animated .testimonial-stars svg:nth-child(2) { animation-delay: 100ms; }
.testimonial-card.animated .testimonial-stars svg:nth-child(3) { animation-delay: 200ms; }
.testimonial-card.animated .testimonial-stars svg:nth-child(4) { animation-delay: 300ms; }
.testimonial-card.animated .testimonial-stars svg:nth-child(5) { animation-delay: 400ms; }

@keyframes starPop {
    from {
        opacity: 0;
        transform: scale(0) rotate(-30deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

/* ========================================
   CTA SECTION ANIMATION
   ======================================== */
.cta-section {
    position: relative;
    overflow: hidden;
}

.cta-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* ========================================
   CONTACT SECTION ANIMATION
   ======================================== */
.contact-item {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.contact-item:hover {
    transform: translateX(10px);
}

.contact-icon {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                background 0.3s ease;
}

.contact-item:hover .contact-icon {
    transform: scale(1.1);
}

/* ========================================
   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;
}

/* ========================================
   SCROLL INDICATOR
   ======================================== */
.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--gray);
    font-size: 0.8rem;
    animation: bounce 2s infinite;
    cursor: pointer;
    z-index: 10;
}

.scroll-indicator-mouse {
    width: 24px;
    height: 38px;
    border: 2px solid var(--gray);
    border-radius: 12px;
    position: relative;
}

.scroll-indicator-mouse::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 8px;
    background: var(--primary);
    border-radius: 2px;
    animation: scrollWheel 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    40% {
        transform: translateX(-50%) translateY(-10px);
    }
    60% {
        transform: translateX(-50%) translateY(-5px);
    }
}

@keyframes scrollWheel {
    0% {
        opacity: 1;
        top: 8px;
    }
    100% {
        opacity: 0;
        top: 20px;
    }
}

/* ========================================
   LOADING ANIMATION
   ======================================== */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.page-loader.loaded {
    opacity: 0;
    visibility: hidden;
}

.page-loader-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--light-gray);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   IMAGE REVEAL ANIMATION
   ======================================== */
.image-reveal {
    position: relative;
    overflow: hidden;
}

.image-reveal::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary);
    transform: scaleX(1);
    transform-origin: right;
    transition: transform 0.8s cubic-bezier(0.77, 0, 0.175, 1);
}

.image-reveal.animated::after {
    transform: scaleX(0);
}

.image-reveal img {
    transform: scale(1.2);
    transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.image-reveal.animated img {
    transform: scale(1);
}

/* ========================================
   TEXT REVEAL ANIMATION
   ======================================== */
.text-reveal {
    overflow: hidden;
}

.text-reveal > * {
    transform: translateY(100%);
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.text-reveal.animated > * {
    transform: translateY(0);
}

/* ========================================
   COUNTER ANIMATION
   ======================================== */
.stat-number {
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

/* ========================================
   MOBILE OPTIMIZATIONS
   ======================================== */
@media (max-width: 768px) {
    [data-animate] {
        transition-duration: 0.6s;
    }

    .hero-title {
        animation-duration: 0.8s;
    }

    .scroll-indicator {
        display: none;
    }

    /* Reduce animation intensity on mobile */
    [data-animate="fade-up"],
    [data-animate="slide-up"] {
        transform: translateY(40px);
    }

    [data-animate="fade-left"],
    [data-animate="slide-left"] {
        transform: translateX(40px);
    }

    [data-animate="fade-right"],
    [data-animate="slide-right"] {
        transform: translateX(-40px);
    }
}
