/* AfriBilling — motion layer. Everything here only applies when <html> has .ab-anim
   (added by the head script when motion is allowed, removed after 2.5 s if motion.js never ran).
   Without it every element shows its final, static state. Only transform + opacity are animated. */

/* ---------- reveal on scroll ---------- */
.ab-anim [data-rv] { opacity: 0; transform: translate3d(0, 22px, 0); }
.ab-anim [data-rv="left"] { transform: translate3d(-26px, 0, 0); }
.ab-anim [data-rv="right"] { transform: translate3d(26px, 0, 0); }
.ab-anim [data-rv="zoom"] { transform: scale(.96); }
.ab-anim [data-rv].rv-in { opacity: 1; transform: none; transition: opacity .75s cubic-bezier(.2,.7,.2,1) var(--rv-d, 0ms), transform .85s cubic-bezier(.2,.7,.2,1) var(--rv-d, 0ms); }
.ab-anim [data-rv].rv-done { transition: none; }

/* headline word stagger */
.h-split .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; margin-bottom: -.08em; }
.h-split .w > span { display: inline-block; }
.ab-anim .h-split .w > span { transform: translate3d(0, 105%, 0); opacity: 0; }
.ab-anim .h-split.go .w > span { transform: none; opacity: 1; transition: transform .8s cubic-bezier(.2,.75,.2,1) var(--wd, 0ms), opacity .5s ease var(--wd, 0ms); }

/* ---------- hero: live invoice ---------- */
.inv-card .status .chip { opacity: 0; }
.inv-card .status .chip.paid { opacity: 1; }
.ab-anim .hx .hx-photo { opacity: 0; transform: scale(.97); }
.ab-anim .hx.in .hx-photo { opacity: 1; transform: none; transition: opacity 1s ease .1s, transform 1.4s cubic-bezier(.2,.7,.2,1) .1s; }
.ab-anim .hx .inv-card { opacity: 0; transform: translate3d(0, 26px, 0); }
.ab-anim .hx.in .inv-card { opacity: 1; transform: none; transition: opacity .7s ease .35s, transform .9s cubic-bezier(.2,.7,.2,1) .35s; }
.ab-anim .hx .ic-line, .ab-anim .hx .ic-sum > div, .ab-anim .hx .ic-total, .ab-anim .hx .ic-pay { opacity: 0; transform: translate3d(-10px, 0, 0); transition: opacity .45s ease, transform .55s cubic-bezier(.2,.7,.2,1); }
.ab-anim .hx.s1 .ic-line:nth-child(1),
.ab-anim .hx.s2 .ic-line:nth-child(2),
.ab-anim .hx.s3 .ic-line:nth-child(3),
.ab-anim .hx.s4 .ic-line:nth-child(4),
.ab-anim .hx.s5 .ic-sum > div,
.ab-anim .hx.s5 .ic-total,
.ab-anim .hx.s5 .ic-pay { opacity: 1; transform: none; }
.ab-anim .hx.s5 .ic-sum > div:nth-child(2) { transition-delay: .08s; } .ab-anim .hx.s5 .ic-sum > div:nth-child(3) { transition-delay: .16s; }
.ab-anim .hx.s5 .ic-total { transition-delay: .24s; } .ab-anim .hx.s5 .ic-pay { transition-delay: .4s; }
.ab-anim .inv-card .status .chip { transform: translate3d(0, 6px, 0) scale(.92); transition: opacity .35s ease, transform .45s cubic-bezier(.3,1.4,.4,1); }
.ab-anim .inv-card .status .chip.paid { opacity: 0; }
.ab-anim .hx.s1 .status .chip.draft { opacity: 1; transform: none; }
.ab-anim .hx.s5 .status .chip.draft { opacity: 0; }
.ab-anim .hx.s5 .status .chip.sent { opacity: 1; transform: none; }
.ab-anim .hx.s6 .status .chip.sent { opacity: 0; }
.ab-anim .hx.s6 .status .chip.viewed { opacity: 1; transform: none; }
.ab-anim .hx.s7 .status .chip.viewed { opacity: 0; }
.ab-anim .hx.s7 .status .chip.paid { opacity: 1; transform: none; }
.hx .ic-pay { background: var(--ok); color: #fff; }
[data-theme="dark"] .hx .ic-pay { color: #08210F; }
.ic-pay .p-go { display: none; }
.ic-pay .p-done { display: inline-flex; gap: 8px; align-items: center; }
.ab-anim .hx .ic-pay { background: var(--accent); color: var(--accent-text); transition: background .4s, color .4s; }
.ab-anim .hx .ic-pay .p-go { display: inline-flex; gap: 8px; align-items: center; }
.ab-anim .hx .ic-pay .p-done { display: none; }
.ab-anim .hx.s7 .ic-pay { background: var(--ok); color: #fff; }
.ab-anim[data-theme="dark"] .hx.s7 .ic-pay { color: #08210F; }
.ab-anim .hx.s7 .ic-pay .p-go { display: none; }
.ab-anim .hx.s7 .ic-pay .p-done { display: inline-flex; }
/* cursor click on "Pay now" */
.hx-cursor { display: none; }
.ab-anim .hx-cursor { display: block; position: absolute; z-index: 6; left: 230px; top: 560px; width: 22px; height: 22px; opacity: 0; transform: translate3d(60px, 60px, 0); pointer-events: none; }
.ab-anim .hx-cursor svg { width: 22px; height: 22px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.3)); }
.ab-anim .hx.s6 .hx-cursor { opacity: 1; transform: none; transition: opacity .3s ease, transform 1s cubic-bezier(.3,.8,.3,1); }
.ab-anim .hx.s7 .hx-cursor { opacity: 0; transform: scale(.85); transition: opacity .4s ease .3s, transform .2s; }
/* payment toast */
.ab-anim .hx .pay-toast { opacity: 0; transform: translate3d(0, 14px, 0) scale(.96); }
.ab-anim .hx.s7 .pay-toast { opacity: 1; transform: none; transition: opacity .45s ease .25s, transform .6s cubic-bezier(.3,1.4,.4,1) .25s; }
@media (max-width: 720px) { .ab-anim .hx .pay-toast { transform: translate3d(0, -10px, 0) scale(.96); } .ab-anim .hx.s7 .pay-toast { transform: none; } }
/* floating cards: enter then bob */
.ab-anim .hx .float-card { opacity: 0; }
.ab-anim .hx.in .float-card { animation: fcIn .8s cubic-bezier(.2,.8,.2,1) both, bob 6s ease-in-out infinite; }
.ab-anim .hx.in .fc-reminder { animation-delay: 1.1s, 1.9s; }
.ab-anim .hx.in .fc-recurring { animation-delay: 1.5s, 2.3s; animation-duration: .8s, 7s; }
.ab-anim .hx.in .fc-quote { animation-delay: 1.9s, 2.7s; animation-duration: .8s, 6.5s; }
@keyframes fcIn { from { opacity: 0; transform: translate3d(0, 16px, 0) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes bob { 0%, 100% { transform: translate3d(0, 0, 0); } 50% { transform: translate3d(0, -8px, 0); } }
.ab-anim .hx .hx-ring { animation: spinSlow 40s linear infinite; }
@keyframes spinSlow { to { transform: rotate(360deg); } }
.ab-anim .fc-pulse { animation: pulse 2.2s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.8); opacity: 0; } }
.ab-anim .live-dot { position: relative; }

/* ---------- path draw (how billing works) ---------- */
.flow-path .draw { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; }
.flow-path .dash { stroke: var(--border-strong); }
.ab-anim .flow-path .draw { stroke-dasharray: var(--len, 1200); stroke-dashoffset: var(--len, 1200); }
.ab-anim .flow-path.go .draw { stroke-dashoffset: 0; transition: stroke-dashoffset 2.2s cubic-bezier(.5,.1,.2,1) .2s; }
.flow-path .runner { fill: var(--accent); }
.flow-path .runner { opacity: 0; }
.ab-anim .flow-path.go .runner { opacity: 1; offset-path: var(--path); animation: run 4.8s cubic-bezier(.5,.1,.3,1) 2.4s infinite; }
@keyframes run { 0% { offset-distance: 0%; opacity: 0; } 8% { opacity: 1; } 92% { opacity: 1; } 100% { offset-distance: 100%; opacity: 0; } }
.ab-anim .step .n { transform: scale(.7); opacity: 0; }
.ab-anim .step.rv-in .n { transform: none; opacity: 1; transition: transform .6s cubic-bezier(.3,1.5,.4,1) calc(var(--rv-d, 0ms) + 250ms), opacity .4s ease calc(var(--rv-d, 0ms) + 250ms); }

/* ---------- feature tabs ---------- */
.ab-anim .ftab.on .bar i { animation: tabbar var(--tab-dur, 6s) linear both; }
.ab-anim .ftabs.paused .ftab.on .bar i { animation-play-state: paused; }
@keyframes tabbar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.ab-anim .fpanel.on { animation: panelIn .55s cubic-bezier(.2,.7,.2,1) both; }
.ab-anim .fpanel.on .mu-row, .ab-anim .fpanel.on [data-stag] { animation: rowIn .5s cubic-bezier(.2,.7,.2,1) both; }
.ab-anim .fpanel.on .mu-row:nth-child(2), .ab-anim .fpanel.on [data-stag]:nth-child(2) { animation-delay: .08s; }
.ab-anim .fpanel.on .mu-row:nth-child(3), .ab-anim .fpanel.on [data-stag]:nth-child(3) { animation-delay: .16s; }
.ab-anim .fpanel.on .mu-row:nth-child(4), .ab-anim .fpanel.on [data-stag]:nth-child(4) { animation-delay: .24s; }
.ab-anim .fpanel.on .mu-row:nth-child(5), .ab-anim .fpanel.on [data-stag]:nth-child(5) { animation-delay: .32s; }
.ab-anim .fpanel.on .bar-grow { animation: barGrow .9s cubic-bezier(.2,.7,.2,1) both; transform-origin: bottom; }
.ab-anim .fpanel.on .bar-grow:nth-child(2) { animation-delay: .06s; } .ab-anim .fpanel.on .bar-grow:nth-child(3) { animation-delay: .12s; }
.ab-anim .fpanel.on .bar-grow:nth-child(4) { animation-delay: .18s; } .ab-anim .fpanel.on .bar-grow:nth-child(5) { animation-delay: .24s; } .ab-anim .fpanel.on .bar-grow:nth-child(6) { animation-delay: .3s; }
@keyframes panelIn { from { opacity: 0; transform: translate3d(0, 14px, 0); } to { opacity: 1; transform: none; } }
@keyframes rowIn { from { opacity: 0; transform: translate3d(-10px, 0, 0); } to { opacity: 1; transform: none; } }
@keyframes barGrow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* ---------- marquee ---------- */
.marquee-track { will-change: transform; }
.ab-anim .marquee.run .marquee-track { animation: marq var(--marq, 60s) linear infinite; }
.ab-anim .marquee.run.rev .marquee-track { animation-direction: reverse; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marq { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(calc(-50% - 10px), 0, 0); } }

/* ---------- image reveal ---------- */
.ab-anim [data-rv] .ph img, .ab-anim .trust-photo[data-rv] img { transform: scale(1.06); }
.ab-anim [data-rv].rv-in .ph img, .ab-anim .trust-photo[data-rv].rv-in img { transform: none; transition: transform 1.4s cubic-bezier(.2,.7,.2,1) var(--rv-d, 0ms); }

/* ---------- app: subtle chart draw ---------- */
.ab-anim .chart .line-draw { stroke-dasharray: var(--len, 2000); stroke-dashoffset: var(--len, 2000); }
.ab-anim .chart.go .line-draw { stroke-dashoffset: 0; transition: stroke-dashoffset 1.6s cubic-bezier(.4,.1,.2,1); }
.ab-anim .chart .area-fade { opacity: 0; }
.ab-anim .chart.go .area-fade { opacity: 1; transition: opacity 1s ease .6s; }
.ab-anim .chart .bar-up { transform: scaleY(0); transform-box: fill-box; transform-origin: bottom; }
.ab-anim .chart.go .bar-up { transform: none; transition: transform .9s cubic-bezier(.2,.7,.2,1) var(--bd, 0ms); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
