/* ============================================================
   ZUPI SCROLLSTORY — delivery-tick scroll chip + stats odometer
   Namespace: zps-   |   Revert: remove this file + zupi-scrollstory.js
   Theme: light / brand teal #0F2E2B — DO NOT recolor
   ============================================================ */

/* ── 1. PAGE SCROLL PROGRESS BAR (transform-only, rAF-driven) ── */
#zps-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: #0F2E2B;
    transform: scaleX(0);
    transform-origin: 0 50%;
    z-index: 100000;
    pointer-events: none;
    will-change: transform;
}

/* ── 2. DELIVERY-TICK CHIP (fixed bottom-left, desktop only) ── */
#zps-chip {
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 9997; /* just under #zc-toast (9998) */
    pointer-events: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .45s ease, transform .45s cubic-bezier(.22, .9, .3, 1);
}
#zps-chip.zps-on {
    opacity: 1;
    transform: none;
}
/* dodge upward while the social-proof toast (#zc-toast) is visible */
#zps-chip.zps-dodge {
    transform: translateY(-78px);
}

/* compact state: small white pill with WhatsApp ticks */
.zps-chip-mini {
    position: absolute;
    left: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 34px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    box-shadow: 0 6px 20px rgba(15, 23, 42, .10);
    opacity: 1;
    transform: scale(1);
    transform-origin: left bottom;
    transition: opacity .3s ease, transform .3s ease;
}

/* stacked grey/blue tick pairs — pure opacity crossfade */
.zps-ticks {
    position: relative;
    display: inline-block;
    width: 26px;
    height: 14px;
}
.zps-ticks svg {
    position: absolute;
    inset: 0;
    display: block;
}
.zps-ticks-grey { color: #8696a0; opacity: 1; transition: opacity .35s ease; }
.zps-ticks-blue { color: #53BDEB; opacity: 0; transition: opacity .35s ease; }

/* second tick hidden until state 2 */
.zps-tick2 {
    opacity: 0;
    transform: translateX(-4px);
    transform-box: fill-box;
    transition: opacity .3s ease, transform .35s cubic-bezier(.34, 1.56, .64, 1);
}
.zps-chip.zps-s2 .zps-tick2,
.zps-chip.zps-s3 .zps-tick2,
.zps-chip.zps-done .zps-tick2,
.zps-chip-cta .zps-tick2 {
    opacity: 1;
    transform: translateX(0);
}
/* state 3: ticks turn WhatsApp read-blue */
.zps-chip.zps-s3 .zps-ticks-blue,
.zps-chip.zps-done .zps-ticks-blue { opacity: 1; }
.zps-chip.zps-s3 .zps-ticks-grey,
.zps-chip.zps-done .zps-ticks-grey { opacity: 0; }

/* done state: expand to CTA pill (crossfade, no width animation) */
.zps-chip-cta {
    position: absolute;
    left: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    padding: 10px 16px 10px 13px;
    background: #ffffff;
    border: 1px solid rgba(18, 140, 126, .35);
    border-radius: 999px;
    box-shadow: 0 10px 28px rgba(11, 87, 78, .16);
    color: #0a1628;
    font-family: 'Inter', 'Nunito', sans-serif;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    opacity: 0;
    visibility: hidden; /* keeps hidden pill out of tab order */
    transform: translateY(6px) scale(.92);
    transform-origin: left bottom;
    pointer-events: none;
    transition: opacity .3s ease, transform .38s cubic-bezier(.34, 1.4, .64, 1), box-shadow .25s ease, visibility 0s linear .3s;
}
.zps-chip-cta .zps-ticks-blue { position: static; opacity: 1; }
.zps-chip-cta b { color: #0F2E2B; font-weight: 800; }
.zps-chip-cta:hover {
    color: #0F2E2B;
    box-shadow: 0 12px 32px rgba(11, 87, 78, .24);
    text-decoration: none;
}
.zps-chip.zps-done .zps-chip-mini {
    opacity: 0;
    transform: scale(.85);
}
.zps-chip.zps-done .zps-chip-cta {
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
    transition: opacity .3s ease, transform .38s cubic-bezier(.34, 1.4, .64, 1), box-shadow .25s ease, visibility 0s;
}

@media (max-width: 575px) {
    #zps-chip { display: none; }
}

/* ── 3. STATS ODOMETER (replaces .zc-counter count-up) ── */
.zps-odo {
    position: relative;
    display: inline-block;
    font-variant-numeric: tabular-nums;
}
/* invisible sizer keeps exact width/height + baseline — zero CLS */
.zps-odo-ghost { visibility: hidden; }
.zps-odo-live {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: stretch;
    justify-content: center;
    pointer-events: none;
    overflow: hidden;
}
.zps-odo-cell {
    position: relative;
    overflow: hidden;
}
.zps-odo-strip {
    display: block;
    transform: translateY(0);
    will-change: transform;
    /* signature ease with slight overshoot settle */
    transition: transform 1.4s cubic-bezier(.2, .85, .3, 1.14);
}
.zps-odo-n,
.zps-odo-char,
.zps-odo-suffix {
    display: flex;
    align-items: center;
    justify-content: center;
}
/* suffix (+ % M+ /5) pops in last with a scale bounce */
.zps-odo-suffix {
    opacity: 0;
    transform: scale(.4);
    transform-origin: 30% 60%;
    transition: opacity .22s ease, transform .5s cubic-bezier(.34, 1.56, .64, 1);
}
.zps-odo-suffix.zps-in {
    opacity: 1;
    transform: scale(1);
}
/* finishing pulse of the whole stat */
.zps-odo.zps-pulse {
    animation: zpsPulse .55s cubic-bezier(.34, 1.56, .64, 1) both;
}
@keyframes zpsPulse {
    0%   { transform: scale(1); }
    45%  { transform: scale(1.04); }
    100% { transform: scale(1); }
}

/* ── 4. REDUCED MOTION: instant-show, no motion ── */
@media (prefers-reduced-motion: reduce) {
    #zps-chip,
    .zps-chip-mini,
    .zps-chip-cta,
    .zps-ticks-grey,
    .zps-ticks-blue,
    .zps-tick2,
    .zps-odo-strip,
    .zps-odo-suffix {
        transition: none !important;
    }
    .zps-odo.zps-pulse { animation: none !important; }
    #zps-chip { opacity: 1; transform: none; }
}
