:root {
  --motion-progress: 0;
  --motion-parallax-y: 0px;
  --motion-tilt-x: 0deg;
  --motion-tilt-y: 0deg;
  --motion-stagger: 0;
  --motion-ease-out: cubic-bezier(0.2, 0.78, 0.18, 1);
}

/* JavaScript is an enhancement: reveal-marked content remains readable without it. */
html:not(.motion-ready) [data-reveal] {
  opacity: 1 !important;
  filter: none !important;
  clip-path: none !important;
  transform: none !important;
}

[data-motion-hero-part] {
  backface-visibility: hidden;
  animation-duration: 820ms;
  animation-fill-mode: both;
  animation-timing-function: var(--motion-ease-out);
}

[data-motion-order="1"] { animation-delay: 80ms; }
[data-motion-order="2"] { animation-delay: 180ms; }
[data-motion-order="3"] { animation-delay: 340ms; }
[data-motion-order="4"] { animation-delay: 520ms; }
[data-motion-order="5"] { animation-delay: 720ms; }

.motion-ready [data-reveal] {
  transition-delay: calc(var(--motion-stagger) * 75ms) !important;
}

.motion-ready [data-reveal]:not([data-visible]) {
  opacity: 0;
}

[data-motion-parallax] {
  translate: 0 var(--motion-parallax-y);
  will-change: translate;
}

img[data-motion-parallax] {
  scale: 1.045;
}

[data-motion-tilt] {
  --motion-lift: 0px;
  backface-visibility: hidden;
  transform-style: preserve-3d;
  transition: transform 260ms var(--motion-ease-out), box-shadow 260ms ease, filter 260ms ease !important;
  will-change: transform;
}

.motion-progress {
  position: fixed;
  z-index: 120;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.16);
  pointer-events: none;
}

.motion-progress__bar {
  display: block;
  width: 100%;
  height: 100%;
  background: currentColor;
  transform: scaleX(var(--motion-progress));
  transform-origin: left center;
  transition: transform 80ms linear;
}

.motion-progress__value {
  position: fixed;
  top: 12px;
  right: 14px;
  padding: 3px 6px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font: 700 9px/1 "Courier New", monospace;
  letter-spacing: 0.08em;
}

/* Gallery: editorial sheets arrive in a measured vertical rhythm. */
body[data-motion-theme="gallery"] [data-motion-hero-part] {
  animation-name: motion-gallery-arrive;
}

body[data-motion-theme="gallery"] .motion-progress {
  color: #ff5c35;
}

body[data-motion-theme="gallery"] .motion-ready [data-reveal],
body[data-motion-theme="gallery"] [data-reveal] {
  transition: opacity 680ms ease, transform 680ms var(--motion-ease-out);
}

html.motion-ready body[data-motion-theme="gallery"] [data-reveal]:not([data-visible]) {
  transform: translateY(28px);
}

body[data-motion-theme="gallery"] [data-reveal][data-visible] {
  transform: none;
}

body[data-motion-theme="gallery"] [data-motion-tilt]:not([data-reveal]),
body[data-motion-theme="gallery"] [data-motion-tilt][data-visible] {
  transform: perspective(1000px) rotateX(var(--motion-tilt-x)) rotateY(var(--motion-tilt-y)) translateY(var(--motion-lift));
}

body[data-motion-theme="gallery"] [data-motion-tilt]:hover {
  --motion-lift: -5px;
}

@keyframes motion-gallery-arrive {
  from { opacity: 0; translate: 0 26px; clip-path: inset(0 0 100%); }
  to { opacity: 1; translate: 0 0; clip-path: inset(0); }
}

/* KUON: slow, architectural settling with almost no bounce. */
body[data-motion-theme="kuon"] [data-motion-hero-part] {
  animation-name: motion-kuon-settle;
  animation-duration: 1080ms;
}

body[data-motion-theme="kuon"] .motion-progress {
  top: 0;
  right: 0;
  bottom: 0;
  left: auto;
  width: 3px;
  height: auto;
  color: #6d7368;
  background: rgba(233, 230, 223, 0.28);
}

body[data-motion-theme="kuon"] .motion-progress__bar {
  transform: scaleY(var(--motion-progress));
  transform-origin: center top;
}

body[data-motion-theme="kuon"] .motion-progress__value {
  top: auto;
  right: 12px;
  bottom: 12px;
  background: rgba(36, 38, 33, 0.78);
}

body[data-motion-theme="kuon"] [data-motion-tilt]:not([data-reveal]),
body[data-motion-theme="kuon"] [data-motion-tilt][data-visible] {
  transform: perspective(1200px) rotateX(var(--motion-tilt-x)) rotateY(var(--motion-tilt-y)) translateY(var(--motion-lift));
}

body[data-motion-theme="kuon"] [data-motion-tilt]:hover {
  --motion-lift: -3px;
  filter: saturate(0.88) contrast(1.03);
}

@keyframes motion-kuon-settle {
  from { opacity: 0; translate: 0 18px; filter: blur(2px); }
  to { opacity: 1; translate: 0 0; filter: blur(0); }
}

/* PICO: elastic pop and tactile lift. */
body[data-motion-theme="pico"] [data-motion-hero-part] {
  animation-name: motion-pico-pop;
  animation-duration: 700ms;
  animation-timing-function: cubic-bezier(0.18, 0.9, 0.28, 1.18);
}

body[data-motion-theme="pico"] .motion-progress {
  top: auto;
  bottom: 0;
  height: 8px;
  border-top: 2px solid #171813;
  color: #1957e7;
  background: #f7db29;
}

body[data-motion-theme="pico"] .motion-progress__value {
  top: auto;
  right: 10px;
  bottom: 13px;
  border: 2px solid #171813;
  border-radius: 20px;
  background: #fff4df;
  color: #171813;
}

body[data-motion-theme="pico"] [data-motion-tilt]:not([data-reveal]),
body[data-motion-theme="pico"] [data-motion-tilt][data-visible] {
  transform: perspective(850px) rotateX(var(--motion-tilt-x)) rotateY(var(--motion-tilt-y)) translateY(var(--motion-lift));
}

body[data-motion-theme="pico"] [data-motion-tilt]:hover {
  --motion-lift: -9px;
  box-shadow: 9px 10px 0 #171813;
}

@keyframes motion-pico-pop {
  0% { opacity: 0; scale: 0.78; rotate: -3deg; }
  72% { opacity: 1; scale: 1.045; rotate: 1deg; }
  100% { opacity: 1; scale: 1; rotate: 0deg; }
}

/* MIZUBE: elements surface through blur like light under water. */
body[data-motion-theme="mizube"] [data-motion-hero-part] {
  animation-name: motion-mizube-emerge;
  animation-duration: 1240ms;
}

body[data-motion-theme="mizube"] .motion-progress {
  top: 0;
  right: auto;
  bottom: 0;
  left: 0;
  width: 2px;
  height: auto;
  color: #45f1f4;
  background: rgba(69, 241, 244, 0.12);
  box-shadow: 0 0 16px rgba(69, 241, 244, 0.35);
}

body[data-motion-theme="mizube"] .motion-progress__bar {
  transform: scaleY(var(--motion-progress));
  transform-origin: center top;
  box-shadow: 0 0 14px currentColor;
}

body[data-motion-theme="mizube"] .motion-progress__value {
  background: rgba(3, 7, 17, 0.76);
  color: #45f1f4;
}

body[data-motion-theme="mizube"] [data-motion-tilt]:not([data-reveal]),
body[data-motion-theme="mizube"] [data-motion-tilt][data-visible] {
  transform: perspective(1200px) rotateX(var(--motion-tilt-x)) rotateY(var(--motion-tilt-y)) translateY(var(--motion-lift));
}

body[data-motion-theme="mizube"] [data-motion-tilt]:hover {
  --motion-lift: -4px;
  box-shadow: inset 0 0 35px rgba(69, 241, 244, 0.07), 0 12px 38px rgba(0, 0, 0, 0.22);
}

@keyframes motion-mizube-emerge {
  from { opacity: 0; translate: 0 22px; filter: blur(12px) brightness(1.5); }
  to { opacity: 1; translate: 0 0; filter: blur(0) brightness(1); }
}

/* NOA: horizontal signal acquisition and live telemetry. */
body[data-motion-theme="noa"] [data-motion-hero-part] {
  animation-name: motion-noa-signal;
  animation-duration: 760ms;
}

body[data-motion-theme="noa"] .motion-progress {
  height: 3px;
  color: #c7ff5e;
  background: rgba(116, 101, 255, 0.22);
  box-shadow: 0 0 18px rgba(199, 255, 94, 0.25);
}

body[data-motion-theme="noa"] .motion-progress__value {
  border: 1px solid rgba(199, 255, 94, 0.45);
  border-radius: 3px;
  background: rgba(5, 5, 10, 0.84);
  color: #c7ff5e;
}

body[data-motion-theme="noa"] [data-motion-tilt]:not([data-reveal]),
body[data-motion-theme="noa"] [data-motion-tilt][data-visible] {
  transform: perspective(1050px) rotateX(var(--motion-tilt-x)) rotateY(var(--motion-tilt-y)) translateY(var(--motion-lift));
}

body[data-motion-theme="noa"] [data-motion-tilt]:hover {
  --motion-lift: -5px;
  box-shadow: 0 24px 70px rgba(83, 56, 255, 0.24), inset 0 0 30px rgba(199, 255, 94, 0.035);
}

@keyframes motion-noa-signal {
  0% { opacity: 0; translate: -24px 0; filter: brightness(2.2) saturate(1.4); clip-path: inset(0 100% 0 0); }
  55% { opacity: 1; clip-path: inset(0); }
  100% { opacity: 1; translate: 0 0; filter: brightness(1) saturate(1); clip-path: inset(0); }
}

/* SUI: soft flotation, never a sharp snap. */
body[data-motion-theme="sui"] [data-motion-hero-part] {
  animation-name: motion-sui-float;
  animation-duration: 1180ms;
}

body[data-motion-theme="sui"] .motion-progress {
  top: 18%;
  right: 10px;
  bottom: 18%;
  left: auto;
  width: 2px;
  height: auto;
  border-radius: 99px;
  color: #69745d;
  background: rgba(105, 116, 93, 0.16);
}

body[data-motion-theme="sui"] .motion-progress__bar {
  border-radius: inherit;
  transform: scaleY(var(--motion-progress));
  transform-origin: center top;
}

body[data-motion-theme="sui"] .motion-progress__value {
  background: rgba(53, 66, 56, 0.82);
  color: #f4efe7;
}

body[data-motion-theme="sui"] [data-motion-tilt]:not([data-reveal]),
body[data-motion-theme="sui"] [data-motion-tilt][data-visible] {
  transform: perspective(1300px) rotateX(var(--motion-tilt-x)) rotateY(var(--motion-tilt-y)) translateY(var(--motion-lift));
}

body[data-motion-theme="sui"] [data-motion-tilt]:hover {
  --motion-lift: -5px;
  box-shadow: 0 26px 65px rgba(53, 66, 56, 0.12);
}

@keyframes motion-sui-float {
  from { opacity: 0; translate: 0 24px; filter: blur(5px); }
  to { opacity: 1; translate: 0 0; filter: blur(0); }
}

/* NEON TIDE: fast cuts and controlled glitch, then a stable endpoint. */
body[data-motion-theme="neon-tide"] [data-motion-hero-part] {
  animation-name: motion-neon-glitch;
  animation-duration: 620ms;
  animation-timing-function: steps(6, end);
}

body[data-motion-theme="neon-tide"] .motion-progress {
  height: 7px;
  border-bottom: 2px solid #090909;
  color: #dfff00;
  background: #ff36cc;
}

body[data-motion-theme="neon-tide"] .motion-progress__value {
  top: 14px;
  border: 2px solid #090909;
  background: #dfff00;
  color: #090909;
  box-shadow: 3px 3px 0 #ff36cc;
}

body[data-motion-theme="neon-tide"] [data-motion-tilt]:not([data-reveal]),
body[data-motion-theme="neon-tide"] [data-motion-tilt][data-visible] {
  transform: perspective(780px) rotateX(var(--motion-tilt-x)) rotateY(var(--motion-tilt-y)) translateY(var(--motion-lift));
}

body[data-motion-theme="neon-tide"] [data-motion-tilt]:hover {
  --motion-lift: -7px;
  filter: saturate(1.18) contrast(1.04);
  box-shadow: 10px 10px 0 #090909;
}

@keyframes motion-neon-glitch {
  0% { opacity: 0; translate: -28px 0; clip-path: inset(0 100% 0 0); filter: hue-rotate(70deg); }
  35% { opacity: 1; translate: 12px 0; clip-path: inset(12% 0 48% 0); }
  58% { translate: -7px 0; clip-path: inset(56% 0 8% 0); }
  78% { translate: 3px 0; clip-path: inset(0); }
  100% { opacity: 1; translate: 0 0; clip-path: inset(0); filter: none; }
}

@media (hover: hover) and (pointer: fine) {
  [data-motion-tilt] { cursor: default; }
}

@media (max-width: 700px) {
  .motion-progress__value { display: none; }
  [data-motion-parallax] { will-change: auto; }
}

@media (prefers-reduced-motion: reduce) {
  [data-motion-hero-part] {
    opacity: 1 !important;
    animation: none !important;
    translate: none !important;
    scale: 1 !important;
    rotate: 0deg !important;
    filter: none !important;
    clip-path: none !important;
  }

  html.motion-ready [data-reveal],
  html.motion-ready [data-reveal]:not([data-visible]) {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    clip-path: none !important;
    transition: none !important;
  }

  [data-motion-parallax] {
    translate: none !important;
    scale: 1 !important;
    will-change: auto !important;
  }

  [data-motion-tilt] {
    transform: none !important;
    filter: none !important;
    box-shadow: none !important;
    transition: none !important;
    will-change: auto !important;
  }

  .motion-progress__bar { transition: none; }
}
