/* ═══════════════════════════════════════════════════════════════════════
   MGX v2 — Valley West "app-ad" motion section (Aave-style, light & premium)
   Bold kinetic type · realistic phone with live app UI · count-ups · growing
   charts · soft floating dots · accent word per site. Loads after polish.css.
   Driven by [data-scene] on .mgx-stage (mgx.js). Respects reduced-motion.
   ═══════════════════════════════════════════════════════════════════════ */

.mgx-sec { background: var(--paper-2); color: var(--t-hi); overflow: hidden; }
.mgx-sec .section-head .eyebrow { color: var(--accent); }
.mgx-sec .section-head .h2 { color: var(--t-hi); }
.mgx-sec .section-head .h2 em { color: var(--accent); font-style: italic; }

/* frame + 16:9 light stage */
.mgx-frame {
  position: relative; max-width: 1180px; margin: 0 auto;
  border-radius: var(--r-xl); overflow: hidden;
  background:
    radial-gradient(70% 60% at 50% 8%, color-mix(in srgb, var(--accent) 7%, transparent) 0%, transparent 60%),
    linear-gradient(180deg, #FFFFFF 0%, #F6F5F1 100%);
  border: 1px solid var(--border);
  box-shadow: 0 40px 110px rgba(8,8,10,.16), inset 0 1px 0 rgba(255,255,255,.8);
}
.mgx-stage { position: relative; width: 100%; aspect-ratio: 16 / 9; container-type: inline-size; }
@supports not (aspect-ratio: 1) { .mgx-stage { height: 0; padding-bottom: 56.25%; } }

/* soft floating dots */
.mgx-dots { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.mgx-dots i { position: absolute; width: 1.1cqw; height: 1.1cqw; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 38%, transparent); opacity: .5; }
.mgx-dots i:nth-child(1){ left:8%;  top:18%; }
.mgx-dots i:nth-child(2){ left:21%; top:72%; width:.7cqw; height:.7cqw; }
.mgx-dots i:nth-child(3){ left:84%; top:24%; }
.mgx-dots i:nth-child(4){ left:91%; top:66%; width:.8cqw; height:.8cqw; opacity:.4; }
.mgx-dots i:nth-child(5){ left:14%; top:44%; width:.6cqw; height:.6cqw; opacity:.35; }
.mgx-dots i:nth-child(6){ left:77%; top:84%; width:.7cqw; height:.7cqw; opacity:.4; }
.mgx-dots i:nth-child(7){ left:50%; top:9%;  width:.6cqw; height:.6cqw; opacity:.3; }
@media (prefers-reduced-motion: no-preference) {
  .mgx-dots i { animation: mgxFloat 7s ease-in-out infinite; }
  .mgx-dots i:nth-child(2n){ animation-duration: 9s; animation-delay: -2s; }
  .mgx-dots i:nth-child(3n){ animation-duration: 11s; animation-delay: -4s; }
  @keyframes mgxFloat { 0%,100%{ transform: translateY(0); } 50%{ transform: translateY(-1.6cqw); } }
}

/* scenes */
.mgx-scene { position: absolute; inset: 0; z-index: 1; display: grid; place-content: center;
  padding: 5cqw 7cqw; text-align: center; opacity: 0; visibility: hidden;
  transition: opacity .5s var(--ease-out), visibility .5s; }
.mgx-scene.on { opacity: 1; visibility: visible; }

/* kinetic headline */
.mgx-head { font-family: var(--sans); font-weight: 800; letter-spacing: -.025em; line-height: 1.04;
  color: var(--t-hi); font-size: 6.2cqw; max-width: 100%; }
.mgx-head .ac { color: var(--accent); }
.mgx-sm { font-family: var(--sans); font-weight: 600; font-size: 2.6cqw; color: var(--t-mid); margin-top: 2cqw; }

@media (prefers-reduced-motion: no-preference) {
  .mgx-scene .up { opacity: 0; transform: translateY(2.2cqw); }
  .mgx-scene.on .up { animation: mgxUp .8s var(--ease-out) forwards; }
  .mgx-scene.on .up.d1 { animation-delay: .12s; }
  .mgx-scene.on .up.d2 { animation-delay: .24s; }
  .mgx-scene.on .up.d3 { animation-delay: .36s; }
  @keyframes mgxUp { to { opacity: 1; transform: none; } }
}

/* ── S0 cold open — app icon + wordmark ── */
.mgx-open { display: flex; flex-direction: column; align-items: center; gap: 3cqw; }
.mgx-appicon { width: 16cqw; height: 16cqw; border-radius: 4.2cqw; display: grid; place-items: center;
  color: #fff; background: linear-gradient(155deg, var(--accent), color-mix(in srgb, var(--accent) 62%, #000));
  box-shadow: 0 3cqw 6cqw color-mix(in srgb, var(--accent) 30%, transparent); }
.mgx-appicon svg { width: 9cqw; height: 9cqw; }
@media (prefers-reduced-motion: no-preference) {
  .mgx-scene.on .mgx-appicon { animation: mgxPop .7s var(--ease-spring) both; }
  @keyframes mgxPop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
}
.mgx-wordmark { font-family: var(--mono); font-weight: 600; font-size: 2.4cqw; letter-spacing: .2em;
  text-transform: uppercase; color: var(--t-mid); }
.mgx-open .mgx-head { font-size: 5.8cqw; }

/* ── phone mockup (scene 1: headline left, phone right) ── */
.mgx-pcol { display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 5cqw; }
.mgx-pcol .mgx-head { font-size: 5cqw; text-align: left; max-width: 36cqw; flex: none; }
.mgx-phone { width: 25cqw; aspect-ratio: 9 / 16.4; background: #0c0c0e; border-radius: 5cqw;
  padding: .9cqw; box-shadow: 0 4cqw 9cqw rgba(8,8,10,.30); flex: none; position: relative; }
.mgx-phone::before { content: ""; position: absolute; top: 1.7cqw; left: 50%; transform: translateX(-50%);
  width: 9cqw; height: 1.5cqw; background: #0c0c0e; border-radius: 999px; z-index: 3; }
.mgx-screen { position: relative; height: 100%; border-radius: 4.2cqw; overflow: hidden;
  background: linear-gradient(180deg, #fff 0%, #FBFAF8 100%); display: flex; flex-direction: column;
  padding: 4cqw 3cqw 3cqw; gap: 1.8cqw; }
.mgx-sc-top { display: flex; align-items: center; justify-content: space-between; }
.mgx-sc-av { width: 4.4cqw; height: 4.4cqw; border-radius: 50%; background: color-mix(in srgb, var(--accent) 18%, #eee);
  color: var(--accent); font-family: var(--sans); font-weight: 700; font-size: 1.9cqw; display: grid; place-items: center; }
.mgx-sc-pill { font-family: var(--mono); font-size: 1.35cqw; color: var(--t-lo); border: 1px solid var(--border);
  border-radius: 999px; padding: .7cqw 1.6cqw; white-space: nowrap; }
.mgx-sc-lbl { font-family: var(--sans); font-weight: 600; font-size: 1.8cqw; color: var(--t-mid); margin-top: .4cqw; }
.mgx-sc-amt { font-family: var(--sans); font-weight: 800; font-size: 5.2cqw; letter-spacing: -.03em;
  color: var(--t-hi); line-height: 1; font-variant-numeric: tabular-nums; }
.mgx-sc-amt small { font-size: .5em; color: var(--t-lo); font-weight: 700; }
.mgx-sc-delta { display: inline-flex; align-items: center; gap: .8cqw; font-family: var(--sans); font-weight: 700;
  font-size: 1.6cqw; color: var(--ok); white-space: nowrap; margin-top: 1cqw; }
.mgx-sc-delta svg { width: 2cqw; height: 2cqw; flex: none; }
.mgx-sc-chart { display: flex; align-items: flex-end; gap: 1.5cqw; height: 12cqw; margin-top: auto; }
.mgx-sc-chart i { flex: 1; border-radius: 1cqw 1cqw 0 0; background: color-mix(in srgb, var(--accent) 16%, #ececec);
  transform-origin: bottom; transform: scaleY(0); }
.mgx-sc-chart i.hot { background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 65%, #fff)); }
@media (prefers-reduced-motion: no-preference) {
  .mgx-scene.on .mgx-sc-chart i { animation: mgxGrow .8s var(--ease-out) forwards; }
  .mgx-scene.on .mgx-sc-chart i:nth-child(2){ animation-delay:.06s } .mgx-scene.on .mgx-sc-chart i:nth-child(3){ animation-delay:.12s }
  .mgx-scene.on .mgx-sc-chart i:nth-child(4){ animation-delay:.18s } .mgx-scene.on .mgx-sc-chart i:nth-child(5){ animation-delay:.24s }
  .mgx-scene.on .mgx-sc-chart i:nth-child(6){ animation-delay:.30s } .mgx-scene.on .mgx-sc-chart i:nth-child(7){ animation-delay:.36s }
  @keyframes mgxGrow { to { transform: scaleY(1); } }
}
.mgx-sc-chart i { height: var(--h, 60%); }
.mgx-sc-chip { display: none; }
.mgx-sc-chip .d { width: 3cqw; height: 3cqw; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; }
.mgx-sc-chip .d svg { width: 1.9cqw; height: 1.9cqw; }

/* ── big stat scene (chart + giant number) ── */
.mgx-big { display: flex; flex-direction: column; align-items: center; gap: 2cqw; }
.mgx-big .lbl { font-family: var(--sans); font-weight: 600; font-size: 2.6cqw; color: var(--t-mid); }
.mgx-big .num { font-family: var(--sans); font-weight: 800; font-size: 13cqw; letter-spacing: -.03em;
  color: var(--accent); line-height: .95; font-variant-numeric: tabular-nums; }
.mgx-big .sub { font-family: var(--sans); font-weight: 600; font-size: 2.4cqw; color: var(--t-hi); }
.mgx-big .sub b { color: var(--accent); }
.mgx-bigchart { display: flex; align-items: flex-end; gap: 1.4cqw; height: 14cqw; width: 56cqw; margin-top: 1cqw; }
.mgx-bigchart i { flex: 1; border-radius: 1cqw 1cqw 0 0; background: color-mix(in srgb, var(--accent) 14%, #e8e8e4);
  transform-origin: bottom; height: var(--h, 50%); transform: scaleY(0); }
.mgx-bigchart i.hot { background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #fff)); }
@media (prefers-reduced-motion: no-preference) {
  .mgx-scene.on .mgx-bigchart i { animation: mgxGrow .9s var(--ease-out) forwards; }
  .mgx-scene.on .mgx-bigchart i:nth-child(2n){ animation-delay:.08s } .mgx-scene.on .mgx-bigchart i:nth-child(3n){ animation-delay:.16s }
  .mgx-scene.on .mgx-bigchart i:nth-child(5n){ animation-delay:.24s }
}

/* ── trust scene (3 stat pills) ── */
.mgx-trust { display: flex; flex-direction: column; align-items: center; gap: 5cqw; }
.mgx-trust .mgx-head { font-size: 5.2cqw; width: 100%; }
.mgx-pills { display: flex; gap: 3cqw; }
.mgx-pill { background: #fff; border: 1px solid var(--border); border-radius: 3cqw; padding: 3.4cqw 4.4cqw;
  box-shadow: 0 2cqw 6cqw rgba(8,8,10,.08); min-width: 22cqw; }
.mgx-pill .pv { font-family: var(--sans); font-weight: 800; font-size: 6.4cqw; letter-spacing: -.02em; color: var(--t-hi); line-height: 1; }
.mgx-pill .pv em { color: var(--accent); font-style: normal; }
.mgx-pill .pl { font-family: var(--sans); font-weight: 600; font-size: 2cqw; color: var(--t-mid); margin-top: 1.2cqw; }

/* ── endcard ── */
.mgx-end { display: flex; flex-direction: column; align-items: center; gap: 3cqw; text-align: center; }
.mgx-end .mgx-head, .mgx-end .url, .mgx-end .ec-meta { width: 100%; }
.mgx-end .mgx-appicon { width: 13cqw; height: 13cqw; border-radius: 3.6cqw; }
.mgx-end .mgx-appicon svg { width: 7.2cqw; height: 7.2cqw; }
.mgx-end .mgx-head { font-size: 5.6cqw; }
.mgx-end .url { font-family: var(--sans); font-weight: 800; font-size: 3cqw; color: var(--accent); }
.mgx-end .ec-meta { display: flex; align-items: center; gap: 2.2cqw; font-family: var(--mono); font-size: 1.9cqw;
  letter-spacing: .08em; text-transform: uppercase; color: var(--t-lo); flex-wrap: wrap; justify-content: center; }
.mgx-end .ec-meta b { color: var(--t-hi); font-weight: 600; white-space: nowrap; }
.mgx-end .ec-meta .dot { width: .7cqw; height: .7cqw; border-radius: 50%; background: var(--accent); }

/* progress ticks + controls */
.mgx-bottom { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; align-items: center;
  gap: 3cqw; padding: 2.6cqw 3.6cqw; }
.mgx-ticks { display: flex; gap: 1.2cqw; flex: 1; }
.mgx-ticks i { flex: 1; height: 3px; border-radius: 3px; background: rgba(10,10,11,.12); overflow: hidden; position: relative; }
.mgx-ticks i::after { content: ""; position: absolute; inset: 0; width: 0; background: var(--accent); border-radius: 3px; }
.mgx-ticks i.done::after { width: 100%; }
.mgx-ticks i.active::after { animation: mgxTick var(--dur, 4s) linear forwards; }
@keyframes mgxTick { from { width: 0; } to { width: 100%; } }
.mgx-ctrl { display: inline-flex; gap: 1.4cqw; }
.mgx-ctrl button { width: 7cqw; height: 7cqw; max-width: 40px; max-height: 40px; min-width: 30px; min-height: 30px;
  border-radius: 50%; border: 1px solid var(--border-strong); background: rgba(255,255,255,.8); color: var(--t-hi);
  display: grid; place-items: center; cursor: pointer; transition: background .2s, border-color .2s, color .2s; padding: 0; }
.mgx-ctrl button:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.mgx-ctrl button svg { width: 46%; height: 46%; }
.mgx-ctrl .ic-pause, .mgx-stage.paused .mgx-ctrl .ic-play { display: block; }
.mgx-ctrl .ic-play, .mgx-stage.paused .mgx-ctrl .ic-pause { display: none; }

/* CTA under the frame */
.mgx-sec .mgx-cta { display: flex; justify-content: center; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 34px; }
.mgx-sec .mgx-cta .mgx-callbtn { display: inline-flex; align-items: center; gap: 9px; padding: 14px 26px; border-radius: 999px;
  border: 1.5px solid var(--border-strong); color: var(--t-hi); font-family: var(--sans); font-weight: 700; font-size: 15px;
  text-decoration: none; white-space: nowrap; transition: border-color .2s, background .2s; }
.mgx-sec .mgx-cta .mgx-callbtn:hover { background: #fff; border-color: var(--t-hi); }
.mgx-sec .mgx-cta .mgx-callbtn svg { width: 16px; height: 16px; }
.mgx-sec .rates-disc { color: var(--t-lo); }

/* reduced-motion / no-JS: hold the endcard as a static poster */
.mgx-stage.poster .mgx-scene { opacity: 0; visibility: hidden; }
.mgx-stage.poster .mgx-scene[data-s="4"] { opacity: 1; visibility: visible; }
.mgx-stage.poster .mgx-bottom .mgx-ticks { visibility: hidden; }
@media (prefers-reduced-motion: reduce) {
  .mgx-scene, .mgx-scene .up { transition: none; }
  .mgx-sc-chart i, .mgx-bigchart i { transform: scaleY(1) !important; }
}

/* responsive */
@container (max-width: 620px) {
  .mgx-pills { flex-direction: column; gap: 2cqw; }
  .mgx-pill { min-width: 56cqw; }
  .mgx-head { font-size: 7.4cqw; }
  .mgx-pcol .mgx-head, .mgx-trust .mgx-head { font-size: 6.4cqw; }
  .mgx-phone { width: 36cqw; }
  .mgx-big .num { font-size: 16cqw; }
  .mgx-bigchart { width: 76cqw; }
}
