/* ==========================================================================
   MOTION LAYER — Matrix Realty
   Industry fit: real estate = moderate intensity. Image reveals, card feedback,
   counters and chart drawing; no bouncy or constant kinetic motion.
   Every reveal: triggered once on viewport entry (desktop AND mobile), never hides
   content if JS fails (the .motion class is only added by motion.js).
   ========================================================================== */
:root {
  --motion-fast: 150ms;
  --motion-normal: 250ms;
  --motion-slow: 450ms;
  --motion-reveal: 650ms;
  --motion-media: 800ms;
  --motion-count: 1200ms;
  --motion-stagger: 60ms;
  --ease-standard: cubic-bezier(.2, 0, 0, 1);
  --ease-enter: cubic-bezier(0, 0, .2, 1);
  --motion-distance: 20px;
}
@media (max-width: 640px) { :root { --motion-distance: 16px; } }

/* 1 · Fade + rise (cards, copy, chips) — 550/650ms, staggered 60ms inside groups */
.motion [data-reveal] {
  transition: opacity 550ms var(--ease-enter), transform var(--motion-reveal) var(--ease-standard);
  transition-delay: var(--d, 0s);
}
.motion [data-reveal]:not([data-reveal="clip"]):not([data-reveal="scale"]):not([data-reveal="left"]) { transform: translateY(var(--motion-distance)); }
.motion [data-reveal="scale"] { transform: scale(.97); }
.motion [data-reveal="left"] { transform: translateX(calc(var(--motion-distance) * -1.5)); }
.motion [data-reveal].in { opacity: 1; transform: none; }

/* 2 · Clip-path reveal (feature images, map, panels) — 800ms */
.motion [data-reveal="clip"] { transition: clip-path var(--motion-media) cubic-bezier(.65, 0, .35, 1); }

/* 3 · Media settle: image eases from 1.14 → 1 as its frame enters (uses `scale`, so it
      composes with parallax/hover transforms instead of fighting them) */
.motion .m-reveal img:not(.obj):not(.floater) { scale: 1.14; transition: scale 1.4s var(--ease-standard), transform 1.2s var(--ease); }
.motion .m-reveal.in img:not(.obj):not(.floater) { scale: 1; }

/* 4 · Line reveal for headings (existing split lines) — 800ms, 90ms per line */
.split-line > span { transition-duration: 800ms; }

/* 5 · Counters: fixed-width digits so the layout never jitters while counting */
[data-countup], [data-count] { font-variant-numeric: tabular-nums; }

/* 6 · Chart drawing — bars grow from their baseline, dots pop, 900ms, 60ms stagger */
.motion .chart .bar { transform-box: fill-box; transform-origin: 0 50%; transform: scaleX(0); transition: transform 900ms var(--ease-standard), opacity .3s; transition-delay: calc(var(--i, 0) * var(--motion-stagger)); }
.motion #c-bands .bar { transform-origin: 50% 100%; transform: scaleY(0); }
.motion .chart circle { transform-box: fill-box; transform-origin: center; transform: scale(0); transition: transform 500ms var(--ease-out); transition-delay: calc(var(--i, 0) * 30ms); }
.motion .chart text { opacity: 0; transition: opacity 500ms var(--ease-enter) 500ms; }
.motion .chart.in .bar, .motion .chart.in circle { transform: none; }
.motion .chart.in text { opacity: 1; }

/* Reduced motion: no movement, no zoom — content still fades in so the page keeps its
   rhythm, and counters land on their final value almost immediately. */
@media (prefers-reduced-motion: reduce) {
  .motion [data-reveal], .motion [data-reveal].in { transform: none !important; }
  .motion [data-reveal]:not([data-reveal="clip"]) { opacity: 0; transition: opacity 400ms linear; transition-delay: var(--d, 0s); }
  .motion [data-reveal].in { opacity: 1; }
  .motion [data-reveal="clip"] { clip-path: none !important; }
  .motion .m-reveal img { scale: 1 !important; }
  .motion .chart .bar, .motion .chart circle { transform: none !important; }
}
