/*********************
Homepage motion (loaded on the front page only). Behaviour: assets/js/home-motion.js
Own language, distinct from the main Roots Brokerage site: crisp wipe reveals (clip-path),
left-to-right directionality, snappier expo-out easing - no blur, no zoom-settle.
- Hero: video fades/pans in, title wipes in left-to-right, then the search form, header
  and scroll hint slide in from the side.
- On scroll: section titles repeat the wipe; text/cards rise with a slight scale; photos
  open left-to-right instead of bottom-to-top.
Nothing animates for visitors who prefer reduced motion, and content is never hidden without JS.
*********************/
@media (prefers-reduced-motion: no-preference) {
  :root {
    --gh-ease: cubic-bezier(0.22, 1, 0.36, 1);
  }

  /* ---------- hero entrance (CSS only) ---------- */
  .hero .video--wrapper video {
    animation: gh-pan 2.4s var(--gh-ease) both;
  }

  .hero .hero-title {
    animation: gh-wipe 1.1s var(--gh-ease) 0.2s both;
  }

  .hero .search-header > :not(.hero-title) {
    animation: gh-slide 0.9s var(--gh-ease) 0.6s both;
  }

  header .header--content {
    animation: gh-slide-side 0.8s var(--gh-ease) 0.8s both;
  }

  .hero .scrollTo {
    animation: gh-rise 0.8s var(--gh-ease) 1.15s both;
  }

  @keyframes gh-pan {
    from {
      opacity: 0;
      transform: scale(1.04) translateX(-1.5%);
    }
  }

  @keyframes gh-wipe {
    from {
      opacity: 0;
      clip-path: inset(0 100% 0 0);
      transform: translateX(-10px);
    }
  }

  @keyframes gh-slide {
    from {
      opacity: 0;
      transform: translateY(16px) scale(0.98);
    }
  }

  @keyframes gh-slide-side {
    from {
      opacity: 0;
      transform: translateX(18px);
    }
  }

  @keyframes gh-rise {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
  }

  /* ---------- scroll reveals (html.rb-motion is added by home-motion.js) ---------- */
  /* transitions live on the base rule; the hidden look applies only until .is-revealed is added */
  .rb-motion [data-reveal="up"] {
    transition: opacity 0.7s ease var(--rd, 0ms), transform 0.8s var(--gh-ease) var(--rd, 0ms);
  }

  .rb-motion [data-reveal="up"]:not(.is-revealed) {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }

  /* section titles: a left-to-right wipe instead of a blur focus-pull */
  .rb-motion [data-reveal="title"] {
    transition: opacity 0.6s ease var(--rd, 0ms), clip-path 0.75s var(--gh-ease) var(--rd, 0ms), transform 0.75s var(--gh-ease) var(--rd, 0ms);
  }

  .rb-motion [data-reveal="title"]:not(.is-revealed) {
    opacity: 0;
    clip-path: inset(0 100% 0 0);
    transform: translateX(-8px);
  }

  /* photos: curtain opens left-to-right while the image settles, not bottom-up */
  .rb-motion [data-reveal="curtain"] {
    transition: clip-path 0.9s var(--gh-ease) var(--rd, 0ms);
  }

  .rb-motion [data-reveal="curtain"] > * {
    transition: transform 1.2s var(--gh-ease) var(--rd, 0ms);
  }

  .rb-motion [data-reveal="curtain"]:not(.is-revealed) {
    clip-path: inset(0 100% 0 0);
  }

  .rb-motion [data-reveal="curtain"]:not(.is-revealed) > * {
    transform: scale(1.06);
  }

  .rb-motion [data-reveal="fade"] {
    transition: opacity 0.9s ease var(--rd, 0ms), transform 0.9s var(--gh-ease) var(--rd, 0ms);
  }

  .rb-motion [data-reveal="fade"]:not(.is-revealed) {
    opacity: 0;
    transform: scale(0.97);
  }
}

@media print {
  .rb-motion [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    clip-path: none !important;
  }
}
