/* ---------- Animation definition ---------- */

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Base animation ---------- */

.fade-up {
  opacity: 0;
  transform: translateY(24px);
}

/* ---------- Trigger: Page Load ---------- */

.animate-load {
  animation: fade-up 0.8s ease-out forwards;
}

/* ---------- Trigger: Scroll ---------- */

.animate-scroll {
  animation: fade-up linear forwards;
  animation-timeline: view();
  animation-range: entry 10% cover 35%;
}

/* ---------- Optional Delays ---------- */

.delay-1 {
  animation-delay: 0.15s;
}
.delay-2 {
  animation-delay: 0.3s;
}
.delay-3 {
  animation-delay: 0.45s;
}

/* ---------- Accessibility ---------- */

@media (prefers-reduced-motion: reduce) {
  .fade-up {
    opacity: 1;
    transform: none;
    animation: none;
  }
}


/*
 * WordPress Image block:
 *
 * <div class="parallax-wrapper">
 *   <figure class="wp-block-image parallax-center parallax-left">
 *     <img src="...">
 *   </figure>
 * </div>
 */
.parallax-wrapper {
  position: relative;
  width: 100%;
  /* min-height: 300px; */
  min-height: 200px;

  overflow: clip;
  contain: paint;
}

.parallax-wrapper > figure {
  position: absolute;
  left: 0;
  top: 50%;

  width: 100%;
  /* height: 150%; */
  height: 100%;
  margin: 0;

  transform: translateY(-50%);
}

@media (max-width: 781px) {
  .parallax-wrapper > figure {
    transform: translateY(-47%);
  }
}

/* Vertical alignment */
.parallax-wrapper > figure.parallax-top {
  top: 0;
  bottom: auto;
  transform: none;
}

.parallax-wrapper > figure.parallax-center {
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
}

.parallax-wrapper > figure.parallax-bottom {
  top: auto;
  bottom: 0;
  transform: none;
}

/* Image */
.parallax-wrapper > figure > img {
  display: block;

  width: 100%;
  height: 100% !important;

  object-fit: cover;
  object-position: center center;

  animation: parallax linear both;
  animation-timeline: view();
  animation-range: entry 0% exit 100%;
}

/* Horizontal focal-point alignment */
.parallax-wrapper > figure.parallax-top > img {
  object-position: top center;
  transform-origin: center 40%;
}

.parallax-wrapper > figure.parallax-bottom > img {
  object-position: bottom center;
  transform-origin: center 50%;
}

.parallax-wrapper > figure.parallax-left > img {
  object-position: left center;
  transform-origin: left center;
}

.parallax-wrapper > figure.parallax-right > img {
  object-position: right center;
  transform-origin: right center;
}

/* Combine horizontal and vertical focal points */
.parallax-wrapper > figure.parallax-top.parallax-left > img {
  object-position: left top;
  transform-origin: left 40%;
}

.parallax-wrapper > figure.parallax-top.parallax-right > img {
  object-position: right top;
  transform-origin: right 40%;
}

.parallax-wrapper > figure.parallax-bottom.parallax-left > img {
  object-position: left bottom;
  transform-origin: left 50%;
}

.parallax-wrapper > figure.parallax-bottom.parallax-right > img {
  object-position: right bottom;
  transform-origin: right 50%;
}

@keyframes parallax {
  from {
    transform: scale(1.15) translate3d(0, -10%, 0);
  }

  to {
    transform: scale(1.15) translate3d(0, 10%, 0);
  }
}
/* 
@media (max-width: 781px) {
  @keyframes parallax {
    from {
      transform: scale(1.2) translate3d(0, -8%, 0);
    }

    to {
      transform: scale(1.2) translate3d(0, 8%, 0);
    }
  }
} */

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .parallax-wrapper > figure > img {
    animation: none;
    transform: none;
  }
}
