/* =====================================================
   ANTIGRAVITY ANIMATIONS
   Floating origami elements, paper particles, and
   playful background animations for children
   ===================================================== */

/* ---- Antigravity Canvas (Background Particles) ---- */
.antigravity-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* ---- Floating Paper Elements ---- */
.antigravity-element {
    position: absolute;
    pointer-events: none;
    will-change: transform;
    z-index: 0;
}

/* Paper Crane */
.ag-crane {
    font-size: 2rem;
    opacity: 0.4;
    animation: antigravityFloat var(--ag-duration, 15s) var(--ag-delay, 0s) infinite ease-in-out;
}

/* Paper Star */
.ag-star {
    width: var(--ag-size, 12px);
    height: var(--ag-size, 12px);
    opacity: 0.35;
    animation: antigravityStar var(--ag-duration, 12s) var(--ag-delay, 0s) infinite ease-in-out;
}

.ag-star::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--ag-color, #FFD93D);
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

/* Paper Diamond */
.ag-diamond {
    width: var(--ag-size, 16px);
    height: var(--ag-size, 16px);
    opacity: 0.3;
    animation: antigravityDiamond var(--ag-duration, 18s) var(--ag-delay, 0s) infinite ease-in-out;
}

.ag-diamond::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--ag-color, #FF6B9D);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

/* Heart */
.ag-heart {
    font-size: 1.2rem;
    opacity: 0.3;
    animation: antigravityHeart var(--ag-duration, 20s) var(--ag-delay, 0s) infinite ease-in-out;
}

/* Paper Circle */
.ag-circle {
    width: var(--ag-size, 10px);
    height: var(--ag-size, 10px);
    border-radius: 50%;
    background: var(--ag-color, #4FC3F7);
    opacity: 0.25;
    animation: antigravityCircle var(--ag-duration, 16s) var(--ag-delay, 0s) infinite ease-in-out;
}

/* Paper Triangle (Origami fold) */
.ag-triangle {
    width: 0;
    height: 0;
    border-left: var(--ag-half-size, 8px) solid transparent;
    border-right: var(--ag-half-size, 8px) solid transparent;
    border-bottom: var(--ag-size, 16px) solid var(--ag-color, #6BCB77);
    opacity: 0.3;
    animation: antigravityTriangle var(--ag-duration, 14s) var(--ag-delay, 0s) infinite ease-in-out;
}

/* ---- Antigravity Keyframes ---- */

/* Main float - objects defy gravity, drifting upward */
@keyframes antigravityFloat {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    10% {
        transform: translate(15px, -40px) rotate(20deg) scale(1.05);
    }
    20% {
        transform: translate(-10px, -90px) rotate(-10deg) scale(0.95);
    }
    30% {
        transform: translate(25px, -150px) rotate(35deg) scale(1.1);
    }
    40% {
        transform: translate(-20px, -200px) rotate(-20deg) scale(1);
    }
    50% {
        transform: translate(10px, -260px) rotate(15deg) scale(1.05);
    }
    60% {
        transform: translate(-15px, -310px) rotate(-30deg) scale(0.95);
    }
    70% {
        transform: translate(20px, -350px) rotate(25deg) scale(1);
    }
    80% {
        transform: translate(-5px, -380px) rotate(-15deg) scale(1.05);
    }
    90% {
        transform: translate(10px, -400px) rotate(10deg) scale(0.9);
        opacity: 0.4;
    }
    100% {
        transform: translate(0, -420px) rotate(0deg) scale(0.8);
        opacity: 0;
    }
}

@keyframes antigravityStar {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    25% {
        transform: translate(20px, -100px) rotate(90deg) scale(1.2);
    }
    50% {
        transform: translate(-15px, -220px) rotate(180deg) scale(0.9);
    }
    75% {
        transform: translate(25px, -340px) rotate(270deg) scale(1.1);
    }
    100% {
        transform: translate(0, -450px) rotate(360deg) scale(0.7);
        opacity: 0;
    }
}

@keyframes antigravityDiamond {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    20% {
        transform: translate(-20px, -80px) rotate(45deg) scale(1.15);
    }
    40% {
        transform: translate(15px, -180px) rotate(90deg) scale(0.9);
    }
    60% {
        transform: translate(-25px, -280px) rotate(135deg) scale(1.1);
    }
    80% {
        transform: translate(10px, -370px) rotate(180deg) scale(0.85);
    }
    100% {
        transform: translate(0, -440px) rotate(225deg) scale(0.6);
        opacity: 0;
    }
}

@keyframes antigravityHeart {
    0% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(30px, -120px) scale(1.3);
    }
    50% {
        transform: translate(-20px, -250px) scale(0.8);
    }
    75% {
        transform: translate(15px, -370px) scale(1.1);
    }
    100% {
        transform: translate(0, -480px) scale(0.5);
        opacity: 0;
    }
}

@keyframes antigravityCircle {
    0% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(25px, -150px) scale(1.3);
    }
    66% {
        transform: translate(-20px, -300px) scale(0.8);
    }
    100% {
        transform: translate(0, -450px) scale(0.5);
        opacity: 0;
    }
}

@keyframes antigravityTriangle {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    25% {
        transform: translate(-15px, -110px) rotate(60deg) scale(1.2);
    }
    50% {
        transform: translate(20px, -230px) rotate(120deg) scale(0.85);
    }
    75% {
        transform: translate(-10px, -350px) rotate(180deg) scale(1.05);
    }
    100% {
        transform: translate(0, -460px) rotate(240deg) scale(0.6);
        opacity: 0;
    }
}

/* ---- Gentle Sway (for stationary decorations) ---- */
@keyframes gentleSway {
    0%, 100% {
        transform: translateX(0) rotate(0deg);
    }
    25% {
        transform: translateX(5px) rotate(2deg);
    }
    75% {
        transform: translateX(-5px) rotate(-2deg);
    }
}

/* ---- Pulse Glow ---- */
@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 107, 157, 0.2);
    }
    50% {
        box-shadow: 0 0 40px rgba(255, 107, 157, 0.4);
    }
}

/* ---- Sparkle Effect ---- */
@keyframes sparkle {
    0%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* ---- Rainbow Shift for Borders ---- */
@keyframes rainbowBorder {
    0% { border-color: #FF6B9D; }
    16% { border-color: #FFD93D; }
    33% { border-color: #6BCB77; }
    50% { border-color: #4FC3F7; }
    66% { border-color: #7C5CFC; }
    83% { border-color: #FF8A5C; }
    100% { border-color: #FF6B9D; }
}

/* ---- Card Stagger Animation ---- */
.posts-grid .post-card:nth-child(1) { animation-delay: 0s; }
.posts-grid .post-card:nth-child(2) { animation-delay: 0.05s; }
.posts-grid .post-card:nth-child(3) { animation-delay: 0.1s; }
.posts-grid .post-card:nth-child(4) { animation-delay: 0.15s; }
.posts-grid .post-card:nth-child(5) { animation-delay: 0.2s; }
.posts-grid .post-card:nth-child(6) { animation-delay: 0.25s; }
.posts-grid .post-card:nth-child(7) { animation-delay: 0.3s; }
.posts-grid .post-card:nth-child(8) { animation-delay: 0.35s; }
.posts-grid .post-card:nth-child(9) { animation-delay: 0.4s; }
.posts-grid .post-card:nth-child(10) { animation-delay: 0.45s; }
.posts-grid .post-card:nth-child(11) { animation-delay: 0.5s; }
.posts-grid .post-card:nth-child(12) { animation-delay: 0.55s; }

/* ---- Hero Section Decorative Animations ---- */
.hero-section::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(to top, var(--bg-main), transparent);
    z-index: 1;
    pointer-events: none;
}

/* ---- Category Chip Hover Bounce ---- */
.cat-chip:hover {
    animation: chipBounce 0.4s ease;
}

@keyframes chipBounce {
    0% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
    60% { transform: translateY(-2px); }
    100% { transform: translateY(-2px); }
}

/* ---- YouTube Button Pulse ---- */
.btn-youtube, .btn-youtube-big {
    animation: ytPulse 3s ease-in-out infinite;
}

@keyframes ytPulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(255, 0, 0, 0.3);
    }
    50% {
        box-shadow: 0 4px 30px rgba(255, 0, 0, 0.5);
    }
}

/* ---- Scroll-triggered Reveal ---- */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-on-scroll.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Loading Shimmer for Cards ---- */
.post-card-thumb.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---- Reduce motion for accessibility ---- */
@media (prefers-reduced-motion: reduce) {
    .antigravity-canvas {
        display: none;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .hero-title {
        background-size: 100% 100%;
    }
}
