/* The roller coaster: the bitcoin guy riding a story's six beats, in WebGL.
   It sits in the case study's .soft-inner-shadow frame, on the components'
   light grey ground in both colour schemes. */

.rc3d {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #ebebf0;
  overflow: hidden;
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue",
    Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  contain: layout paint;
  outline: none;
}

.rc3d:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.55);
}

/* Its first frame: shown until the ride is running, and kept if it can't run. */
.rc3d-poster,
.rc3d-poster img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rc3d[data-state="live"] .rc3d-poster {
  display: none;
}

.rc3d-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  /* Scrolling and pinch-zoom still work over it; only a press flips him. */
  touch-action: manipulation;
}

/* Comic-book marks and the halftone wind: layers behind the scene (the canvas
   is see-through wherever nothing's drawn), and marks in front of it. */
.rc3d-comic,
.rc3d-wind {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.rc3d-comic {
  overflow: visible;
}

.rc3d-comic.is-front {
  z-index: 1;
}

/* The beat's name, top right, on a soft scrim of the ground's own colour so
   it reads whatever the track is doing behind it. */
.rc3d-phase {
  position: absolute;
  top: 17px;
  right: 22px;
  height: 24px;
  pointer-events: none;
  z-index: 2;
}

.rc3d-phase::before {
  content: "";
  position: absolute;
  top: -17px;
  right: -22px;
  width: 300px;
  height: 128px;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(
    100% 100% at 100% 0%,
    rgba(235, 235, 240, 0.96) 0%,
    rgba(235, 235, 240, 0.9) 26%,
    rgba(235, 235, 240, 0.62) 46%,
    rgba(235, 235, 240, 0.24) 66%,
    rgba(235, 235, 240, 0) 86%
  );
}

.rc3d-phase span {
  position: absolute;
  top: 0;
  right: 0;
  white-space: nowrap;
  font-size: 17px;
  line-height: 24px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: #1d1d1f;
  opacity: 0;
  transform: translateY(7px);
  filter: blur(4px);
  transition:
    opacity 0.55s cubic-bezier(0.2, 0.7, 0.2, 1),
    transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1),
    filter 0.55s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.rc3d-phase span.is-on {
  opacity: 0.9;
  transform: none;
  filter: none;
}

.rc3d-phase span.is-off {
  opacity: 0;
  transform: translateY(-7px);
  filter: blur(4px);
  transition-duration: 0.3s, 0.35s, 0.3s;
}

.rc3d-phase span.is-reset {
  transition: none;
}

@media (max-width: 500px) {
  .rc3d {
    aspect-ratio: 4 / 3;
  }
  .rc3d-phase {
    top: 12px;
    right: 14px;
    height: 20px;
  }
  .rc3d-phase::before {
    top: -12px;
    right: -14px;
    width: 210px;
    height: 92px;
  }
  .rc3d-phase span {
    font-size: 14px;
    line-height: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rc3d-phase span {
    transition: opacity 0.2s linear;
    transform: none !important;
    filter: none !important;
  }
}
