/* Motion layer (Phase 5, D-06, D-09, D-10, D-11). No JS animation library. */

/* motion-glideIn copied from reference/motion/keyframes.css (line 78) */
@keyframes motion-glideIn {
  0% { opacity: 0; animation-timing-function: step-end; }
  0.0001% { opacity: var(--comp-opacity, 1); transform: translate(var(--motion-translate-x), var(--motion-translate-y)) rotate(var(--comp-rotate-z, 0deg)); }
  100% { opacity: var(--comp-opacity, 1); transform: translate(0, 0) rotate(var(--comp-rotate-z, 0deg)); }
}

/* Hidden only when JS is available (D-09). */
.js .glide {
  opacity: 0;
}

.glide.is-in {
  animation: motion-glideIn 1200ms 1ms cubic-bezier(0.645, 0.045, 0.355, 1) both;
}

/* Wix draws the rule bars as horizontal elements inside a rotated-wrapper; this theme draws them
   vertical already (3px wide, tall), so their resting rotation here is 0 (review CR-01). */
.glide-rule {
  --motion-translate-x: 0px;
  --motion-translate-y: 80px;
  --comp-rotate-z: 0deg;
}

.glide-panel {
  --motion-translate-x: 0px;
  --motion-translate-y: 120px;
  --comp-rotate-z: 0deg;
}

/* Phone values x 1.21875 (D-06) */
@media (max-width: 767px) {
  .glide-rule {
    --motion-translate-y: 146.25px;
  }

  .glide-panel {
    --motion-translate-y: 78px;
  }
}

/* Background panel drift on scroll (D-10). Unsupported browsers show the static frame. */
@supports (animation-timeline: view()) {
  @keyframes bg-slide-x {
    from { transform: translateX(8%); }
    to { transform: translateX(-8%); }
  }

  @keyframes bg-slide-y {
    from { transform: translateY(20svh); }
    to { transform: translateY(calc(-20% + 40lvh)); }
  }

  .bg-slide {
    animation: bg-slide-x linear both;
    animation-timeline: view();
  }

  @media (max-width: 767px) {
    .bg-slide {
      animation-name: bg-slide-y;
    }

    /* Home 3 angel reveal (261118-ann): measured from the Wix phone recording, the picture drifts up at
       1/5 of the scroll speed while its column crosses the viewport (column 715.4px + one viewport), and
       sits 4.6vw (18px at 390) below the viewport centre when the column is centred. */
    @keyframes angel-drift {
      from { transform: translateY(calc(4.6vw + 10lvh + 71.54px)); }
      to { transform: translateY(calc(4.6vw - 10lvh - 71.54px)); }
    }

    .home-03 .bg-slide {
      view-timeline: --angel block;
    }

    .home-03 .bg-slide img {
      animation: angel-drift linear both;
      animation-timeline: --angel;
    }
  }
}

/* Reduced motion: final state, no scroll animation (D-11, MAIN-05) */
@media (prefers-reduced-motion: reduce) {
  .js .glide,
  .glide.is-in {
    opacity: 1;
    animation: none;
  }

  .bg-slide,
  .home-03 .bg-slide img {
    animation: none;
  }
}
