/* =========================================================
   Home page motion (index.html only). Load after site-motion.css,
   which provides the shared entrances, buttons, links and the
   back-to-top button, plus the "motion" class and keyframes used
   here (mo-rise, mo-pop, mo-fade, mo-from-left, mo-from-right).

   This file adds Home's own pieces: the notifications,
   the platform diagram, the floating icons and the impact charts.
   Every animation ends on the design exactly as it is styled in
   mosadad.css.
   ========================================================= */

/* ---------- Headline: plain white, full stops bounce once ----------
   User, 2026-11-16: the gradient text was removed. "Don't chase. Settle."
   is plain white; home-motion.js wraps each full stop in .hm-dot and adds
   .hm-bounce each time the hero comes into view. Without motion (or JS)
   nothing moves. */
.motion .band--hero .hero--home .h-display:not(.is-split),
.motion .band--hero:not(.is-in) .hero--home .h-display .mo-word,
.motion .band--hero.is-in .hero--home .h-display .mo-word {
  opacity: 1;
  animation: none;
}

@keyframes hm-dot-bounce {
  0% { translate: 0 0; scale: 1.2 0.8; animation-timing-function: ease-out; }
  4% { scale: 0.88 1.18; animation-timing-function: cubic-bezier(0, 0.4, 0.5, 1); }
  11% { translate: 0 -0.6em; scale: 0.94 1.1; animation-timing-function: cubic-bezier(0.5, 0, 1, 0.6); }
  18% { translate: 0 0; scale: 1.4 0.65; text-shadow: 0 0 18px rgba(255, 255, 255, 0.7); animation-timing-function: cubic-bezier(0, 0.4, 0.5, 1); }
  24% { translate: 0 -0.3em; scale: 0.95 1.08; animation-timing-function: cubic-bezier(0.5, 0, 1, 0.6); }
  30% { translate: 0 0; scale: 1.25 0.78; animation-timing-function: cubic-bezier(0, 0.4, 0.5, 1); }
  34% { translate: 0 -0.12em; scale: 1 1; animation-timing-function: cubic-bezier(0.5, 0, 1, 0.6); }
  38% { translate: 0 0; scale: 1.12 0.9; }
  42%, 100% { translate: 0 0; scale: 1 1; text-shadow: 0 0 0 rgba(255, 255, 255, 0); }
}

/* full stops: one bounce per visit (.hm-bounce) */
.hero--home .h-display.hm .hm-dot {
  display: inline-block;
  transform-origin: 50% 85%;
}

.hero--home .h-display.hm.hm-bounce .hm-dot {
  animation: hm-dot-bounce 3s linear 0.4s 1;
}

/* ---------- The problem: a live notification feed ----------
   Always visible and always running (not tied to scrolling): every 1.2s
   the next notification "arrives" again (flicks out, slides back in with
   a blue glow, its app icon bounces), so the four take turns in a 4.8s
   loop. The bell rings and the "4 new" badge bumps on every arrival. */
@keyframes hm-notif-arrive {
  0% { translate: 0 0; opacity: 1; }
  3% { translate: 26px 0; opacity: 0.35; }
  9% { translate: -4px 0; opacity: 1; border-color: var(--blue); box-shadow: var(--shadow-card), 0 0 0 3px rgba(16, 114, 250, 0.14), 0 10px 26px rgba(16, 114, 250, 0.22); }
  13% { translate: 0 0; }
  20% { border-color: var(--blue); box-shadow: var(--shadow-card), 0 0 0 3px rgba(16, 114, 250, 0.1); }
  30%, 100% { translate: 0 0; opacity: 1; border-color: var(--line-2); box-shadow: var(--shadow-card); }
}

@keyframes hm-app-bounce {
  0%, 6%, 100% { scale: 1; }
  10% { scale: 1.18; }
  15% { scale: 0.95; }
  19% { scale: 1; }
}

.motion .notif {
  animation: hm-notif-arrive 4.8s var(--ease-out) infinite;
}

.motion .notif .notif__app {
  animation: hm-app-bounce 4.8s ease-out infinite;
}

.motion .notif:nth-of-type(2),
.motion .notif:nth-of-type(2) .notif__app { animation-delay: 1.2s; }
.motion .notif:nth-of-type(3),
.motion .notif:nth-of-type(3) .notif__app { animation-delay: 2.4s; }
.motion .notif:nth-of-type(4),
.motion .notif:nth-of-type(4) .notif__app { animation-delay: 3.6s; }

@keyframes hm-ring {
  0%, 100% { rotate: 0deg; }
  10% { rotate: 18deg; }
  20% { rotate: -15deg; }
  30% { rotate: 11deg; }
  40% { rotate: -6deg; }
  50% { rotate: 2deg; }
  60% { rotate: 0deg; }
}

@keyframes hm-badge-bump {
  0%, 22%, 100% { scale: 1; }
  10% { scale: 1.22; }
  16% { scale: 0.96; }
}

.motion .notif-panel__title svg {
  transform-origin: 50% 10%;
  animation: hm-ring 1.2s ease-in-out 0.1s infinite;
}

.motion .notif-panel .chip--solid {
  animation: hm-badge-bump 1.2s ease-out 0.1s infinite;
}

/* "Payment pending" keeps a quick pulse */
@keyframes hm-pending {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 114, 250, 0); }
  50% { box-shadow: 0 0 0 5px rgba(16, 114, 250, 0.18); }
}

.motion .notif .chip--soft {
  animation: hm-pending 1.4s ease-in-out infinite;
}

/* ---------- One shared platform: hub, parties and flowing links ---------- */
.motion .page > :not(.is-in) .eco__hub,
.motion .page > :not(.is-in) .eco__node { opacity: 0; }

@keyframes hm-hub {
  0% { opacity: 0; scale: 0.82; }
  65% { opacity: 1; scale: 1.03; }
  100% { opacity: 1; scale: 1; }
}

.motion .is-in .eco__hub {
  position: relative;
  animation: hm-hub 1s var(--ease-out) 0.2s both;
}

/* Expanding ring around the hub */
@keyframes hm-halo {
  0% { opacity: 0.55; scale: 1; }
  100% { opacity: 0; scale: 1.18; }
}

.motion .is-in .eco__hub::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 2px solid var(--blue);
  pointer-events: none;
  opacity: 0;
  animation: hm-halo 2.8s ease-out 1.4s infinite;
}

.motion .is-in .eco__hub img {
  animation: mo-pop 0.9s var(--ease-out) 0.55s both;
}

/* Parties: slide in, then light up one after another in a 7.2s loop.
   --enter: slide-in delay. --t: when in the loop the party lights up.
   --pulse-at: when its connector pulse starts. Left-hand parties send
   (pulse leaves as they light up); right-hand parties receive (pulse
   leaves the hub 0.86s earlier, so it arrives as they light up). */
.motion .eco__side:first-child .eco__row:nth-child(1) { --enter: 0.55s; --t: 0s; }
.motion .eco__side:first-child .eco__row:nth-child(2) { --enter: 0.7s; --t: 1.2s; }
.motion .eco__side:first-child .eco__row:nth-child(3) { --enter: 0.85s; --t: 2.4s; }
.motion .eco__side:last-child .eco__row:nth-child(1) { --enter: 0.55s; --t: 3.6s; }
.motion .eco__side:last-child .eco__row:nth-child(2) { --enter: 0.7s; --t: 4.8s; }
.motion .eco__side:last-child .eco__row:nth-child(3) { --enter: 0.85s; --t: 6s; }

.motion .eco__side:first-child .eco__row { --pulse-at: var(--t); }
.motion .eco__side:last-child .eco__row { --pulse-at: calc(var(--t) - 0.86s); }

@keyframes hm-node-active {
  0%, 22%, 100% { border-color: var(--line-2); box-shadow: var(--shadow-card); }
  4%, 12% {
    border-color: var(--blue);
    box-shadow: var(--shadow-card), 0 0 0 4px rgba(16, 114, 250, 0.12), 0 12px 30px rgba(16, 114, 250, 0.22);
  }
}

@keyframes hm-tile-active {
  0%, 22%, 100% { background-color: var(--tint); color: var(--blue); scale: 1; }
  4% { scale: 1.18; }
  8%, 12% { background-color: var(--blue); color: var(--white); scale: 1; }
}

.motion .is-in .eco__side:first-child .eco__node {
  animation:
    mo-from-left 0.8s var(--ease-out) var(--enter) both,
    hm-node-active 7.2s ease-in-out calc(2.2s + var(--t)) infinite;
}

.motion .is-in .eco__side:last-child .eco__node {
  animation:
    mo-from-right 0.8s var(--ease-out) var(--enter) both,
    hm-node-active 7.2s ease-in-out calc(2.2s + var(--t)) infinite;
}

.motion .is-in .eco__node .icon-tile {
  animation: hm-tile-active 7.2s ease-in-out calc(2.2s + var(--t)) infinite;
}

/* Traffic authorities: the traffic-light icon's lamps blink in turn */
@keyframes hm-lamp {
  0%, 30% { fill-opacity: 1; }
  34%, 100% { fill-opacity: 0; }
}

.motion .eco__side:first-child .eco__row:nth-child(3) .icon circle {
  fill: currentColor;
  fill-opacity: 0;
  animation: hm-lamp 2.4s steps(1, end) infinite;
}

.motion .eco__side:first-child .eco__row:nth-child(3) .icon circle:nth-of-type(2) { animation-delay: 0.8s; }
.motion .eco__side:first-child .eco__row:nth-child(3) .icon circle:nth-of-type(3) { animation-delay: 1.6s; }

/* Hover: the party lifts and its connector turns solid blue */
.motion .eco__node {
  transition: transform 0.35s var(--ease-out);
}

.motion .eco__row:hover .eco__node {
  transform: translateY(-4px);
}

.motion .eco__link svg {
  transition: stroke 0.25s ease;
}

.motion .eco__row:hover .eco__link svg {
  stroke: var(--blue);
}

/* Data pulse along each connector (paths cloned by home-motion.js) */
@keyframes hm-pulse {
  0% { stroke-dashoffset: 14; opacity: 1; }
  12% { stroke-dashoffset: -100; opacity: 1; }
  12.5%, 100% { stroke-dashoffset: -100; opacity: 0; }
}

.motion .eco__pulse {
  stroke: var(--blue);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 14 200;
  stroke-dashoffset: 14;
  opacity: 0;
  filter: drop-shadow(0 0 4px rgba(16, 114, 250, 0.8));
}

.motion .is-in .eco__pulse {
  animation: hm-pulse 7.2s linear calc(2.2s + var(--pulse-at)) infinite;
}

/* Connectors draw in, then the dashes keep flowing.
   Left-hand paths run node → hub, right-hand paths run hub → node,
   so the same offset reads as "in to the record, out to the market". */
/* The curves bend outside their box, so the clip leaves room above and below */
.motion .page > :not(.is-in) .eco__link svg { clip-path: inset(-100% 100% -100% 0); }

@keyframes hm-draw-l {
  from { clip-path: inset(-100% 100% -100% 0); }
  to { clip-path: inset(-100% 0 -100% 0); }
}

@keyframes hm-flow { to { stroke-dashoffset: -24; } }

.motion .is-in .eco__link svg {
  animation:
    hm-draw-l 0.9s var(--ease-out) 1s both,
    hm-flow 1.2s linear 1.9s infinite;
}

/* ---------- Talk to us: floating icons follow the pointer ---------- */
.motion .page > :not(.is-in) .float-icon { opacity: 0; }

.motion .is-in .float-icon {
  animation-name: floaty, mo-fade;
  animation-duration: 5.2s, 1.2s;
  animation-timing-function: ease-in-out, ease;
  animation-iteration-count: infinite, 1;
  animation-fill-mode: none, both;
}

.motion .is-in .float-icon--1 { animation-duration: 5.2s, 1.2s; animation-delay: 0.4s, 0.2s; }
.motion .is-in .float-icon--2 { animation-duration: 5.9s, 1.2s; animation-delay: 0.8s, 0.35s; }
.motion .is-in .float-icon--3 { animation-duration: 6.6s, 1.2s; animation-delay: 1.2s, 0.5s; }
.motion .is-in .float-icon--4 { animation-duration: 7.3s, 1.2s; animation-delay: 1.6s, 0.65s; }

/* Home's "Talk to us" shows at once as it scrolls in, with no entrance
   (user, 2026-11-03): the heading, text and buttons don't rise in, and
   the icons are there straight away and just keep floating. */
.motion .page > .band .cta.cta--home .cta__inner > * {
  opacity: 1;
  animation: none;
}

.motion .page > .band .cta.cta--home .float-icon {
  opacity: 1;
  animation-name: floaty;
}

.motion .float-icon svg {
  transform: translate(calc(var(--px, 0) * var(--depth, 14px)), calc(var(--py, 0) * var(--depth, 14px)));
  transition: transform 0.6s var(--ease-out);
}

.motion .float-icon--2 svg { --depth: -10px; }
.motion .float-icon--3 svg { --depth: 18px; }
.motion .float-icon--4 svg { --depth: -16px; }

/* ---------- Audience cards: the three icons blink together ----------
   Once the cards have popped in, all three icons blink in unison and send
   out a soft blue ring; hovering a card makes its icon blink faster. */
@keyframes hm-tile-blink {
  0%, 100% { opacity: 1; scale: 1; }
  50% { opacity: 0.2; scale: 0.82; }
}

@keyframes hm-tile-ring {
  0% { box-shadow: 0 0 0 0 rgba(16, 114, 250, 0.45); }
  70%, 100% { box-shadow: 0 0 0 12px rgba(16, 114, 250, 0); }
}

.motion .page .card--link .icon-tile { position: relative; }

.motion .page .card--link .icon-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.motion .page > .is-in .card--link .icon-tile svg {
  animation: hm-tile-blink 1.6s ease-in-out 1.2s infinite;
}

.motion .page > .is-in .card--link .icon-tile::after {
  animation: hm-tile-ring 1.6s ease-out 1.2s infinite;
}

.motion .page > .is-in .card--link:is(:hover, :focus-visible) .icon-tile svg,
.motion .page > .is-in .card--link:is(:hover, :focus-visible) .icon-tile::after {
  animation-duration: 0.5s;
}

/* ---------- Projected impact: richer chart loading ----------
   mosadad.css already draws each chart once ".impact" gets
   "is-visible". These rules replace those entrances with livelier
   ones and add a gentle idle motion afterwards. site.js adds
   "is-visible" each time the section comes into view (and takes it
   away once it has left), so the charts replay with the count-up. */
.motion .stat-card {
  position: relative;
  overflow: hidden;
  transition: transform 0.4s var(--ease-out), border-color 0.3s ease, background-color 0.3s ease;
}

.motion .stat-card:hover {
  transform: translateY(-6px);
  border-color: rgba(255, 255, 255, 0.5);
  background-color: rgba(255, 255, 255, 0.12);
}

/* Light sweep across each card as its chart loads */
@keyframes hm-card-sweep {
  from { translate: -120% 0; }
  to { translate: 120% 0; }
}

.motion .stat-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.16) 50%, transparent 70%);
  translate: -120% 0;
}

.motion .impact.is-visible .stat-card::after {
  animation: hm-card-sweep 1.4s ease-in-out both;
}

.motion .impact.is-visible .stat-card:nth-child(1)::after { animation-delay: 0.3s; }
.motion .impact.is-visible .stat-card:nth-child(2)::after { animation-delay: 0.5s; }
.motion .impact.is-visible .stat-card:nth-child(3)::after { animation-delay: 0.7s; }
.motion .impact.is-visible .stat-card:nth-child(4)::after { animation-delay: 0.9s; }

/* Ring: spins in, overshoots, settles, then breathes */
@keyframes hm-ring-spin {
  from { rotate: -200deg; scale: 0.7; opacity: 0; }
  to { rotate: 0deg; scale: 1; opacity: 1; }
}

@keyframes hm-ring-draw {
  0% { stroke-dashoffset: 301.6; }
  70% { stroke-dashoffset: calc(var(--to) - 14); }
  85% { stroke-dashoffset: calc(var(--to) + 4); }
  100% { stroke-dashoffset: var(--to); }
}

@keyframes hm-glow {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.3)); }
  50% { filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.75)); }
}

.motion .impact.is-visible .stat-ring {
  animation: hm-ring-spin 1.4s var(--ease-out) 0.2s both;
}

.motion .impact.is-visible .stat-ring__value {
  animation:
    hm-ring-draw 2s var(--ease-out) 0.35s both,
    hm-glow 3s ease-in-out 2.4s infinite;
}

/* Bars: spring up one by one (the live loop is further down) */
@keyframes hm-bar-grow {
  0% { transform: scaleY(0); }
  60% { transform: scaleY(1.1); }
  80% { transform: scaleY(0.96); }
  100% { transform: scaleY(1); }
}

/* Squares: pop in diagonally (the live loop is further down) */
@keyframes hm-px-pop {
  0% { opacity: 0; transform: scale(0.2) rotate(-45deg); }
  70% { opacity: 1; transform: scale(1.2) rotate(0deg); }
  100% { opacity: 1; transform: none; }
}

/* Line: the shaded area fills behind the line, the end dot pops in */
@keyframes hm-area {
  from { clip-path: inset(0 100% 0 0); opacity: 0.3; }
  to { clip-path: inset(0 0 0 0); opacity: 1; }
}

@keyframes hm-dot-pop {
  0% { scale: 0; }
  70% { scale: 1.6; }
  100% { scale: 1; }
}

.motion .impact:not(.is-visible) .stat-spark__area { clip-path: inset(0 100% 0 0); }
.motion .impact:not(.is-visible) .stat-spark__dot { scale: 0; }

.motion .impact.is-visible .stat-spark__area {
  animation: hm-area 1.8s var(--ease-out) 0.3s both;
}

.motion .impact.is-visible .stat-spark__line {
  animation:
    draw 1.8s var(--ease-out) 0.3s both,
    hm-glow 3s ease-in-out 2.2s infinite;
}

.motion .impact.is-visible .stat-spark__dot {
  animation:
    hm-dot-pop 0.6s var(--ease-back) 1.7s both,
    pulse 1.8s ease-in-out 2.3s infinite;
}

/* ---------- Projected impact: live loops (Flourish-style) ----------
   Once each chart has loaded it keeps playing like live data while the
   section is on screen: a light runs round the ring and along the line,
   a highlight races through the bars, and the squares are scanned column
   by column before the white ones flip. */

/* Ring and line: a soft light runs along them (copies added by
   home-motion.js, pathLength 100) */
@keyframes hm-ring-run {
  0% { stroke-dashoffset: 0; opacity: 0; }
  10% { opacity: 1; }
  80% { opacity: 1; }
  100% { stroke-dashoffset: -59; opacity: 0; }
}

@keyframes hm-spark-run {
  0% { stroke-dashoffset: 6; opacity: 0; }
  10% { opacity: 1; }
  85% { opacity: 1; }
  100% { stroke-dashoffset: -96; opacity: 0; }
}

.stat-ring__runner,
.stat-spark__runner {
  fill: none;
  stroke: rgba(255, 255, 255, 0.55);
  stroke-linecap: round;
  stroke-dasharray: 6 100;
  opacity: 0;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.95));
  pointer-events: none;
}

.stat-ring .stat-ring__runner { stroke-width: 20; }
.stat-spark__runner { stroke-width: 12; }

.motion .impact.is-visible .stat-ring__runner { animation: hm-ring-run 2.2s ease-in-out 2.4s infinite; }
.motion .impact.is-visible .stat-spark__runner { animation: hm-spark-run 2.4s ease-in-out 2.4s infinite; }

/* Bars: a highlight races left to right, each bar jumps up and lights
   white in turn; the last (already white) bar lands it with a bounce */
@keyframes hm-bar-race {
  0%, 22%, 100% { scale: 1 1; background-color: rgba(255, 255, 255, 0.32); }
  8% { scale: 1 1.16; background-color: #fff; box-shadow: 0 0 14px rgba(255, 255, 255, 0.7); }
  15% { scale: 1 0.96; }
}

@keyframes hm-bar-land {
  0%, 30%, 100% { scale: 1 1; }
  36% { scale: 1 1.12; }
  42% { scale: 1 0.94; }
  48% { scale: 1 1.03; }
}

.motion .impact.is-visible .stat-bars span {
  animation:
    hm-bar-grow 1s var(--ease-out) var(--delay, 0s) both,
    hm-bar-race 3.2s ease-in-out calc(1.4s + (var(--delay, 0s) - 0.2s) * 1.6) infinite;
}

.motion .impact.is-visible .stat-bars span:last-child {
  animation:
    hm-bar-grow 1s var(--ease-out) var(--delay, 0s) both,
    hm-bar-land 3.2s ease-out 1.4s infinite,
    hm-glow 3.2s ease-in-out 1.8s infinite;
}

/* Squares: a scan sweeps across the columns, then the white squares flip */
.stat-pixels span:nth-child(10n + 1) { --col: 0; }
.stat-pixels span:nth-child(10n + 2) { --col: 1; }
.stat-pixels span:nth-child(10n + 3) { --col: 2; }
.stat-pixels span:nth-child(10n + 4) { --col: 3; }
.stat-pixels span:nth-child(10n + 5) { --col: 4; }
.stat-pixels span:nth-child(10n + 6) { --col: 5; }
.stat-pixels span:nth-child(10n + 7) { --col: 6; }
.stat-pixels span:nth-child(10n + 8) { --col: 7; }
.stat-pixels span:nth-child(10n + 9) { --col: 8; }
.stat-pixels span:nth-child(10n) { --col: 9; }

@keyframes hm-px-scan {
  0%, 12%, 100% { background-color: rgba(255, 255, 255, 0.22); scale: 1; }
  5% { background-color: rgba(255, 255, 255, 0.75); scale: 1.15; }
}

@keyframes hm-px-flip {
  0%, 30%, 100% { rotate: y 0deg; scale: 1; }
  40% { rotate: y 180deg; scale: 1.15; }
  50% { rotate: y 360deg; scale: 1; }
}

.motion .impact.is-visible .stat-pixels span {
  animation:
    hm-px-pop 0.6s var(--ease-out) var(--delay, 0s) both,
    hm-px-scan 3.6s ease-in-out calc(1.6s + var(--col) * 0.1s) infinite;
}

.motion .impact.is-visible .stat-pixels span:is(:nth-child(10n + 7), :nth-child(10n + 8), :nth-child(10n + 9), :nth-child(10n)) {
  animation:
    hm-px-pop 0.6s var(--ease-out) var(--delay, 0s) both,
    hm-px-flip 3.6s ease-in-out calc(1.6s + var(--col) * 0.1s) infinite;
}

/* The numbers count up in site.js; even-width digits keep them from
   jittering while they change */
.impact .stat-card__value {
  font-variant-numeric: tabular-nums;
}

/* Printing never scrolls sections into view, so show everything */
@media print {
  .motion .page > :not(.is-in) .eco__link svg { clip-path: none !important; }
}

/* ---------- Sections stack like cards as you scroll ----------
   After reactbits.dev "Scroll Stack" (user, 2026-11-03). home-motion.js
   sets each block's sticky top, its shrink (transform) and its shade. The
   page behind shows around a block once it has shrunk. */
.motion.hm-stack .page {
  background: var(--line-2);
}

.motion.hm-stack .page > .hm-stack__item {
  position: sticky;
  will-change: transform;
}

.motion.hm-stack .page > .band.hm-stack__item {
  background-color: var(--white);
}

/* Each block after the first slides in with a soft shadow over the one
   below. Square corners, so a block is the same shape top and bottom
   (review comments 2026-11-09). */
.motion.hm-stack .page > .hm-stack__item:not(:first-child) {
  box-shadow: 0 -14px 36px -18px rgba(4, 38, 92, 0.35);
}

.hm-stack__shade {
  position: absolute;
  inset: 0;
  z-index: 20;
  border-radius: inherit;
  /* The darkness is in the colour, not opacity, which the "no-motion"
     section rules force to 1 */
  background: rgba(4, 38, 92, var(--hm-dim, 0));
  pointer-events: none;
}
