/* @author PeepConnect [Abel Odorico] - 2026-04-03 */
/* ============================================================
   PeepStreaming — Animations CSS
   Keyframes, transitions, and animation utility classes
   ============================================================ */

/* ── Glitch Effect ── */
@keyframes ps-glitch {
    0%, 100% { clip-path: inset(0 0 0 0); transform: translate(0); }
    5% { clip-path: inset(40% 0 20% 0); transform: translate(-4px, 2px); }
    10% { clip-path: inset(20% 0 60% 0); transform: translate(3px, -1px); }
    15% { clip-path: inset(80% 0 5% 0); transform: translate(-2px, 3px); }
    20% { clip-path: inset(10% 0 70% 0); transform: translate(5px, -2px); }
    25% { clip-path: inset(0 0 0 0); transform: translate(0); }
}

.ps-glitch {
    position: relative;
}

.ps-glitch::before,
.ps-glitch::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
}

.ps-glitch::before {
    color: var(--ps-primary);
    animation: ps-glitch 3s infinite linear alternate-reverse;
    clip-path: inset(0 0 60% 0);
}

.ps-glitch::after {
    color: var(--ps-secondary);
    animation: ps-glitch 2s infinite linear alternate-reverse;
    animation-delay: -1s;
    clip-path: inset(60% 0 0 0);
}

/* ── Float Animation ── */
@keyframes ps-float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    33% { transform: translateY(-10px) rotate(1deg); }
    66% { transform: translateY(-5px) rotate(-1deg); }
}

.ps-float {
    animation: ps-float 6s ease-in-out infinite;
    will-change: transform;
}

/* ── Pulse ── */
@keyframes ps-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.05); }
}

.ps-pulse {
    animation: ps-pulse 2s ease-in-out infinite;
    will-change: transform, opacity;
}

/* ── Fade In Up ── */
@keyframes ps-fade-in-up {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.ps-fade-in-up {
    opacity: 0;
    animation: ps-fade-in-up 0.6s var(--ps-ease-out) forwards;
    will-change: transform, opacity;
}

/* ── Fade In ── */
@keyframes ps-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* ── Slide In Right ── */
@keyframes ps-slide-in-right {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ── Bounce Scroll Indicator ── */
@keyframes ps-bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-12px); }
    60% { transform: translateY(-6px); }
}

.ps-bounce {
    animation: ps-bounce 2s infinite;
}

/* ── Ticker Scroll ── */
@keyframes ps-ticker {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ── Shimmer / Skeleton Loading ── */
@keyframes ps-shimmer-bg {
    0% { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

.ps-skeleton {
    background: linear-gradient(90deg, var(--ps-bg-card) 25%, var(--ps-bg-card-hover) 50%, var(--ps-bg-card) 75%);
    background-size: 400px 100%;
    animation: ps-shimmer-bg 1.5s infinite linear;
    border-radius: var(--ps-radius-md);
}

/* ── Counter Up (via IntersectionObserver in JS) ── */
.ps-counter-up {
    transition: none;
}

/* ── Staggered Reveal ── */
.ps-reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s var(--ps-ease-out), transform 0.6s var(--ps-ease-out);
    will-change: transform, opacity;
}

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

.ps-reveal[data-delay="100"] { transition-delay: 0.1s; }
.ps-reveal[data-delay="200"] { transition-delay: 0.2s; }
.ps-reveal[data-delay="300"] { transition-delay: 0.3s; }
.ps-reveal[data-delay="400"] { transition-delay: 0.4s; }
.ps-reveal[data-delay="500"] { transition-delay: 0.5s; }
.ps-reveal[data-delay="600"] { transition-delay: 0.6s; }
.ps-reveal[data-delay="700"] { transition-delay: 0.7s; }
.ps-reveal[data-delay="800"] { transition-delay: 0.8s; }

/* ── Flip Animation (countdown) ── */
@keyframes ps-flip-top {
    from { transform: rotateX(0deg); }
    to { transform: rotateX(-90deg); }
}

@keyframes ps-flip-bottom {
    from { transform: rotateX(90deg); }
    to { transform: rotateX(0deg); }
}

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

    .ps-reveal {
        opacity: 1;
        transform: none;
    }

    .ps-float,
    .ps-pulse,
    .ps-glitch::before,
    .ps-glitch::after {
        animation: none;
    }
}
