/* ============================================================
   ETHRAEON EUDS - Motion: the Parallax Fibonacci Spring
   The estate's canonical motion and rhythm system, merged into
   EUDS. Fibonacci rhythm + spring physics + parallax depth.
   Values reconciled from the live estate token file
   (spring stiffness 180, damping 24, entrance cubic-bezier).
   Reduced-motion is always respected.
   ============================================================ */
:root {
  /* -- Fibonacci rhythm scale (px). The editorial + hero cadence.
        Use alongside the 4px UI grid, not instead of it. -- */
  --phi-1: 4px;
  --phi-2: 8px;
  --phi-3: 13px;
  --phi-4: 21px;
  --phi-5: 34px;
  --phi-6: 55px;
  --phi-7: 89px;
  --phi-8: 144px;
  --phi-9: 233px;
  --phi-ratio: 1.618; /* @kind other */

  /* -- Spring physics (the ETHRAEON spring). -- */
  --spring-stiffness: 180; /* @kind other */
  --spring-damping: 24; /* @kind other */
  /* CSS approximation of the spring for transitions/transforms */
  --spring: cubic-bezier(0.16, 1, 0.3, 1); /* @kind other */
  --spring-soft: cubic-bezier(0.22, 1, 0.36, 1); /* @kind other */
  --spring-tight: cubic-bezier(0.34, 1.12, 0.42, 1); /* @kind other */

  /* -- Durations tuned to the spring -- */
  --motion-instant: 90ms; /* @kind other */
  --motion-fast: 160ms; /* @kind other */
  --motion-base: 260ms; /* @kind other */
  --motion-slow: 420ms; /* @kind other */
  --motion-entrance: 640ms; /* @kind other */

  /* -- Parallax depth scale. Multiply scroll delta by these.
        depth-0 is the pinned plane; higher = further back, slower. -- */
  --parallax-0: 0; /* @kind other */
  --parallax-1: 0.06; /* @kind other */
  --parallax-2: 0.12; /* @kind other */
  --parallax-3: 0.22; /* @kind other */
  --parallax-4: 0.38; /* @kind other */
  --parallax-5: 0.6; /* @kind other */
}

/* -- Spring entrance: base state is the visible end-state; animate FROM hidden.
      Gate on [data-eu-inview] so print/no-JS/reduced-motion show content. -- */
@media (prefers-reduced-motion: no-preference) {
  .eu-rise {
    opacity: 0;
    transform: translateY(var(--phi-4));
    transition: opacity var(--motion-entrance) var(--spring),
                transform var(--motion-entrance) var(--spring);
    will-change: opacity, transform;
  }
  .eu-rise[data-eu-inview] { opacity: 1; transform: none; }

  .eu-spring-press { transition: transform var(--motion-fast) var(--spring-tight); }
  .eu-spring-press:active { transform: scale(0.97); }
}

/* Parallax layers read --parallax-y set by the reference controller (JS). */
.eu-parallax { will-change: transform; }
/* Displacement clamp. The reference controller emits an uncapped --parallax-y
   (-center * depth), which on a long page reaches hundreds of px and drags a
   layer over its neighbours. 48px is the estate's own proven bound, carried
   from the earlier engine's MAX_SHIFT. Keeps every layer inside its region. */
.eu-parallax[data-depth] { transform: translate3d(0, clamp(-48px, var(--parallax-y, 0px), 48px), 0); }

@media (prefers-reduced-motion: reduce) {
  .eu-rise { opacity: 1 !important; transform: none !important; }
  .eu-parallax[data-depth] { transform: none !important; }
}
