/* ============================================================================
   Mergeance.ai · motion.css — the shared gx- motion system (every page)
   ----------------------------------------------------------------------------
   Load order in <head>:  main.css  ->  motion.css  ->  page <style>
   Paired with assets/js/motion.js (a HEAD script — it sets html.mg-anim before
   first paint and exports window.gxSplitWords / window.gxField).

   Owns: motion tokens, the shared mg- and lp- keyframes, the split-word helper,
   constellation canvases, no-JS static fallbacks, magnetic buttons, the
   .gx-settled gold money-settle flash, .gx-beam section seams, cursor-spotlight
   card borders, the deal-journey rail (opt in with <body class="has-rail">) and
   the one-time nav CTA nudge.

   Every effect is gated behind html.mg-anim AND killed again under
   @media (prefers-reduced-motion: reduce). With motion off or JS broken the
   page must still render complete and fully visible.
   ============================================================================ */

/* ---------- B6 · motion tokens ---------- */
:root {
  --gx-glide: cubic-bezier(0.22, 1, 0.36, 1);
  --gx-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- B6 · shared keyframes (single source of truth) ---------- */
@keyframes mgFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes mgRiseFade { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes mgWordRise { from { opacity: 0; transform: translateY(0.6em); } to { opacity: 1; transform: none; } }
@keyframes mgCtaPop { from { opacity: 0; transform: translateY(16px) scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes mgTextSheen { from { background-position: 150% 0, 0 0; } to { background-position: -150% 0, 0 0; } }
/* infinite loops live behind the no-preference gate as double safety */
@media (prefers-reduced-motion: no-preference) {
  @keyframes mgCaret { 50% { opacity: 0; } }
  /* compositor-only pulse: the dots carry a static glow (box-shadow) in their
     base rules; scale + opacity make it breathe without repainting the shadow */
  @keyframes lpMintPulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.3); opacity: 1; }
  }
}

/* ---------- B6 · split-word helper ---------- */
.gx-w { display: inline-block; }
/* background-clip:text does not reach inline-block children — re-clip per word */
.text-gradient .gx-w, .text-gold-gradient .gx-w {
  background-image: inherit;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
html.mg-anim .gx-words-play .gx-w {
  animation: mgWordRise 0.6s var(--gx-glide) both;
  animation-delay: calc(var(--gx-wd, 0.08s) + var(--gx-i, 0) * var(--gx-ws, 0.07s));
}

/* ---------- B6 · constellation canvases ---------- */
html:not(.mg-anim) .gx-field { display: none; }

/* ---------- B6 · no-JS / failed-JS page-wide static fallback ----------
   main.css parks .reveal at opacity 0 until main.js adds .in. If scripts never
   run, mg-anim is never added — every section must still render complete and
   static (hard rule: base state fully visible). */
html:not(.mg-anim) .reveal,
html:not(.mg-anim) .reveal-left,
html:not(.mg-anim) .reveal-right,
html:not(.mg-anim) .reveal-scale { opacity: 1; transform: none; }
/* main.js duplicates the marquee track for a seamless loop; without it the
   single track hard-snaps every 36s — render it as a clean static row instead */
html:not(.mg-anim) .marquee-track { animation: none; }

/* ---------- B6 · magnetic buttons (pointer:fine + mg-anim only) ---------- */
.gx-btn-in { display: inline-flex; align-items: center; gap: 10px; }
html.mg-anim.gx-fine .gx-mag {
  transition: transform 0.5s var(--gx-spring), box-shadow 0.25s, background 0.25s, border-color 0.25s;
}
html.mg-anim.gx-fine .gx-mag:hover {
  transition: transform 0.16s var(--gx-glide), box-shadow 0.25s, background 0.25s, border-color 0.25s;
  transform: translate3d(var(--gx-mx, 0px), calc(var(--gx-my, 0px) - 2px), 0);
}
html.mg-anim.gx-fine .gx-mag:active {
  transform: translate3d(var(--gx-mx, 0px), calc(var(--gx-my, 0px) - 2px), 0) scale(0.96);
  transition-duration: 0.1s;
}
html.mg-anim.gx-fine .gx-mag .gx-btn-in {
  transition: transform 0.5s var(--gx-spring);
  transform: translate3d(var(--gx-lx, 0px), var(--gx-ly, 0px), 0);
}
html.mg-anim.gx-fine .gx-mag:hover .gx-btn-in { transition: transform 0.16s var(--gx-glide); }

/* ---------- B6 · settle flash: one-time gold sheen + pop on landed RM figures ---------- */
html.mg-anim span.gx-settled { display: inline-block; }
html.mg-anim .gx-settled {
  position: relative;
  animation: gxSettlePop 0.7s var(--gx-spring);
}
@keyframes gxSettlePop { 0% { transform: scale(1); } 38% { transform: scale(1.04); } 100% { transform: scale(1); } }
html.mg-anim .gx-settled::after {
  content: ""; position: absolute; inset: -0.12em -0.3em; pointer-events: none; border-radius: 0.25em;
  background: linear-gradient(105deg, transparent 34%, rgba(255, 211, 77, 0.30) 50%, transparent 66%);
  background-size: 230% 100%; background-position: 135% 0;
  mix-blend-mode: screen;
  animation: gxSettleSheen 0.7s ease-out forwards;
}
html.mg-anim .section-light .gx-settled::after,
html.mg-anim .section-tint .gx-settled::after {
  mix-blend-mode: normal;
  background: linear-gradient(105deg, transparent 34%, rgba(247, 183, 51, 0.38) 50%, transparent 66%);
  background-size: 230% 100%;
}
@keyframes gxSettleSheen {
  0% { background-position: 135% 0; opacity: 1; }
  100% { background-position: -135% 0; opacity: 0; }
}

/* ---------- B6 · section-seam beam (owners drop .gx-beam as first child) ----------
   Base state: static hairline at 0.25. mg-anim: scaleX 0 -> 1 with a 60px head glow. */
.gx-beam {
  position: absolute; top: 0; left: 0; width: 100%; height: 2px;
  pointer-events: none; opacity: 0.25; z-index: 3;
}
.gx-beam::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.9) 14%, rgba(61, 116, 255, 0.9) 55%, rgba(56, 189, 248, 0.55) 86%, transparent);
}
.gx-beam::after {
  content: ""; position: absolute; top: -4px; right: -4px; width: 60px; height: 10px; opacity: 0;
  background: radial-gradient(30px 5px at 55% 50%, rgba(125, 211, 252, 0.95), rgba(61, 116, 255, 0.35) 60%, transparent 78%);
}
html.mg-anim .gx-beam { transform-origin: left center; }
html.mg-anim .gx-beam:not(.in) { transform: scaleX(0); }
html.mg-anim .gx-beam.in { animation: gxBeamGrow 0.9s var(--gx-glide) both; }
html.mg-anim .gx-beam.in::after { animation: gxBeamHead 0.9s var(--gx-glide) both; }
@keyframes gxBeamGrow {
  0% { transform: scaleX(0); opacity: 0.95; }
  72% { opacity: 0.85; }
  100% { transform: scaleX(1); opacity: 0.25; }
}
@keyframes gxBeamHead { 0% { opacity: 0; } 12% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- B6 · cursor-spotlight borders (.listing-card, .tx-pillar-chip) ---------- */
html.mg-anim.gx-fine .listing-card, html.mg-anim.gx-fine .tx-pillar-chip { position: relative; }
html.mg-anim.gx-fine .listing-card::after, html.mg-anim.gx-fine .tx-pillar-chip::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1.5px;
  background: radial-gradient(200px circle at var(--gx-x, 50%) var(--gx-y, 50%), rgba(56, 189, 248, 0.9), rgba(61, 116, 255, 0.35) 45%, transparent 72%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  opacity: 0; transition: opacity 0.35s ease; pointer-events: none; z-index: 2;
}
html.mg-anim.gx-fine .listing-card:hover::after, html.mg-anim.gx-fine .tx-pillar-chip:hover::after { opacity: 1; }

/* ---------- B6 · deal-journey rail (>=900px + mg-anim only) ---------- */
.gx-rail {
  position: fixed; top: 50%; right: 22px; z-index: 70; height: 224px; width: 20px;
  transform: translateY(-50%); display: none; pointer-events: none;
}
html.mg-anim .gx-rail { display: block; opacity: 0; transition: opacity 0.6s ease; }
html.mg-anim .gx-rail.gx-live { opacity: 1; }
.gx-rail-track {
  position: absolute; top: 0; bottom: 0; right: 8px; width: 2px; border-radius: 2px;
  background: rgba(159, 177, 206, 0.22); overflow: hidden;
}
.gx-rail-fill {
  position: absolute; inset: 0; border-radius: 2px;
  background: linear-gradient(to bottom, var(--blue-500), var(--sky-400));
  transform: scaleY(0); transform-origin: top center;
}
.gx-rail-dot { position: absolute; right: 0; width: 20px; height: 20px; margin-top: -10px; }
.gx-rail-dot i {
  position: absolute; right: 4px; top: 5px; width: 10px; height: 10px; border-radius: 50%;
  border: 1.5px solid rgba(159, 177, 206, 0.5); background: rgba(5, 21, 48, 0.9);
  transition: border-color 0.4s, background 0.4s, box-shadow 0.4s, transform 0.4s var(--gx-spring);
}
.gx-rail-dot.on i {
  border-color: var(--sky-400); background: var(--sky-400);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.8); transform: scale(1.15);
}
.gx-rail-dot em {
  position: absolute; right: 26px; top: 50%; transform: translateY(-50%) translateX(6px);
  font-style: normal; font-family: var(--font-body); font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase; white-space: nowrap;
  color: #BAE6FD; background: rgba(5, 21, 48, 0.78); border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 3px 9px; border-radius: 7px;
  opacity: 0; transition: opacity 0.4s ease, transform 0.4s var(--gx-glide);
}
.gx-rail-dot.gx-cur em { opacity: 1; transform: translateY(-50%); }
@media (max-width: 899px) { html.mg-anim .gx-rail { display: none; } }

/* ---------- B6 · nav CTA nudge (one-time, class added by JS, nav markup untouched) ---------- */
html.mg-anim .btn-nav.gx-pulse { position: relative; }
html.mg-anim .btn-nav.gx-pulse::after {
  content: ""; position: absolute; inset: -4px; border-radius: 16px; pointer-events: none;
  box-shadow: 0 0 24px 5px rgba(56, 189, 248, 0.5), 0 0 64px 14px rgba(30, 94, 255, 0.3);
  opacity: 0; animation: gxNavPulse 1.9s ease-in-out 0.1s 1;
}
@keyframes gxNavPulse {
  0% { opacity: 0; transform: scale(0.94); }
  35% { opacity: 1; transform: scale(1); }
  70% { opacity: 0.55; }
  100% { opacity: 0; transform: scale(1.02); }
}

/* ---------- B6 · small screens: art-directed H2 breaks reflow naturally ---------- */
@media (max-width: 640px) { .h2 br { display: none; } }

/* ---------- B6 · reduced-motion kill block (double safety) ---------- */
@media (prefers-reduced-motion: reduce) {
  .gx-field, .gx-rail { display: none !important; }
  .gx-beam { transform: none !important; opacity: 0.25 !important; animation: none !important; }
  .gx-beam::after { display: none !important; }
  .gx-w { animation: none !important; opacity: 1 !important; transform: none !important; }
  .gx-settled { animation: none !important; }
  .gx-settled::after, .btn-nav.gx-pulse::after { animation: none !important; opacity: 0 !important; }
  .gx-mag, .gx-mag .gx-btn-in { transition: none !important; transform: none !important; }
}
