:root {
  --motion-progress: 0;
}

.motion-hero {
  position: relative;
}

.hero-motion-stage {
  position: relative;
  display: flex;
  align-items: flex-end;
  width: 100%;
  height: 100svh;
  overflow: hidden;
  padding: 0 4.2vw 7.2vh;
  background: #050605;
  isolation: isolate;
}

.motion-enabled .motion-hero {
  display: block;
  height: 320svh;
  min-height: 0;
  overflow: visible;
  padding: 0;
}

.motion-enabled .hero-motion-stage {
  position: sticky;
  top: 0;
}

.hero-motion-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  filter: brightness(1.03) contrast(1.02);
  transition: opacity 600ms ease;
}

.motion-ready .hero-motion-canvas {
  opacity: 1;
}

.motion-ready .hero-image {
  opacity: 0;
  visibility: hidden;
}

.motion-hero .hero-shade {
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(3, 4, 3, 0.86) 0%, rgba(3, 4, 3, 0.38) 43%, rgba(3, 4, 3, 0.08) 72%),
    linear-gradient(0deg, rgba(3, 4, 3, 0.68), transparent 44%);
}

.motion-hero .hero-stage-lights {
  z-index: 2;
  opacity: calc(0.48 - var(--motion-progress) * 0.32);
}

.motion-hero .hero-content,
.motion-hero .scroll-note {
  z-index: 4;
}

.hero-motion-status {
  position: absolute;
  right: clamp(22px, 4vw, 70px);
  bottom: clamp(28px, 4vw, 62px);
  z-index: 5;
  display: grid;
  justify-items: end;
  gap: 5px;
  color: rgba(255, 255, 255, 0.74);
  font-family: var(--font-geist-mono, monospace);
  font-size: 10px;
  letter-spacing: 0.12em;
  line-height: 1.25;
  text-transform: uppercase;
  pointer-events: none;
}

.hero-motion-phase {
  color: #c7ff31;
  font-size: 12px;
}

.hero-motion-progress {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 5;
  height: 2px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.14);
  pointer-events: none;
}

.hero-motion-progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: #c7ff31;
  transform: scaleX(var(--motion-progress));
  transform-origin: left;
  will-change: transform;
}

.motion-enabled .scroll-note {
  display: flex;
  align-items: center;
  gap: 12px;
}

.motion-enabled .scroll-note::after {
  content: "";
  width: 34px;
  height: 1px;
  background: #c7ff31;
  transform: scaleX(calc(0.25 + var(--motion-progress) * 0.75));
  transform-origin: left;
}

@media (max-width: 780px) {
  .motion-enabled .motion-hero {
    height: 260svh;
  }

  .hero-motion-canvas {
    filter: brightness(1.02) contrast(1.02);
  }

  .hero-motion-stage {
    align-items: flex-start;
    padding: 145px 22px 42px;
  }

  .motion-hero .hero-shade {
    background:
      linear-gradient(180deg, rgba(3, 4, 3, 0.34), transparent 26%),
      linear-gradient(0deg, rgba(3, 4, 3, 0.84), rgba(3, 4, 3, 0.12) 58%);
  }

  .hero-motion-status {
    right: 20px;
    bottom: max(18px, env(safe-area-inset-bottom));
  }

  .motion-hero .scroll-note {
    bottom: max(18px, env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .motion-enabled .motion-hero {
    height: 100svh;
  }

  .motion-enabled .scroll-note {
    display: none;
  }

  .hero-motion-status,
  .hero-motion-progress {
    display: none;
  }
}
