/*
 * Edit/Build by: Bruce
 * Date: 2026-10-29 09:52
 *
 * Shared motion tokens and scroll reveal. Loaded on every page before all
 * other theme CSS (see doog_enqueue_styles() in functions.php and the
 * page.css <link> in header.php). Values match design/DoogWeb-design.md → Motion.
 * Spec: docs/specs/2026-10-29-motion-standardization.md
 */

/* ── Motion tokens ── */
:root {
  --motion-instant: 80ms;
  --motion-fast:    150ms;
  --motion-base:    250ms;
  --motion-slow:    400ms;
  --motion-crawl:   700ms;
  --ease-precision: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-exit:      cubic-bezier(0.55, 0, 1, 0.45);
}

html { scroll-behavior: smooth; }

/* ── Scroll reveal ──
   Hidden state only applies under <html class="doog-motion">, set in <head>
   by doog_motion_gate() (motion allowed + IntersectionObserver). js/reveal.js
   adds .is-in once each element enters the screen.
   Stagger: --reveal-delay, 80ms steps. */
html.doog-motion .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity   var(--motion-slow) var(--ease-precision) var(--reveal-delay, 0ms),
              transform var(--motion-slow) var(--ease-precision) var(--reveal-delay, 0ms);
}
html.doog-motion .reveal.is-in { opacity: 1; transform: none; }

/* Photos: fade in while the image settles from a slight zoom */
html.doog-motion .reveal-media {
  opacity: 0;
  transition: opacity var(--motion-slow) var(--ease-precision) var(--reveal-delay, 0ms);
}
html.doog-motion .reveal-media img {
  transform: scale(1.04);
  transition: transform var(--motion-slow) var(--ease-precision) var(--reveal-delay, 0ms);
}
html.doog-motion .reveal-media.is-in { opacity: 1; }
html.doog-motion .reveal-media.is-in img { transform: none; }

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

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .reveal,
  .reveal-media,
  .reveal-media img {
    opacity: 1 !important;
    transform: none !important;
  }
}
