/* ============================================
   ANIMATIONS & MICRO-INTERACTIONS
   Ce Que New York M'a Fait
   ============================================ */

/* ============================================
   SCROLL-TRIGGERED FADE IN
   ============================================ */

.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.fade-in-slow {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1.2s ease, transform 1.2s ease;
}

.fade-in-slow.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered children */
.stagger-children > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.stagger-children.visible > *:nth-child(1) { transition-delay: 0.1s; }
.stagger-children.visible > *:nth-child(2) { transition-delay: 0.2s; }
.stagger-children.visible > *:nth-child(3) { transition-delay: 0.3s; }
.stagger-children.visible > *:nth-child(4) { transition-delay: 0.4s; }
.stagger-children.visible > *:nth-child(5) { transition-delay: 0.5s; }
.stagger-children.visible > *:nth-child(6) { transition-delay: 0.6s; }

.stagger-children.visible > * {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   HERO ANIMATIONS
   ============================================ */

/* Initial load animation */
.hero-content {
    opacity: 0;
    animation: heroFadeIn 1.2s ease forwards;
    animation-delay: 0.3s;
}

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

/* Book float animation */
.book-mockup {
    animation: bookFloat 6s ease-in-out infinite;
}

@keyframes bookFloat {
    0%, 100% {
        transform: translateY(0) rotateY(-5deg);
    }
    50% {
        transform: translateY(-10px) rotateY(-5deg);
    }
}

.book-mockup:hover {
    animation-play-state: paused;
}

/* Hero background subtle movement - Ken Burns drift effect */
.hero-image {
    animation: heroDrift 25s ease-in-out infinite;
    transform-origin: center center;
}

@keyframes heroDrift {
    0% {
        transform: scale(1.02) translate(0, 0);
    }
    25% {
        transform: scale(1.06) translate(-0.5%, -0.3%);
    }
    50% {
        transform: scale(1.04) translate(0.3%, 0.2%);
    }
    75% {
        transform: scale(1.07) translate(-0.3%, 0.4%);
    }
    100% {
        transform: scale(1.02) translate(0, 0);
    }
}

/* ============================================
   BUTTON HOVER EFFECTS
   ============================================ */

.cta-button {
    position: relative;
    overflow: hidden;
}

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

.cta-button:hover::before {
    left: 100%;
}

/* Pulse effect for primary CTA */
.cta-button.primary {
    animation: subtlePulse 3s ease-in-out infinite;
}

@keyframes subtlePulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(201, 162, 39, 0.3);
    }
    50% {
        box-shadow: 0 4px 25px rgba(201, 162, 39, 0.5);
    }
}

.cta-button:hover {
    animation: none;
}

/* ============================================
   PULL QUOTE ANIMATION
   ============================================ */

.pull-quote {
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.pull-quote.visible {
    opacity: 1;
    transform: translateX(0);
}

/* ============================================
   CHAPTER HOVER EFFECTS
   ============================================ */

.chapter-item {
    position: relative;
    overflow: hidden;
}

.chapter-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--color-gold);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.chapter-item:hover::before {
    transform: scaleY(1);
}

.chapter-number {
    transition: transform 0.3s ease, color 0.3s ease;
}

.chapter-item:hover .chapter-number {
    transform: translateX(5px);
    color: var(--color-gold);
}

/* ============================================
   TESTIMONIAL CARDS
   ============================================ */

.testimonial-card {
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.testimonial-card:hover {
    transform: translateY(-8px);
}

/* Stars twinkle on hover */
.testimonial-stars {
    transition: transform 0.3s ease;
}

.testimonial-card:hover .testimonial-stars {
    animation: starTwinkle 0.6s ease;
}

@keyframes starTwinkle {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ============================================
   FAQ ACCORDION
   ============================================ */

.faq-question {
    position: relative;
}

.faq-question::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--color-gold);
    transition: width 0.3s ease;
}

.faq-item:hover .faq-question::after {
    width: 100%;
}

.faq-icon {
    transition: transform 0.3s ease;
}

/* ============================================
   BOOK COVER EFFECTS
   ============================================ */

.book-cover {
    transition: transform 0.5s ease, box-shadow 0.5s ease;
}

.book-mockup:hover .book-cover {
    transform: rotateY(0deg) translateY(-15px) scale(1.02);
    box-shadow:
        0 30px 60px -15px rgba(0, 0, 0, 0.4),
        0 15px 30px -10px rgba(0, 0, 0, 0.3);
}

/* ============================================
   SCROLL PROGRESS INDICATOR
   ============================================ */

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--color-gold);
    z-index: calc(var(--z-sticky) + 1);
    transform-origin: left;
    transform: scaleX(0);
    transition: transform 0.1s linear;
}

/* ============================================
   PARALLAX HELPERS
   ============================================ */

.parallax-slow {
    will-change: transform;
    transition: transform 0.1s linear;
}

/* ============================================
   IMAGE LOAD ANIMATION
   ============================================ */

img {
    opacity: 0;
    transition: opacity 0.5s ease;
}

img.loaded {
    opacity: 1;
}

/* Eager images should show immediately */
img[loading="eager"] {
    opacity: 1;
}

/* ============================================
   SECTION TRANSITIONS
   ============================================ */

section {
    position: relative;
}

/* Gradient overlays for smooth section transitions */
.section-transition-top::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(to bottom, var(--color-cream), transparent);
    pointer-events: none;
    z-index: 1;
}

.section-transition-bottom::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(to top, var(--color-cream), transparent);
    pointer-events: none;
    z-index: 1;
}

/* ============================================
   LINK UNDERLINE ANIMATION
   ============================================ */

.animated-link {
    position: relative;
    display: inline-block;
}

.animated-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

.animated-link:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

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

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

    .hero-image {
        animation: none;
    }

    .book-mockup {
        animation: none;
    }

    .cta-button.primary {
        animation: none;
    }

    .scroll-arrow {
        animation: none;
    }
}

/* ============================================
   LOADING STATE
   ============================================ */

.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}
