/* ==========================================================================
   Avatar Motion v1 — shared motion and polish layer for every client site.
   Pairs with avatar-motion.js. Load after the site's own stylesheet.

   Safety: nothing is hidden until JS proves it can animate. The .am-on class
   is set on <html> by avatar-motion.js before paint, and a failsafe in the
   script removes it if anything goes wrong, so content can never be stranded
   invisible. Without JS, or with reduced motion, every rule here is inert.
   ========================================================================== */

:root {
  --am-ease: cubic-bezier(.22, 1, .36, 1);
  --am-dur: .8s;
  --am-rise: 26px;
}

/* --- Reveal primitives -------------------------------------------------- */
/* Only applied once JS is live (.am-on) and motion is allowed. */
.am-on [data-am-reveal]:not(.am-shown) {
  opacity: 0;
  will-change: opacity, transform;
}
.am-on [data-am-reveal="up"]:not(.am-shown),
.am-on [data-am-reveal=""]:not(.am-shown) { transform: translate3d(0, var(--am-rise), 0); }
.am-on [data-am-reveal="down"]:not(.am-shown) { transform: translate3d(0, calc(var(--am-rise) * -1), 0); }
.am-on [data-am-reveal="left"]:not(.am-shown) { transform: translate3d(calc(var(--am-rise) * -1.4), 0, 0); }
.am-on [data-am-reveal="right"]:not(.am-shown) { transform: translate3d(calc(var(--am-rise) * 1.4), 0, 0); }
.am-on [data-am-reveal="scale"]:not(.am-shown) { transform: scale(.94); }
.am-on [data-am-reveal="blur"]:not(.am-shown) { filter: blur(14px); transform: translate3d(0, 16px, 0); }
.am-on [data-am-reveal="mask"]:not(.am-shown) { clip-path: inset(0 0 100% 0); transform: translate3d(0, 12px, 0); }

/* Element is released from will-change once it has played. */
.am-shown { will-change: auto; }

/* Parallax elements own their transform via a scroll linked animation, so
   their reveal is a plain CSS fade instead of a Motion animation (a Motion
   reveal on the same element stalls at opacity 0). Lifting the hidden state
   by adding .am-shown lets these transitions play. */
.am-on [data-am-parallax][data-am-reveal]:not(.am-shown) { transform: none; }
[data-am-parallax][data-am-reveal] {
  transition: opacity .8s var(--am-ease), filter .8s var(--am-ease), clip-path .8s var(--am-ease);
}

/* --- Split text --------------------------------------------------------- */
.am-line { display: block; overflow: hidden; }
.am-word { display: inline-block; white-space: pre; }
.am-on .am-split:not(.am-shown) .am-word { opacity: 0; transform: translate3d(0, 100%, 0); }

/* --- Marquee ------------------------------------------------------------ */
[data-am-marquee] { display: flex; overflow: hidden; width: 100%; }
[data-am-marquee] > * { flex: 0 0 auto; display: flex; gap: inherit; }
[data-am-marquee] .am-marquee-track { display: flex; gap: inherit; will-change: transform; }

/* --- Scroll progress ---------------------------------------------------- */
.am-progress {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 9999;
  transform-origin: 0 50%; transform: scaleX(0);
  background: currentColor; opacity: .85; pointer-events: none;
}

/* --- Hover polish ------------------------------------------------------- */
[data-am-tilt] { transform-style: preserve-3d; transition: box-shadow .4s var(--am-ease); }
[data-am-magnetic] { display: inline-flex; will-change: transform; }

/* Image zoom on hover for any wrapper marked up for it. */
[data-am-zoom] { overflow: hidden; }
[data-am-zoom] img { transition: transform .9s var(--am-ease); transform-origin: center; }
@media (hover: hover) {
  [data-am-zoom]:hover img { transform: scale(1.06); }
}

/* --- Site polish applied everywhere ------------------------------------- */
html { scroll-behavior: smooth; }
/* Lenis drives scrolling itself, so hand control over when it is active. */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

/* Keyboard focus that is visible on light and dark grounds. */
:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 2px;
}

img { -webkit-user-drag: none; }

/* --- Reduced motion: everything resolves instantly ---------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .am-on [data-am-reveal]:not(.am-shown),
  .am-on .am-split:not(.am-shown) .am-word {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    clip-path: none !important;
  }
  [data-am-marquee] .am-marquee-track { transform: none !important; }
  [data-am-zoom] img { transition: none; }
}
