/* motion.css — pasangan motion.js. Atur --ease / --dur di :root bila perlu. */
:root { --ease: cubic-bezier(.2,.7,.1,1); --dur: 1s; }

/* Konten hanya disembunyikan untuk dianimasikan bila skrip aktif; tanpa JS semuanya langsung terlihat.
   .motion-ready dipasang motion.js — jika JS/API gagal sebelum itu, konten tidak "hilang". */
@media (scripting: enabled) and (prefers-reduced-motion: no-preference) {
  [data-reveal] { opacity: 0; transform: translateY(40px); transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease); transition-delay: calc(var(--i, 0) * 90ms); }
  [data-reveal="left"] { transform: translateX(-60px); }
  [data-reveal="right"] { transform: translateX(60px); }
  [data-reveal="zoom"] { transform: scale(.92); }
  [data-reveal="mask"] { opacity: 1; transform: none; clip-path: inset(0 0 100% 0); transition: clip-path 1.2s var(--ease); }
  [data-reveal].in { opacity: 1; transform: none; clip-path: inset(0 0 0 0); }
  [data-split] .w > span { transform: translateY(105%); transition: transform 1s var(--ease); transition-delay: calc(var(--i) * 70ms + 100ms); }
  [data-split].in .w > span { transform: none; }
  [data-split][data-reveal] { opacity: 1; transform: none; }
  /* jaring pengaman: tanpa .motion-ready (JS/API gagal atau macet) konten tetap muncul sendiri setelah 4 dtk */
  html:not(.motion-ready) [data-reveal], html:not(.motion-ready) [data-split] .w > span { animation: mo-failsafe .6s 4s var(--ease) forwards; }
  [data-magnetic] { transition: translate .35s var(--ease); }
}
[data-split] .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; }
[data-split] .w > span { display: inline-block; }

/* ---------- animasi berbasis scroll native (CSS scroll-driven); JS di motion.js hanya fallback ---------- */
@supports ((animation-timeline: view()) and (animation-range: entry)) {
  @media (prefers-reduced-motion: no-preference) {
    /* parallax: faktor dari data-parallax -> --par */
    [data-parallax] { animation: mo-parallax linear both; animation-timeline: view(); animation-range: cover; }
    /* garis progres (mis. timeline): --p dipakai sebagai scale */
    [data-progress] { view-timeline: --mo-progress block; }
    [data-progress] .tl-line::after { animation: mo-grow-y linear both; animation-timeline: --mo-progress; animation-range: entry 40% exit 60%; }
  }
}
@keyframes mo-failsafe { to { opacity: 1; transform: none; clip-path: inset(0 0 0 0); } }
@keyframes mo-parallax { from { translate: 0 calc(var(--par, 0) * 45vh); } to { translate: 0 calc(var(--par, 0) * -45vh); } }
@keyframes mo-grow-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* header berubah solid setelah 40px scroll */
@supports ((animation-timeline: scroll()) and (animation-range: 0% 100%)) {
  [data-nav] { animation: mo-nav-solid linear both; animation-timeline: scroll(block root); animation-range: 0px 40px; }
}
@keyframes mo-nav-solid { to { background: rgba(3, 36, 22, .86); box-shadow: 0 1px 0 rgba(179,241,215,.12); padding-block: 12px; backdrop-filter: blur(14px); } }

/* ---------- jeda gerak (tombol) & reduced motion: hanya GERAK yang dimatikan, transisi warna tetap ---------- */
html.motion-paused *, html.motion-paused *::before, html.motion-paused *::after { animation-play-state: paused !important; }
html.motion-paused [data-parallax] { animation: none; translate: none !important; }
@media (prefers-reduced-motion: reduce) {
  [data-parallax] { translate: none !important; }
  .marquee *, .pin::after, .route path { animation: none !important; }
}

/* animasi reveal dari samping (translateX) tidak boleh membuat halaman bisa digeser horizontal di HP */
html, body { overflow-x: clip; }
