/*
 * Portal motion layer — shared animation vocabulary.
 * Everything here is decoration: pages must read fine with it disabled,
 * and prefers-reduced-motion turns all of it off at the bottom of this file.
 */

/* ── Live pulse (live dots, running badges) ──────────────────────── */
@keyframes portal-pulse {
    0%   { box-shadow: 0 0 0 0 var(--portal-c-accent-muted); }
    70%  { box-shadow: 0 0 0 6px rgba(0, 0, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); }
}

.portal-live-dot {
    animation: portal-pulse 2s ease-out infinite;
}

/* ── Entrances ───────────────────────────────────────────────────── */
@keyframes portal-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes portal-rise-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.portal-fade-in {
    animation: portal-fade-in 0.25s ease-out both;
}

.portal-rise-in {
    animation: portal-rise-in 0.3s ease-out both;
}

/* Stagger helper: apply portal-rise-in to children of a .portal-stagger list */
.portal-stagger > * {
    animation: portal-rise-in 0.3s ease-out both;
}

.portal-stagger > *:nth-child(2)  { animation-delay: 0.04s; }
.portal-stagger > *:nth-child(3)  { animation-delay: 0.08s; }
.portal-stagger > *:nth-child(4)  { animation-delay: 0.12s; }
.portal-stagger > *:nth-child(5)  { animation-delay: 0.16s; }
.portal-stagger > *:nth-child(6)  { animation-delay: 0.2s; }
.portal-stagger > *:nth-child(n+7) { animation-delay: 0.24s; }

/* ── Live-update flash (JS adds the class, animationend removes it) ─ */
@keyframes portal-flash {
    0%   { background-color: var(--portal-c-accent-muted); }
    100% { background-color: transparent; }
}

.portal-flash {
    animation: portal-flash 0.9s ease-out both;
    border-radius: var(--bs-border-radius, 0.375rem);
}

/* ── Hover lift for interactive cards ────────────────────────────── */
.portal-stat-card,
.portal-accent-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

a.portal-stat-card:hover,
.portal-stat-card.portal-hoverable:hover {
    transform: translateY(-2px);
    border-color: var(--portal-c-accent-border);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.28), 0 0 24px var(--portal-aurora-magenta);
}

/* ── Reduced motion: everything above is optional ────────────────── */
@media (prefers-reduced-motion: reduce) {
    .portal-live-dot,
    .portal-fade-in,
    .portal-rise-in,
    .portal-stagger > *,
    .portal-flash {
        animation: none;
    }

    .portal-stat-card,
    .portal-accent-card {
        transition: none;
    }

    a.portal-stat-card:hover,
    .portal-stat-card.portal-hoverable:hover {
        transform: none;
    }
}
