/* ==========================================================================
   Natural Awakenings — Motion System
   ONE documented child-theme snippet (per ELE-005). Everything else is native
   Elementor controls the client can edit in wp-admin.

   Design contract:
   - Only `transform` and `opacity` animate. Never width/height/top/left/margin,
     so no animation can create layout shift (ANIM-002, CWV-004).
   - Durations 150-600ms, ease-out. Purposeful, not decorative filler (ANIM-003).
   - A single `prefers-reduced-motion` block disables the entire system (ANIM-001).
   - No JS animation library, no parallax script, no Lottie (ANIM-004, PERF).
     Scroll reveal uses native CSS `animation-timeline: view()` where supported
     and degrades to "already visible" everywhere else.
   ========================================================================== */

:root {
  --na-dur-fast: 150ms;
  --na-dur-base: 250ms;
  --na-dur-slow: 450ms;
  --na-dur-reveal: 600ms;
  --na-ease: cubic-bezier(0.22, 0.61, 0.36, 1);      /* ease-out quad */
  --na-ease-soft: cubic-bezier(0.33, 1, 0.68, 1);    /* ease-out cubic */
  --na-lift: -4px;
}

/* --------------------------------------------------------------------------
   1. Scroll reveal — CSS-only, progressive enhancement.
   Applied via an Elementor CSS class on any section/container: `na-reveal`.
   Variants: na-reveal--up (default), --left, --right, --scale.
   -------------------------------------------------------------------------- */
/* Scroll reveal is driven by the IntersectionObserver in na-motion-apply.php
   (same contract as .na-sec-reveal/.na-card-reveal): hidden only under
   `html.na-io`, revealed by `.na-in`, with a 2500ms safety reveal-all and a
   forced-visible state under prefers-reduced-motion. The native
   `animation-timeline: view()` scrub was REMOVED here for the identical reason
   it was removed there: with `animation-range: ... cover 28%`, any element in
   the final screenful can never scroll far enough to complete its range and
   froze at the start keyframe (opacity:0) forever — the mid/bottom sections
   vanished. Because reveal now requires `html.na-io` (added by JS only when
   motion is allowed), a JS failure leaves all content fully visible. */
/* Every selector below is self-sufficient: a container in the Elementor build
   may carry ONLY a variant class (e.g. `na-reveal--right`) without the base
   `na-reveal`, so the hidden state, the per-variant transform and the revealed
   state each list the variants explicitly. Otherwise a variant-only element
   would keep its offset transform forever (that shift caused an 8px horizontal
   overflow on mobile from the practitioner card). */
html.na-io .na-reveal,
html.na-io .na-reveal--left,
html.na-io .na-reveal--right,
html.na-io .na-reveal--scale,
html.na-io .na-stagger > * {
  opacity: 0;
  transform: translate3d(0, 24px, 0);
  transition:
    opacity var(--na-dur-reveal) var(--na-ease-soft),
    transform var(--na-dur-reveal) var(--na-ease-soft);
}
html.na-io .na-reveal--left  { transform: translate3d(-28px, 0, 0); }
html.na-io .na-reveal--right { transform: translate3d(28px, 0, 0); }
html.na-io .na-reveal--scale { transform: scale3d(0.94, 0.94, 1); }
html.na-io .na-reveal.na-in,
html.na-io .na-reveal--left.na-in,
html.na-io .na-reveal--right.na-in,
html.na-io .na-reveal--scale.na-in,
html.na-io .na-stagger > *.na-in {
  opacity: 1;
  transform: none;
}

@keyframes na-reveal-up {
  from { opacity: 0; transform: translate3d(0, 24px, 0); }
  to   { opacity: 1; transform: none; }
}
@keyframes na-reveal-left {
  from { opacity: 0; transform: translate3d(-28px, 0, 0); }
  to   { opacity: 1; transform: none; }
}
@keyframes na-reveal-right {
  from { opacity: 0; transform: translate3d(28px, 0, 0); }
  to   { opacity: 1; transform: none; }
}
@keyframes na-reveal-scale {
  from { opacity: 0; transform: scale3d(0.94, 0.94, 1); }
  to   { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   2. Hover / focus micro-interaction — class `na-lift`.
   Cards, article tiles, directory listings. Shadow + translate only.
   -------------------------------------------------------------------------- */
.na-lift {
  transition:
    transform var(--na-dur-base) var(--na-ease),
    box-shadow var(--na-dur-base) var(--na-ease);
  will-change: transform;
}
.na-lift:hover,
.na-lift:focus-within {
  transform: translate3d(0, var(--na-lift), 0);
}

/* Image zoom inside a card, contained so nothing overflows the layout box. */
.na-zoom { overflow: hidden; }
.na-zoom img {
  transition: transform var(--na-dur-slow) var(--na-ease-soft);
  will-change: transform;
}
.na-zoom:hover img,
.na-zoom:focus-within img { transform: scale(1.06); }

/* --------------------------------------------------------------------------
   3. Underline sweep for editorial links — class `na-underline`.
   Uses a pseudo-element scaled on the X axis, so no reflow.
   -------------------------------------------------------------------------- */
.na-underline { position: relative; text-decoration: none; }
.na-underline::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--na-dur-base) var(--na-ease);
}
.na-underline:hover::after,
.na-underline:focus-visible::after { transform: scaleX(1); }

/* --------------------------------------------------------------------------
   4. Focus visibility — never removed by any motion state (A11Y).
   -------------------------------------------------------------------------- */
.na-lift:focus-visible,
.na-underline:focus-visible,
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--na-focus, currentColor);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   5. Reduced motion — the whole system off in one block (ANIM-001).
   Content is fully visible and fully usable with zero motion.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .na-reveal,
  .na-stagger > * {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .na-lift,
  .na-zoom img,
  .na-underline::after {
    transition: none !important;
  }
  .na-lift:hover,
  .na-lift:focus-within { transform: none !important; }
  .na-zoom:hover img,
  .na-zoom:focus-within img { transform: none !important; }
  .na-underline::after { transform: scaleX(1); }

  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   6. Print + capture safety.
   Scroll-driven animations resolve against a scrollport. In print — and in a
   full-page screenshot — there is no scroll, so anything mid-range would render
   at its `from` state (invisible). Force the rest state.
   -------------------------------------------------------------------------- */
@media print {
  .na-reveal, .na-reveal--left, .na-reveal--right, .na-reveal--scale,
  .na-stagger > * {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .na-marquee__track { animation: none !important; transform: none !important; }
}
