.site-intro {
  --intro-duration: 1450ms;
  --intro-impact-x: clamp(3.1rem, 15.5vw, 14rem);
  --intro-impact-y: clamp(3.25rem, 16vh, 10.5rem);
  position: fixed;
  z-index: 30;
  inset: 0;
  isolation: isolate;
  overflow: hidden;
  pointer-events: none;
}

.site-intro[hidden] {
  display: none;
}

.site-intro:not([hidden]) {
  animation: site-intro-finish var(--intro-duration) linear both;
}

.site-intro::before,
.site-intro::after {
  position: absolute;
  inset: 0;
  content: "";
}

.site-intro::before {
  background:
    radial-gradient(ellipse at 48% 42%, #fff8e9 8%, transparent 72%),
    linear-gradient(145deg, #fce7ba 0%, #f8d08d 56%, #e9944a 100%);
  animation: site-intro-backdrop var(--intro-duration) ease-out both;
}

.site-intro::after {
  z-index: 2;
  background: radial-gradient(ellipse at center, #fff8df88 0%, #fff4c83b 37%, transparent 70%);
  animation: site-intro-contact var(--intro-duration) ease-out both;
}

.site-intro-scoop {
  position: absolute;
  z-index: 1;
  inset: 50% auto auto 50%;
  width: clamp(9rem, 49vmin, 29rem);
  aspect-ratio: 1;
  background: url("assets/intro-scoops.webp") no-repeat;
  background-size: 200% 200%;
  animation: site-intro-scoop var(--intro-duration) both;
}

.site-intro-scoop:nth-child(1) {
  --scoop-x: -1;
  --scoop-y: -1;
  --scoop-start-tilt: -29deg;
  --scoop-contact-tilt: -8deg;
  --scoop-exit-tilt: -23deg;
  background-position: left top;
}

.site-intro-scoop:nth-child(2) {
  --scoop-x: 1;
  --scoop-y: -1;
  --scoop-start-tilt: 24deg;
  --scoop-contact-tilt: 6deg;
  --scoop-exit-tilt: 20deg;
  background-position: right top;
}

.site-intro-scoop:nth-child(3) {
  --scoop-x: -1;
  --scoop-y: 1;
  --scoop-start-tilt: 23deg;
  --scoop-contact-tilt: 9deg;
  --scoop-exit-tilt: 19deg;
  background-position: left bottom;
}

.site-intro-scoop:nth-child(4) {
  --scoop-x: 1;
  --scoop-y: 1;
  --scoop-start-tilt: -28deg;
  --scoop-contact-tilt: -7deg;
  --scoop-exit-tilt: -20deg;
  background-position: right bottom;
}

@keyframes site-intro-scoop {
  0% {
    opacity: 0;
    transform:
      translate3d(calc(-50% + 54vw * var(--scoop-x)), calc(-50% + 57vh * var(--scoop-y)), 0)
      rotate(var(--scoop-start-tilt)) scale(.28);
    animation-timing-function: cubic-bezier(.42, .02, .65, .55);
  }

  19% { opacity: 1; }

  43% {
    transform:
      translate3d(
        calc(-50% + var(--intro-impact-x) * var(--scoop-x)),
        calc(-50% + var(--intro-impact-y) * var(--scoop-y)),
        0
      )
      rotate(var(--scoop-contact-tilt)) scale(1.17);
    animation-timing-function: cubic-bezier(.18, .72, .31, 1);
  }

  50% {
    transform:
      translate3d(
        calc(-50% + var(--intro-impact-x) * var(--scoop-x)),
        calc(-50% + var(--intro-impact-y) * var(--scoop-y)),
        0
      )
      rotate(var(--scoop-contact-tilt)) scale(1.29, .96);
    animation-timing-function: cubic-bezier(.16, .66, .32, 1);
  }

  59% {
    transform:
      translate3d(
        calc(-50% + var(--intro-impact-x) * var(--scoop-x)),
        calc(-50% + var(--intro-impact-y) * var(--scoop-y)),
        0
      )
      rotate(var(--scoop-contact-tilt)) scale(1.18);
    animation-timing-function: cubic-bezier(.42, .02, .58, .95);
  }

  79% { opacity: 1; }

  100% {
    opacity: 0;
    transform:
      translate3d(calc(-50% + 78vw * var(--scoop-x)), calc(-50% + 45vh * var(--scoop-y)), 0)
      rotate(var(--scoop-exit-tilt)) scale(1.49);
  }
}

@keyframes site-intro-backdrop {
  0%, 47% { opacity: 1; }
  79%, 100% { opacity: 0; }
}

@keyframes site-intro-contact {
  0%, 40% { opacity: 0; transform: scale(.4); }
  49% { opacity: 1; }
  74%, 100% { opacity: 0; transform: scale(1.25); }
}

@keyframes site-intro-finish {
  0%, 86% { opacity: 1; }
  100% { opacity: 0; }
}

@media (orientation: portrait) {
  .site-intro {
    --intro-impact-y: clamp(4rem, 19vw, 10.5rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-intro {
    display: none !important;
  }
}
