/* ════════════════════════════════════════════
   ANIMATIONS — Japanese minimalist motion
════════════════════════════════════════════ */

/* ── SCROLL-TRIGGERED ── */
.anim-fade-up {
    opacity: 0;
    transform: translateY(22px);
    transition:
        opacity 0.55s var(--ease-out) var(--d, 0s),
        transform 0.55s var(--ease-out) var(--d, 0s);
}

.anim-fade-left {
    opacity: 0;
    transform: translateX(-24px);
    transition:
        opacity 0.55s var(--ease-out) var(--d, 0s),
        transform 0.55s var(--ease-out) var(--d, 0s);
}

.anim-fade-right {
    opacity: 0;
    transform: translateX(24px);
    transition:
        opacity 0.55s var(--ease-out) var(--d, 0s),
        transform 0.55s var(--ease-out) var(--d, 0s);
}

.anim-fade-up.is-visible,
.anim-fade-left.is-visible,
.anim-fade-right.is-visible {
    opacity: 1;
    transform: translate(0, 0);
}

/* ── HERO ENTRANCE (CSS-only, no JS needed) ─ */
@keyframes heroFadeUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-badge {
    animation: heroFadeUp 0.5s var(--ease-out) 0.1s both;
}

.hero-title {
    animation: heroFadeUp 0.5s var(--ease-out) 0.2s both;
}

.hero-desc {
    animation: heroFadeUp 0.5s var(--ease-out) 0.3s both;
}

.hero-buttons {
    animation: heroFadeUp 0.5s var(--ease-out) 0.4s both;
}

.hero-stats {
    animation: heroFadeUp 0.5s var(--ease-out) 0.5s both;
}

/* ── CARD STAGGER (JS adds .is-visible class) ── */
@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.stagger-child {
    opacity: 0;
    animation: none;
}

.stagger-child.is-visible {
    animation: cardIn 0.4s var(--ease-out) var(--anim-delay, 0ms) forwards;
}

/* delay utilities */
.d-0 {
    --anim-delay: 0ms;
}

.d-50 {
    --anim-delay: 50ms;
}

.d-100 {
    --anim-delay: 100ms;
}

.d-150 {
    --anim-delay: 150ms;
}

.d-200 {
    --anim-delay: 200ms;
}

.d-250 {
    --anim-delay: 250ms;
}

.d-300 {
    --anim-delay: 300ms;
}

.d-350 {
    --anim-delay: 350ms;
}

.d-400 {
    --anim-delay: 400ms;
}

.d-450 {
    --anim-delay: 450ms;
}

/* ── TOAST ───────────────────────────────── */
@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(110%) scale(0.92);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
        max-height: 120px;
        margin-bottom: 0;
        padding-block: 12px;
    }

    to {
        opacity: 0;
        transform: translateX(60px) scale(0.94);
        max-height: 0;
        margin-bottom: -8px;
        padding-block: 0;
    }
}

@keyframes toastProgress {
    from {
        width: 100%;
    }

    to {
        width: 0%;
    }
}

/* ── MODAL ───────────────────────────────── */
/* Handled via .is-open in components.css */

/* ── WORKSPACE REVEAL ────────────────────── */
@keyframes workspaceIn {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.workspace-reveal {
    animation: workspaceIn 0.45s var(--ease-out) forwards;
}

/* ── SPINNER ─────────────────────────────── */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--c-border);
    border-top-color: var(--c-accent);
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
}

/* ── PAIN BAR GROW ───────────────────────── */
@keyframes barGrow {
    from {
        transform: scaleX(0);
    }

    to {
        transform: scaleX(1);
    }
}

.pb-fill {
    transform-origin: left;
}

.pb-fill.animate {
    animation: barGrow 0.9s var(--ease-out) 0.2s both;
}

/* ── PIN PULSE ───────────────────────────── */
@keyframes pinPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(91, 79, 233, .5);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(91, 79, 233, .0);
    }
}

/* ── STAT NUMBER BUMP ────────────────────── */
@keyframes statBump {
    0% {
        transform: scale(1);
    }

    40% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

.stat-bump {
    animation: statBump 0.4s var(--ease-bounce) forwards;
}

/* ── SUCCESS FLASH ───────────────────────── */
@keyframes flashSuccess {
    0% {
        background: var(--c-surface);
    }

    35% {
        background: var(--c-success-bg);
    }

    100% {
        background: var(--c-surface);
    }
}

.flash-success {
    animation: flashSuccess 0.65s var(--ease) forwards;
}

/* ── SHAKE ERROR ─────────────────────────── */
@keyframes shakeErr {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-5px);
    }

    40%,
    80% {
        transform: translateX(5px);
    }
}

.shake-err {
    animation: shakeErr 0.38s var(--ease) forwards;
}

/* ── LIVE CLOCK SUBTLE PULSE ─────────────── */
@keyframes clockBeat {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.72;
    }
}

[data-clock] {
    animation: clockBeat 2s ease-in-out infinite;
}

/* ── FLOAT (privacy icon on about) ──────── */
@keyframes floatIcon {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-7px);
    }
}

/* ── GRADIENT BORDER SHIMMER ─────────────── */
@keyframes shimmer {
    0% {
        background-position: -200% center;
    }

    100% {
        background-position: 200% center;
    }
}

.shimmer-border {
    background:
        linear-gradient(90deg,
            var(--c-border) 25%,
            rgba(91, 79, 233, .4) 50%,
            var(--c-border) 75%) border-box;
    background-size: 200% 100%;
    animation: shimmer 2s linear infinite;
}

/* ── REDUCED MOTION ──────────────────────── */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .anim-fade-up,
    .anim-fade-left,
    .anim-fade-right {
        opacity: 1;
        transform: none;
    }
}