/* ============================================
   CUORE DI LUNA - Animations
   ============================================ */

/* ==================== KEYFRAMES ==================== */

/* Scroll Bounce Animation */
@keyframes scrollBounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    40% {
        transform: translateX(-50%) translateY(10px);
    }
    60% {
        transform: translateX(-50%) translateY(5px);
    }
}

/* Fade In */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Fade In Down */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Left */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade In Right */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale In */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

/* Pulse */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Glow Pulse */
@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 10px rgba(212, 165, 116, 0.3);
    }
    50% {
        box-shadow: 0 0 25px rgba(212, 165, 116, 0.6);
    }
}

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

/* Shimmer */
@keyframes shimmer {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

/* Particle Float */
@keyframes particleFloat {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Typing Cursor */
@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

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

/* Hero Content Animation */
.hero-content {
    animation: fadeInUp 1s ease 0.2s both;
}

.hero-title .title-line:first-child {
    animation: fadeInDown 0.8s ease 0.4s both;
}

.hero-title .title-line.accent {
    animation: fadeInUp 0.8s ease 0.6s both;
}

.hero-subtitle {
    animation: fadeIn 0.8s ease 0.8s both;
}

.hero-description {
    animation: fadeIn 0.8s ease 1s both;
}

.hero-cta {
    animation: fadeInUp 0.8s ease 1.2s both;
}

.scroll-indicator {
    animation: fadeIn 1s ease 1.5s both;
}

/* Hero Particles */
.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--accent-gold);
    border-radius: 50%;
    opacity: 0;
    animation: particleFloat linear infinite;
}

.particle:nth-child(1) { left: 10%; animation-duration: 15s; animation-delay: 0s; }
.particle:nth-child(2) { left: 20%; animation-duration: 18s; animation-delay: 2s; }
.particle:nth-child(3) { left: 30%; animation-duration: 12s; animation-delay: 4s; }
.particle:nth-child(4) { left: 40%; animation-duration: 20s; animation-delay: 1s; }
.particle:nth-child(5) { left: 50%; animation-duration: 16s; animation-delay: 3s; }
.particle:nth-child(6) { left: 60%; animation-duration: 14s; animation-delay: 5s; }
.particle:nth-child(7) { left: 70%; animation-duration: 19s; animation-delay: 2s; }
.particle:nth-child(8) { left: 80%; animation-duration: 13s; animation-delay: 4s; }
.particle:nth-child(9) { left: 90%; animation-duration: 17s; animation-delay: 1s; }
.particle:nth-child(10) { left: 15%; animation-duration: 21s; animation-delay: 3s; }
.particle:nth-child(11) { left: 25%; animation-duration: 11s; animation-delay: 5s; }
.particle:nth-child(12) { left: 35%; animation-duration: 22s; animation-delay: 0s; }
.particle:nth-child(13) { left: 45%; animation-duration: 14s; animation-delay: 2s; }
.particle:nth-child(14) { left: 55%; animation-duration: 18s; animation-delay: 4s; }
.particle:nth-child(15) { left: 65%; animation-duration: 15s; animation-delay: 1s; }
.particle:nth-child(16) { left: 75%; animation-duration: 20s; animation-delay: 3s; }
.particle:nth-child(17) { left: 85%; animation-duration: 12s; animation-delay: 5s; }
.particle:nth-child(18) { left: 95%; animation-duration: 16s; animation-delay: 2s; }
.particle:nth-child(19) { left: 5%; animation-duration: 19s; animation-delay: 4s; }
.particle:nth-child(20) { left: 50%; animation-duration: 13s; animation-delay: 0s; }

/* ==================== SCROLL ANIMATIONS ==================== */

/* Elements with data-animate attribute */
[data-animate] {
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

[data-animate="fade-up"] {
    transform: translateY(40px);
}

[data-animate="fade-down"] {
    transform: translateY(-40px);
}

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

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

[data-animate="scale"] {
    transform: scale(0.9);
}

[data-animate="fade"] {
    /* Just opacity */
}

/* Animated state */
[data-animate].animated {
    opacity: 1;
    transform: translateY(0) translateX(0) scale(1);
}

/* Staggered animations for grid items */
.pietre-grid [data-animate].animated:nth-child(1) { transition-delay: 0.1s; }
.pietre-grid [data-animate].animated:nth-child(2) { transition-delay: 0.15s; }
.pietre-grid [data-animate].animated:nth-child(3) { transition-delay: 0.2s; }
.pietre-grid [data-animate].animated:nth-child(4) { transition-delay: 0.25s; }
.pietre-grid [data-animate].animated:nth-child(5) { transition-delay: 0.3s; }
.pietre-grid [data-animate].animated:nth-child(6) { transition-delay: 0.35s; }

/* ==================== CHAKRA CAROUSEL ANIMATIONS ==================== */

.chakra-circle {
    animation: glowPulse 3s ease-in-out infinite;
    animation-play-state: paused;
}

.chakra-item.active .chakra-circle {
    animation-play-state: running;
}

.chakra-item .lotus-svg {
    transition: transform 0.3s ease;
}

.chakra-item:hover .lotus-svg {
    transform: scale(1.1);
}

.chakra-detail {
    animation: fadeInUp 0.5s ease;
}

/* ==================== CARD ANIMATIONS ==================== */

/* Pietra Card */
.pietra-card {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

.pietra-card:nth-child(1) { animation-delay: 0.1s; }
.pietra-card:nth-child(2) { animation-delay: 0.15s; }
.pietra-card:nth-child(3) { animation-delay: 0.2s; }
.pietra-card:nth-child(4) { animation-delay: 0.25s; }
.pietra-card:nth-child(5) { animation-delay: 0.3s; }
.pietra-card:nth-child(6) { animation-delay: 0.35s; }
.pietra-card:nth-child(7) { animation-delay: 0.4s; }
.pietra-card:nth-child(8) { animation-delay: 0.45s; }
.pietra-card:nth-child(9) { animation-delay: 0.5s; }
.pietra-card:nth-child(10) { animation-delay: 0.55s; }
.pietra-card:nth-child(11) { animation-delay: 0.6s; }
.pietra-card:nth-child(12) { animation-delay: 0.65s; }
.pietra-card:nth-child(13) { animation-delay: 0.7s; }
.pietra-card:nth-child(14) { animation-delay: 0.75s; }
.pietra-card:nth-child(15) { animation-delay: 0.8s; }
.pietra-card:nth-child(16) { animation-delay: 0.85s; }
.pietra-card:nth-child(17) { animation-delay: 0.9s; }
.pietra-card:nth-child(18) { animation-delay: 0.95s; }

/* Card Hover Effects */
.pietra-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(212, 165, 116, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    border-radius: var(--radius-lg);
}

.pietra-card:hover::before {
    opacity: 1;
}

/* Collezione Card */
.collezione-card {
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.collezione-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 48px rgba(45, 41, 38, 0.15);
}

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

/* CTA Buttons */
.hero-cta,
.quiz-btn.primary,
.form-submit,
.collezione-btn {
    position: relative;
    overflow: hidden;
}

.hero-cta::before,
.quiz-btn.primary::before,
.form-submit::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;
}

.hero-cta:hover::before,
.quiz-btn.primary:hover::before,
.form-submit:hover::before {
    left: 100%;
}

/* Filter Button Active */
.filter-btn {
    transition: all 0.3s ease, transform 0.2s ease;
}

.filter-btn:active {
    transform: scale(0.95);
}

/* ==================== NAV ANIMATIONS ==================== */

/* Mobile Nav Toggle */
.nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* ==================== MODAL ANIMATIONS ==================== */

.modal {
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-content {
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.modal.active .modal-content {
    animation: scaleIn 0.4s ease;
}

/* ==================== LOADING ANIMATIONS ==================== */

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-accent) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* ==================== QUIZ ANIMATIONS ==================== */

.quiz-start {
    animation: fadeIn 0.5s ease;
}

.quiz-illustration .crystal-svg {
    animation: float 4s ease-in-out infinite;
}

.question {
    animation: fadeInUp 0.4s ease;
}

.option-btn {
    transition: all 0.3s ease, transform 0.2s ease;
}

.option-btn:active {
    transform: scale(0.98);
}

.result-card {
    animation: scaleIn 0.5s ease;
}

.result-chakra {
    animation: scaleIn 0.4s ease backwards;
}

.result-chakra:nth-child(1) { animation-delay: 0.1s; }
.result-chakra:nth-child(2) { animation-delay: 0.2s; }
.result-chakra:nth-child(3) { animation-delay: 0.3s; }

/* ==================== FORM ANIMATIONS ==================== */

.form-group input,
.form-group select,
.form-group textarea {
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 165, 116, 0.15);
}

/* Success Animation */
@keyframes successPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(125, 184, 125, 0.4);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(125, 184, 125, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(125, 184, 125, 0);
    }
}

.form-success {
    animation: successPulse 1s ease;
}

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

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-gold), var(--accent-rose));
    z-index: 1001;
    transform-origin: left;
    transform: scaleX(0);
    transition: transform 0.1s linear;
}

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

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

    .scroll-behavior {
        scroll-behavior: auto;
    }

    [data-animate] {
        opacity: 1;
        transform: none;
    }

    .particle {
        display: none;
    }
}
