/* ========================================
   SAFE LUXURY ANIMATIONS
   Content always visible, animations are enhancement only
   ======================================== */

/* Default: All content is visible */
section,
.credibility-card,
.tier-card,
.testimonial-card,
.problem-card,
.quick-tier,
.quick-phase,
.faq-item,
.phase-detailed,
.tier-card-full,
.package-card {
    opacity: 1;
}

/* Only hide during initial page load */
body.loading section:not(.hero):not(.navbar):not(.faq),
body.loading .credibility-card,
body.loading .tier-card,
body.loading .testimonial-card,
body.loading .problem-card,
body.loading .quick-tier,
body.loading .quick-phase {
    opacity: 0;
    transform: translateY(15px);
}

/* After page loads, remove loading class and show everything */
body:not(.loading) section,
body:not(.loading) .credibility-card,
body:not(.loading) .tier-card,
body:not(.loading) .testimonial-card,
body:not(.loading) .problem-card,
body:not(.loading) .quick-tier,
body:not(.loading) .quick-phase {
    opacity: 1;
    transform: translateY(0);
}

/* Smooth fade-in animation */
@keyframes luxuryFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* When visible class is added, apply smooth animation */
section.visible,
.credibility-card.visible,
.tier-card.visible,
.testimonial-card.visible,
.problem-card.visible,
.quick-tier.visible,
.quick-phase.visible,
.tier-card-full.visible,
.package-card.visible,
.phase-detailed.visible {
    animation: luxuryFadeIn 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Hero section and navigation always visible immediately */
.hero,
.navbar,
.top-banner,
.faq,
footer {
    opacity: 1 !important;
    animation: none !important;
}

/* Stagger animations for card grids - only if visible class added */
.credibility-card.visible:nth-child(1) { animation-delay: 0.1s; }
.credibility-card.visible:nth-child(2) { animation-delay: 0.2s; }
.credibility-card.visible:nth-child(3) { animation-delay: 0.3s; }

.tier-card.visible:nth-child(1) { animation-delay: 0.1s; }
.tier-card.visible:nth-child(2) { animation-delay: 0.2s; }
.tier-card.visible:nth-child(3) { animation-delay: 0.3s; }

.tier-card-full.visible:nth-child(1) { animation-delay: 0.1s; }
.tier-card-full.visible:nth-child(2) { animation-delay: 0.2s; }
.tier-card-full.visible:nth-child(3) { animation-delay: 0.3s; }

.quick-tier.visible:nth-child(1) { animation-delay: 0.1s; }
.quick-tier.visible:nth-child(2) { animation-delay: 0.2s; }
.quick-tier.visible:nth-child(3) { animation-delay: 0.3s; }

.quick-phase.visible:nth-child(1) { animation-delay: 0.05s; }
.quick-phase.visible:nth-child(2) { animation-delay: 0.1s; }
.quick-phase.visible:nth-child(3) { animation-delay: 0.15s; }
.quick-phase.visible:nth-child(4) { animation-delay: 0.2s; }
.quick-phase.visible:nth-child(5) { animation-delay: 0.25s; }
.quick-phase.visible:nth-child(6) { animation-delay: 0.3s; }

.testimonial-card.visible:nth-child(1) { animation-delay: 0.1s; }
.testimonial-card.visible:nth-child(2) { animation-delay: 0.2s; }
.testimonial-card.visible:nth-child(3) { animation-delay: 0.3s; }
.testimonial-card.visible:nth-child(4) { animation-delay: 0.35s; }
.testimonial-card.visible:nth-child(5) { animation-delay: 0.4s; }

.problem-card.visible:nth-child(1) { animation-delay: 0.05s; }
.problem-card.visible:nth-child(2) { animation-delay: 0.1s; }
.problem-card.visible:nth-child(3) { animation-delay: 0.15s; }
.problem-card.visible:nth-child(4) { animation-delay: 0.2s; }
.problem-card.visible:nth-child(5) { animation-delay: 0.25s; }
.problem-card.visible:nth-child(6) { animation-delay: 0.3s; }

.package-card.visible:nth-child(1) { animation-delay: 0.1s; }
.package-card.visible:nth-child(2) { animation-delay: 0.2s; }
.package-card.visible:nth-child(3) { animation-delay: 0.3s; }

/* Smooth transitions for hover states */
.credibility-card,
.tier-card,
.tier-card-full,
.testimonial-card,
.problem-card,
.quick-tier,
.package-card,
.btn {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.3s ease;
}

/* Remove loading class after very short delay to ensure everything shows */
@keyframes removeLoading {
    to { opacity: 1; }
}

/* Fallback: If loading class isn't removed, force visibility after 3 seconds */
body.loading {
    animation: removeLoading 0s 3s forwards;
}

body.loading::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    animation: removeLoading 0s 3s forwards;
}

/* Smooth navbar appearance */
.navbar {
    transition: box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        animation-delay: 0s !important;
    }
    
    section,
    .credibility-card,
    .tier-card,
    .testimonial-card,
    .problem-card,
    .quick-tier,
    .quick-phase {
        opacity: 1 !important;
        transform: none !important;
    }
    
    body.loading section,
    body.loading .credibility-card,
    body.loading .tier-card,
    body.loading .testimonial-card,
    body.loading .problem-card {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* Prevent layout shifts during animation */
section.visible,
.credibility-card.visible,
.tier-card.visible,
.testimonial-card.visible,
.problem-card.visible {
    will-change: auto;
}

/* Smooth number counting - no flash */
.stat-number {
    font-variant-numeric: tabular-nums;
    min-width: 100px;
    display: inline-block;
}

/* Smooth image loading */
img {
    transition: opacity 0.4s ease;
}

img.loaded,
img[src] {
    opacity: 1;
}

/* Smooth button interactions */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

/* Elegant hover effects */
.credibility-card:hover,
.tier-card:hover,
.tier-card-full:hover,
.testimonial-card:hover,
.package-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
}

/* Mobile optimizations */
@media (max-width: 768px) {
    section.visible,
    .credibility-card.visible,
    .tier-card.visible,
    .testimonial-card.visible,
    .problem-card.visible {
        animation-duration: 0.5s;
    }
    
    /* Reduce stagger on mobile */
    .credibility-card.visible,
    .tier-card.visible,
    .testimonial-card.visible,
    .problem-card.visible,
    .quick-tier.visible,
    .quick-phase.visible,
    .tier-card-full.visible,
    .package-card.visible {
        animation-delay: 0s !important;
    }
}

/* Ensure critical sections are always visible */
.page-hero,
.sessions-hero,
.pricing-hero,
main,
header,
nav {
    opacity: 1 !important;
}
