/* ============================================================
   Toured — Scroll Animations & Transitions
   ============================================================ */

/* --- Base animation states (hidden before scroll trigger) --- */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Slide from left */
.animate-slide-left {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-slide-left.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Slide from right */
.animate-slide-right {
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-slide-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Scale up */
.animate-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-scale.visible {
    opacity: 1;
    transform: scale(1);
}

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

.animate-fade.visible {
    opacity: 1;
}

/* --- Stagger delays for children --- */
.stagger-children > *:nth-child(1) { transition-delay: 0ms; }
.stagger-children > *:nth-child(2) { transition-delay: 80ms; }
.stagger-children > *:nth-child(3) { transition-delay: 160ms; }
.stagger-children > *:nth-child(4) { transition-delay: 240ms; }
.stagger-children > *:nth-child(5) { transition-delay: 320ms; }
.stagger-children > *:nth-child(6) { transition-delay: 400ms; }
.stagger-children > *:nth-child(7) { transition-delay: 480ms; }
.stagger-children > *:nth-child(8) { transition-delay: 560ms; }

/* --- Hero entrance animations --- */
.hero-enter-badge {
    opacity: 0;
    transform: translateY(20px);
    animation: heroFadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}

.hero-enter-title {
    opacity: 0;
    transform: translateY(30px);
    animation: heroFadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.4s forwards;
}

.hero-enter-subtitle {
    opacity: 0;
    transform: translateY(20px);
    animation: heroFadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.6s forwards;
}

.hero-enter-buttons {
    opacity: 0;
    transform: translateY(20px);
    animation: heroFadeUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.8s forwards;
}

.hero-enter-phone {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
    animation: heroPhoneUp 1s cubic-bezier(0.16, 1, 0.3, 1) 1s forwards;
}

.hero-enter-cards {
    opacity: 0;
    animation: heroFadeIn 0.8s ease 1.4s forwards;
}

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

@keyframes heroPhoneUp {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes heroFadeIn {
    to { opacity: 1; }
}

/* --- Counter animation --- */
.counter-value {
    font-variant-numeric: tabular-nums;
}

/* --- Timeline step animation --- */
.timeline-item {
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.timeline-item.visible {
    opacity: 1;
    transform: translateX(0);
}

.timeline-item:nth-child(1) { transition-delay: 0s; }
.timeline-item:nth-child(2) { transition-delay: 0.15s; }
.timeline-item:nth-child(3) { transition-delay: 0.3s; }
.timeline-item:nth-child(4) { transition-delay: 0.45s; }
.timeline-item:nth-child(5) { transition-delay: 0.6s; }

/* --- Rating bar fill animation --- */
.mock-rating-fill {
    width: 0;
    transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.mock-rating-fill.animate {
    /* widths set inline */
}

/* --- Star twinkle animation --- */
@keyframes starPop {
    0% { transform: scale(0) rotate(-30deg); opacity: 0; }
    60% { transform: scale(1.2) rotate(5deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.mini-star {
    opacity: 0;
    transform: scale(0);
}

.mini-star.animate {
    animation: starPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.mini-star:nth-child(1).animate { animation-delay: 0s; }
.mini-star:nth-child(2).animate { animation-delay: 0.1s; }
.mini-star:nth-child(3).animate { animation-delay: 0.2s; }
.mini-star:nth-child(4).animate { animation-delay: 0.3s; }
.mini-star:nth-child(5).animate { animation-delay: 0.4s; }

/* --- Parallax support --- */
.parallax-slow {
    will-change: transform;
}

/* --- Gradient background animation for hero --- */
@keyframes meshGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.hero-bg .mesh-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        -45deg,
        var(--bg-primary),
        var(--bg-primary),
        rgba(0, 122, 255, 0.03),
        rgba(0, 216, 255, 0.04),
        var(--bg-primary)
    );
    background-size: 400% 400%;
    animation: meshGradient 15s ease infinite;
}

/* --- Focus and accessibility --- */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .animate-on-scroll,
    .animate-slide-left,
    .animate-slide-right,
    .animate-scale,
    .animate-fade {
        opacity: 1;
        transform: none;
    }

    .hero-enter-badge,
    .hero-enter-title,
    .hero-enter-subtitle,
    .hero-enter-buttons,
    .hero-enter-phone,
    .hero-enter-cards {
        opacity: 1;
        transform: none;
    }

    .timeline-item,
    .mini-star {
        opacity: 1;
        transform: none;
    }

}
