/* ============================================
   PublicPages - Animations
   ============================================
   Global animation keyframes and utilities
   ============================================ */

/* ============================================
   KEYFRAMES
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

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

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

@keyframes bounceIn {
    0% { 
        opacity: 0; 
        transform: scale(0.3); 
    }
    50% { 
        transform: scale(1.05); 
    }
    70% { 
        transform: scale(0.9); 
    }
    100% { 
        opacity: 1; 
        transform: scale(1); 
    }
}

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

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

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

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

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

@keyframes glow {
    0%, 100% { 
        box-shadow: 0 0 20px var(--color-primary-light);
    }
    50% { 
        box-shadow: 0 0 40px var(--color-primary-light);
    }
}

@keyframes grid-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

@keyframes pulse-glow {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.1); }
}

/* ============================================
   ANIMATION CLASSES
   ============================================ */
.pp-animate {
    animation-name: fadeInUp;
    animation-fill-mode: both;
    animation-duration: 0.6s;
    animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

/* For scroll-triggered animations (add .in-view via JS) */
.pp-animate-on-scroll {
    opacity: 0;
    animation-fill-mode: both;
    animation-duration: 0.6s;
    animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

.pp-animate-on-scroll.in-view {
    animation-name: fadeInUp;
}

.pp-animate-fadeIn { animation-name: fadeIn; }
.pp-animate-fadeInUp { animation-name: fadeInUp; }
.pp-animate-fadeInDown { animation-name: fadeInDown; }
.pp-animate-slideInLeft { animation-name: slideInLeft; }
.pp-animate-slideInRight { animation-name: slideInRight; }
.pp-animate-scaleIn { animation-name: scaleIn; }
.pp-animate-bounceIn { animation-name: bounceIn; }

/* Staggered delays for children */
.pp-stagger > *:nth-child(1) { animation-delay: 0.05s; }
.pp-stagger > *:nth-child(2) { animation-delay: 0.1s; }
.pp-stagger > *:nth-child(3) { animation-delay: 0.15s; }
.pp-stagger > *:nth-child(4) { animation-delay: 0.2s; }
.pp-stagger > *:nth-child(5) { animation-delay: 0.25s; }
.pp-stagger > *:nth-child(6) { animation-delay: 0.3s; }
.pp-stagger > *:nth-child(7) { animation-delay: 0.35s; }
.pp-stagger > *:nth-child(8) { animation-delay: 0.4s; }

/* Direct delay classes */
.pp-delay-1 { animation-delay: 0.1s; }
.pp-delay-2 { animation-delay: 0.2s; }
.pp-delay-3 { animation-delay: 0.3s; }
.pp-delay-4 { animation-delay: 0.4s; }
.pp-delay-5 { animation-delay: 0.5s; }

/* Duration modifiers */
.pp-duration-fast { animation-duration: 0.3s; }
.pp-duration-normal { animation-duration: 0.6s; }
.pp-duration-slow { animation-duration: 1s; }

/* Infinite animations */
.pp-pulse { animation: pulse 2s ease-in-out infinite; }
.pp-spin { animation: spin 1s linear infinite; }
.pp-float { animation: float 3s ease-in-out infinite; }
.pp-glow { animation: glow 2s ease-in-out infinite; }

/* ============================================
   HOVER TRANSITIONS
   ============================================ */
.pp-hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.pp-hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.pp-hover-scale {
    transition: transform 0.2s ease;
}
.pp-hover-scale:hover {
    transform: scale(1.05);
}

.pp-hover-glow {
    transition: box-shadow 0.2s ease;
}
.pp-hover-glow:hover {
    box-shadow: 0 0 20px var(--color-primary-light);
}

/* ============================================
   LOADING STATES
   ============================================ */
.pp-skeleton {
    background: linear-gradient(
        90deg,
        var(--color-card) 0%,
        var(--color-card-hover) 50%,
        var(--color-card) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

.pp-skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.pp-skeleton-heading {
    height: 1.5em;
    width: 60%;
    margin-bottom: 0.75em;
}

.pp-skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .pp-animate,
    .pp-pulse,
    .pp-spin,
    .pp-float,
    .pp-glow,
    .pp-skeleton {
        animation: none;
        opacity: 1;
        transform: none;
    }
    
    .pp-hover-lift:hover,
    .pp-hover-scale:hover {
        transform: none;
    }
    
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
