/* ============================================================
   MOTION - reveals, entrance, keyframes, reduced-motion
   ============================================================ */

/* --- Scroll reveals (only when JS is present) --- */
html.js [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition: opacity var(--d-slow) var(--e-out), transform 1.5s var(--e-soft);
  transition-delay: var(--delay, 0ms);
  will-change: opacity, transform;
}
html.js [data-reveal="blur"] {
  transform: none;
  filter: blur(10px);
  transition: opacity 1.3s var(--e-out), filter 1.5s var(--e-out);
}
html.js [data-reveal="scale"] { transform: scale(0.96) translate3d(0, 18px, 0); }
/* The mask lives on the child: a clip-path on the observed element itself
   would make IntersectionObserver see an empty box and never fire. */
html.js [data-reveal="mask"] { opacity: 1; transform: none; will-change: auto; }
html.js [data-reveal="mask"] > * {
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1.5s var(--e-soft);
}
html.js [data-reveal="mask"].is-in > * { clip-path: inset(0 0 0 0); }
html.js [data-reveal="stagger"] { opacity: 1; transform: none; will-change: auto; }
html.js [data-reveal="stagger"] > * {
  opacity: 0;
  transform: translate3d(0, 22px, 0);
  transition: opacity 1s var(--e-out), transform 1.3s var(--e-soft);
}
html.js [data-reveal].is-in { opacity: 1; transform: none; filter: none; clip-path: inset(0 0 0 0); will-change: auto; }
html.js [data-reveal="stagger"].is-in > * { opacity: 1; transform: none; transition-delay: calc(var(--i, 0) * 120ms); }

/* --- Hero entrance (after the veil lifts) --- */
html.js:not(.is-ready) .hero__content > * { opacity: 0; }
.hero__arch path { stroke-dasharray: 1; stroke-dashoffset: 1; }
.hero__arch .arch-fill, .hero__arch .arch-finial { stroke-dasharray: none; stroke-dashoffset: 0; opacity: 0; }
html.no-js .hero__arch path { stroke-dashoffset: 0; }
html.no-js .hero__arch .arch-fill, html.no-js .hero__arch .arch-finial { opacity: 1; }
html.is-ready .hero__arch .arch-outer { animation: draw 3s var(--e-in-out) forwards; }
html.is-ready .hero__arch .arch-inner { animation: draw 3s var(--e-in-out) 0.5s forwards; }
html.is-ready .hero__arch .arch-fill { animation: fade 2.4s var(--e-out) 1.4s forwards; }
html.is-ready .hero__arch .arch-finial { animation: fade 1.2s var(--e-out) 2.4s forwards; }
html.is-ready .hero__kicker { animation: rise 1.3s var(--e-out) 0.5s forwards; }
html.is-ready .hero__name   { animation: focus 1.8s var(--e-out) 0.85s forwards; }
html.is-ready .hero__sub    { animation: rise 1.3s var(--e-out) 1.5s forwards; }
html.is-ready .hero__orn    { animation: fade 1.4s var(--e-out) 2s forwards; }
html.is-ready .hero__cue    { animation: fade 1.4s var(--e-out) 2.6s forwards; }
html.js:not(.is-ready) .hero__cue { opacity: 0; }

/* --- Keyframes --- */
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}
@keyframes focus {
  from { opacity: 0; filter: blur(12px) drop-shadow(0 0 28px rgba(200, 167, 93, 0.18)); transform: translateY(10px); }
  to   { opacity: 1; filter: blur(0) drop-shadow(0 0 28px rgba(200, 167, 93, 0.18)); transform: none; }
}
@keyframes breathe {
  from { opacity: 0.7; transform: translate(-50%, -50%) scale(0.94); }
  to   { opacity: 1;   transform: translate(-50%, -50%) scale(1.08); }
}
@keyframes breathe-soft { from { opacity: 0.32; } to { opacity: 0.6; } }
@keyframes turn { to { transform: translateX(-50%) rotate(360deg); } }
@keyframes cue { 0% { top: -40%; } 100% { top: 110%; } }

/* --- Reduced motion: calm, static, complete --- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body { transition: none; }
  html.js [data-reveal], html.js [data-reveal="stagger"] > * {
    opacity: 1 !important; transform: none !important; filter: none !important; clip-path: none !important; transition: none !important;
  }
  html.js .hero__content > *, html.js .hero__cue { opacity: 1 !important; animation: none !important; }
  .hero__arch path { stroke-dashoffset: 0 !important; animation: none !important; }
  .hero__arch .arch-fill, .hero__arch .arch-finial { opacity: 1 !important; animation: none !important; }
  .hero__glow, .hero__rosette, .hero__cue::after, .closing__arch { animation: none !important; }
  .veil { transition: none; }
  .veil__star .draw { animation: none; stroke-dashoffset: 0; }
  .stack__card { transform: none !important; opacity: 1 !important; }
  .wheel svg { transition: none; }
  .tl__line { transform: scaleY(1); }
  .site-head, .drawer, .drawer__list a, .chapters a::before, .chapters a span { transition: none; }
}
