/* ============================================
   ANIMATIONS — myndfocal News
   Keyframes, transitions, micro-interactions
   ============================================ */

/* ── Card entrance ── */
@keyframes card-in {
    from {
        opacity: 0;
        transform: translateY(14px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes card-in-scale {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ── Fade in ── */
@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Skeleton shimmer ── */
@keyframes lazy-shine {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ── Spinner ── */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Breaking news ── */
@keyframes breaking-scroll {
    0% {
        transform: translateZ(0) translateX(0);
    }

    100% {
        transform: translateZ(0) translateX(-50%);
    }
}

@keyframes breaking-blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

/* ── Pulse glow ── */
@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 0 0 var(--accent-glow);
    }

    50% {
        box-shadow: 0 0 20px 4px var(--accent-glow);
    }
}

/* ── Float ── */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

/* ── Reading progress bar ── */
@keyframes progress-grow {
    from {
        width: 0%;
    }
}

/* ── Utility classes ── */
.animate-fade-in {
    animation: fade-in var(--duration-normal) var(--ease-out);
}

.animate-fade-in-up {
    animation: fade-in-up var(--duration-slow) var(--ease-out);
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite;
}

/* ── Staggered card animations ── */
@media (prefers-reduced-motion: no-preference) {
    .article-card {
        animation: card-in var(--duration-slow) var(--ease-out) backwards;
    }

    .article-card:nth-child(1) {
        animation-delay: 0.02s;
    }

    .article-card:nth-child(2) {
        animation-delay: 0.06s;
    }

    .article-card:nth-child(3) {
        animation-delay: 0.10s;
    }

    .article-card:nth-child(4) {
        animation-delay: 0.14s;
    }

    .article-card:nth-child(5) {
        animation-delay: 0.18s;
    }

    .article-card:nth-child(6) {
        animation-delay: 0.22s;
    }

    .article-card:nth-child(7) {
        animation-delay: 0.26s;
    }

    .article-card:nth-child(8) {
        animation-delay: 0.30s;
    }

    .featured-card {
        animation: card-in-scale 0.5s var(--ease-out);
    }
}

/* ── Respect reduced-motion ── */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Theme transitions (applied after page load) ── */
.theme-ready,
.theme-ready *,
.theme-ready *::before,
.theme-ready *::after {
    transition: var(--theme-transition);
}

/* ── Spinner component ── */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 14px;
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

/* ── Reading progress bar ── */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    z-index: 9999;
    transition: width 0.1s linear;
    box-shadow: 0 0 8px var(--accent-glow);
}