/*
 * motion.css - framework-agnostic motion layer (Next today, WordPress later). Pair with motion.js.
 * Only opacity/transform (individual `translate`/`scale` props or `transform`) animate; never layout.
 * Everything animated sits inside prefers-reduced-motion: no-preference, so reduced motion = plain visible content.
 * Hidden-before-reveal state needs html.mo-on (added by motion.js), so no JS / no IntersectionObserver = visible.
 *
 * Attributes:
 *   data-motion-auto            on a section root: motion.js auto-tags its content with data-reveal and arrow CTAs with data-hover="btn"
 *   data-reveal="rise|fade"     element reveals once at ~15% visibility (set by hand or by data-motion-auto)
 *   data-reveal-stagger         on a container: its children reveal in order, 70ms apart
 *   data-hover="lift|lift-sm|btn|nudge"   hover/focus lift (tiles), small lift, button, arrow nudge on a card
 *   data-fx="hero-rise"         load-time rise via GSAP timeline (+ --mo-i = step index)
 *   data-fx="hero-tick"         load-time drop for depth-gauge ticks (+ --mo-i), >=1024px
 *   data-fx="zoom-on-scroll"    scale 1 -> 1 + --motion-zoom across the first screen of its section, >=1024px
 *   data-sticky-header          header that slides in after the hero (gets .is-visible; skipped if absent)
 *   data-hx="nudge|dip|pop"     shared hover hook (space-separated). nudge: [data-hx-target] slides +--hx-x (default 4px);
 *                               pop: [data-hx-target] scales to --hx-scale (default 1.06); dip: the element itself fades
 *                               to --hx-dip (default .7). Per-element overrides are inline custom properties.
 *   data-fx-origin="40% 60%"    transform-origin for that element's zoom/lift (read by motion.js)
 *   data-fx="dot-follow"        journey: a dot rides the wire to the hovered card (cards: data-dot-at, labels: data-depth)
 *   data-fx="confirm"           form: inline thank-you in the input placeholder after submit (data-fx-thanks)
 * Disable one section: remove its data-motion-auto (see docs/MOTION.md).
 */
:root {
  --motion-enter: 650ms;
  --motion-stagger: 70ms;
  --motion-hover: 200ms;
  --motion-press: 120ms;
  --motion-tile: 280ms;
  --motion-faq: 320ms;
  --motion-sticky: 350ms;
  --motion-tick: 500ms;
  --motion-tick-stagger: 60ms;
  --motion-tick-delay: 280ms;
  --motion-rise: 16px;
  --motion-tick-drop: 8px;
  --motion-zoom: .03;
  --motion-icon: 250ms;
  --motion-nudge: 4px;
  --motion-pop: 1.06;
  --motion-dip: .7;
  --motion-dot-glide: 620ms;
  --ease-out: cubic-bezier(.22,1,.36,1);
  --ease-in-out: cubic-bezier(.65,0,.35,1);
}

@keyframes mo-failsafe { to { opacity: 1; } }

@media (prefers-reduced-motion: no-preference) {
  /* hero text is held hidden from first paint (html.mo-pre, set by the tiny inline snippet) so GSAP can animate it
     in without a flash. If GSAP never starts, this failsafe shows it after 3s. motion.js removes mo-pre on start. */
  .mo-pre [data-fx="hero-rise"], .mo-pre [data-fx="hero-tick"] { opacity: 0; animation: mo-failsafe 10ms 3s forwards; }
  /* reveal hidden state: only once motion.js has taken over (html.mo-on); GSAP tweens opacity/y back to natural. */
  .mo-on [data-reveal]:not([data-reveal-in]) { opacity: 0; }

  [data-sticky-header] {
    transform: translateY(-100%);
    transition: transform var(--motion-sticky) var(--ease-out), box-shadow var(--motion-sticky) var(--ease-out);
  }
  [data-sticky-header].is-visible { transform: none; box-shadow: 0 6px 24px rgba(13,27,38,.12); }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  [data-hover="btn"] { transition: transform var(--motion-hover) var(--ease-out); }
  [data-hover="btn"] > img { transition: transform var(--motion-hover) var(--ease-out); }
  [data-hover="btn"]:hover { transform: translateY(-1px); }
  [data-hover="btn"]:active { transform: scale(.985); transition-duration: var(--motion-press); }
  [data-hover="btn"]:hover > img { transform: translateX(3px); }

  [data-hover="lift"] {
    transition: transform var(--motion-tile) var(--ease-out), box-shadow var(--motion-tile) var(--ease-out);
  }
  [data-hover="lift"]:hover, [data-hover="lift"]:focus-within {
    transform: translateY(-3px) scale(1.025);
    box-shadow: 0 20px 35px #02202777;
  }

  [data-hover="lift-sm"] img { transition: transform var(--motion-hover) var(--ease-out); }
  [data-hover="lift-sm"]:hover img { transform: translateY(-2px); }

  [data-hx] [data-hx-target] { transition: transform var(--motion-icon) var(--ease-out); }
  [data-hx~="nudge"]:hover [data-hx-target], [data-hx~="nudge"]:focus-visible [data-hx-target] { transform: translateX(var(--hx-x, var(--motion-nudge))); }
  [data-hx~="pop"]:hover [data-hx-target], [data-hx~="pop"]:focus-visible [data-hx-target] { transform: scale(var(--hx-scale, var(--motion-pop))); }
  /* dip: transition only once a revealed element has finished its GSAP entrance (they would fight over opacity) */
  [data-hx~="dip"]:not([data-reveal]), [data-hx~="dip"][data-reveal-done] { transition: opacity var(--motion-hover) ease-out; }
  [data-hx~="dip"]:hover, [data-hx~="dip"]:focus-visible { opacity: var(--hx-dip, var(--motion-dip)); }

  /* journey: card title underline rises (transparent at rest), depth label warms while its card is active */
  [data-hover="nudge"] h3 {
    text-decoration: underline 1px transparent; text-underline-offset: 10px;
    transition: text-decoration-color var(--motion-hover) var(--ease-out), text-underline-offset var(--motion-hover) var(--ease-out);
  }
  [data-hover="nudge"]:hover h3, [data-hover="nudge"]:focus-within h3 { text-decoration-color: currentColor; text-underline-offset: 6px; }
  [data-depth] { transition: color var(--motion-hover) ease-out; }
  [data-depth][data-active] { color: var(--color-coral-text); }

  [data-hover="nudge"] a > img { transition: transform var(--motion-hover) var(--ease-out); }
  [data-hover="nudge"]:hover a > img, [data-hover="nudge"] a:focus-visible > img { transform: translateX(6px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
