/* =================================
   ANIMATIONS
   Smooth, gentle, purposeful
   ================================= */

/* Fade in on load */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Gentle pulse for symbols */
@keyframes gentlePulse {
    0%, 100% {
        opacity: 0.8;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}

/* Glow effect */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(167, 139, 204, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(167, 139, 204, 0.6);
    }
}

/* Slide in from side */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Expand from center */
@keyframes expandFromCenter {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Shimmer effect for text */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* Floating effect */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Rotate gently */
@keyframes gentleRotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* =================================
   SCROLL-TRIGGERED ANIMATIONS
   ================================= */

.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

/* Stagger children animations */
.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 > * {
    opacity: 1;
    transform: translateY(0);
}

/* =================================
   BUTTON ANIMATIONS
   ================================= */

.continue-btn {
    position: relative;
    overflow: hidden;
}

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

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

/* =================================
   EXPANDABLE SECTION ANIMATIONS
   ================================= */

.expandable-content {
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease,
                padding 0.3s ease;
}

.expandable-section:not(.expanded) .expandable-content {
    opacity: 0;
    padding: 0 var(--space-md);
}

.expandable-section.expanded .expandable-content {
    opacity: 1;
    padding: var(--space-md);
}

/* =================================
   PHASE TRANSITION ANIMATIONS
   ================================= */

.story-section {
    animation: fadeInUp 0.8s ease forwards;
}

.story-section.exiting {
    animation: fadeOutDown 0.6s ease forwards;
}

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

/* =================================
   INSIGHT NODE ANIMATIONS
   ================================= */

.insight-node {
    animation: float 6s ease-in-out infinite;
}

.insight-node:nth-child(2n) {
    animation-delay: 0.5s;
}

.insight-node:nth-child(3n) {
    animation-delay: 1s;
}

.insight-node.central {
    animation: gentlePulse 4s ease-in-out infinite, glow 3s ease-in-out infinite;
}

/* =================================
   TEXT ANIMATIONS
   ================================= */

.title {
    background-size: 200% auto;
    animation: shimmer 8s linear infinite;
}

/* Typewriter effect (optional - can be toggled via JS) */
@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

.typewriter-text {
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid var(--accent-lavender);
    animation: typewriter 2s steps(40) 1s forwards,
               blink 0.75s step-end infinite;
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

/* =================================
   LOADING SPINNER
   ================================= */

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-subtle);
    border-top-color: var(--accent-lavender);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* =================================
   PARALLAX EFFECT (Subtle)
   ================================= */

.parallax-slow {
    transform: translateY(calc(var(--scroll-position) * -0.1));
    transition: transform 0.1s ease-out;
}

.parallax-medium {
    transform: translateY(calc(var(--scroll-position) * -0.3));
    transition: transform 0.1s ease-out;
}

.parallax-fast {
    transform: translateY(calc(var(--scroll-position) * -0.5));
    transition: transform 0.1s ease-out;
}

/* =================================
   HOVER LIFT EFFECT
   ================================= */

.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

/* =================================
   PROGRESS BAR ANIMATION
   ================================= */

.progress-bar {
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-lavender), var(--accent-sage));
    transition: width 0.3s ease;
}

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

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .parallax-slow,
    .parallax-medium,
    .parallax-fast {
        transform: none;
    }
}

/* =================================
   FOCUS ANIMATIONS
   ================================= */

*:focus-visible {
    animation: focusPulse 0.6s ease;
}

@keyframes focusPulse {
    0%, 100% {
        outline-offset: 4px;
    }
    50% {
        outline-offset: 8px;
    }
}
