.masthead {
  position: relative;
}

.motion-toggle {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-end: 0;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  inline-size: 2.75rem;
  block-size: 2.75rem;
  border: 1px solid transparent;
  border-radius: .25rem;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.motion-toggle:hover,
.motion-toggle:focus-visible {
  border-color: #667c9c;
  color: var(--text);
  background: #172337;
}

.motion-toggle:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.motion-toggle svg {
  inline-size: 1rem;
  block-size: 1rem;
}

.motion-toggle[aria-pressed="false"] .motion-play,
.motion-toggle[aria-pressed="true"] .motion-pause {
  display: none;
}

.hero {
  position: relative;
  isolation: isolate;
}

.motion-field {
  position: absolute;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  mask-image: linear-gradient(transparent, #000 13%, #000 84%, transparent);
}

.motion-stars {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  opacity: .74;
}

.motion-orbit {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-start: 70%;
  inline-size: clamp(15rem, 47vw, 40rem);
  aspect-ratio: 1;
  translate: -50% -50%;
  transform: rotate(-19deg) scaleY(.52);
  border: 1px solid rgb(126 167 231 / .16);
  border-inline-start-color: rgb(173 208 255 / .46);
  border-radius: 50%;
  box-shadow: inset 0 0 1.5rem rgb(54 110 199 / .08), 0 0 1.5rem rgb(54 110 199 / .07);
}

.motion-orbit::after {
  position: absolute;
  inset: 17% auto auto 9%;
  inline-size: .34rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #b0d0ff;
  box-shadow: 0 0 1.1rem #729ee8;
  content: "";
}

.motion-orbit-secondary {
  scale: .83;
  rotate: 24deg;
  border-style: dashed;
  border-color: rgb(153 193 255 / .2);
  opacity: .42;
}

.motion-orbit-secondary::after {
  inset: auto 2% 35% auto;
}

.motion-ready .motion-orbit {
  animation: sp-orbit 27s cubic-bezier(.32,.04,.6,1) infinite paused;
}

.motion-ready .motion-orbit-secondary {
  animation-duration: 36s;
  animation-direction: reverse;
}

.motion-ready .motion-stars {
  animation: sp-stars 7s ease-in-out infinite paused;
}

.motion-enabled.hero-active :is(.motion-orbit, .motion-stars) {
  animation-play-state: running;
}

/* Anchor the roll and light layers to the emitter at (424, 329) in pulsar.svg. */
.signal-stage {
  transform: translateY(var(--signal-drift, 0px));
}

.signal-pivot {
  --signal-x: 55.789%;
  --signal-y: 49.848%;
  position: relative;
  isolation: isolate;
  transform-origin: var(--signal-x) var(--signal-y);
  transform: rotate(var(--signal-roll, 0deg));
}

.signal-pivot > span {
  position: absolute;
  inset-block-start: var(--signal-y);
  inset-inline-start: var(--signal-x);
  translate: -50% -50%;
  opacity: 0;
  mix-blend-mode: screen;
}

.signal-jet {
  inline-size: 17%;
  block-size: 99%;
  rotate: -31deg;
  background: radial-gradient(ellipse, rgb(222 241 255 / .75), rgb(113 174 255 / .3) 16%, transparent 67%);
}

.signal-core {
  inline-size: 31%;
  aspect-ratio: 1;
  background: radial-gradient(circle, rgb(249 252 255 / .96), rgb(150 208 255 / .46) 13%, rgb(109 172 255 / .19) 36%, transparent 67%);
}

.signal-echo {
  inline-size: 21%;
  aspect-ratio: 1;
  border: 1px solid rgb(158 211 255 / .52);
  border-radius: 50%;
  box-shadow: 0 0 1.1rem rgb(128 189 255 / .28), inset 0 0 1.1rem rgb(128 189 255 / .13);
}

.motion-ready .signal-core {
  animation: signal-breathe 5.8s ease-in-out .75s infinite paused;
}

.motion-ready .signal-jet {
  animation: signal-energize 5.8s ease-in-out .75s infinite paused;
}

.motion-ready .signal-echo {
  animation: signal-afterglow 5.8s cubic-bezier(.17, .65, .3, 1) .75s infinite paused;
}

.motion-enabled.hero-active :is(.signal-core, .signal-jet, .signal-echo) {
  animation-play-state: running;
}

@keyframes signal-breathe {
  0%, 100% { opacity: .12; scale: .72; }
  14% { opacity: .25; scale: .9; }
  26% { opacity: .94; scale: 1.14; }
  55% { opacity: .37; scale: 1.26; }
  79% { opacity: .12; scale: .8; }
}

@keyframes signal-energize {
  0%, 14%, 100% { opacity: .06; scale: .77 .92; }
  29% { opacity: .74; scale: 1.22 1.06; }
  66% { opacity: .12; scale: .9 1; }
}

@keyframes signal-afterglow {
  0%, 20% { opacity: 0; scale: .35; }
  31% { opacity: .53; }
  68%, 100% { opacity: 0; scale: 2.8; }
}

.motion-enabled .motion-arrival {
  animation: sp-arrival 750ms cubic-bezier(.2,.64,.22,1) both;
}

.motion-enabled .motion-enter .instrument {
  animation: sp-instrument-in 1s cubic-bezier(.19,.65,.2,1) both;
}

@keyframes sp-instrument-in {
  from { opacity: .72; }
  to { opacity: 1; }
}

.teaser .instrument {
  position: relative;
  isolation: isolate;
}

.motion-event {
  position: absolute;
  pointer-events: none;
  z-index: 2;
  inset: 0;
  overflow: hidden;
}

.motion-event::after {
  position: absolute;
  inset: 0;
  content: "";
}

.motion-event--scan::after {
  background: radial-gradient(ellipse at 73% 47%, rgb(116 180 255 / .34), transparent 57%);
  animation: sp-scan-echo 740ms cubic-bezier(.15,.67,.31,1) both;
}

.motion-event--dispatch::after {
  background: linear-gradient(100deg, transparent 31%, rgb(126 182 255 / .36) 50%, transparent 69%);
  animation: sp-dispatch 590ms cubic-bezier(.18,.75,.39,1) both;
}

.motion-event--survey::after {
  background: radial-gradient(ellipse at var(--light-x, 56%) var(--light-y, 46%), rgb(167 209 251 / .32), transparent 62%);
  animation: sp-illumination 700ms cubic-bezier(.19,.55,.23,1) both;
}

@media (max-width: 47rem) {
  .motion-orbit {
    inset-block-start: 73%;
    inset-inline-start: 52%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .signal-stage,
  .signal-pivot {
    transform: none;
  }

  .motion-ready .signal-pivot > span {
    animation: none;
  }

  .motion-field {
    display: none;
  }

  .motion-field *,
  .motion-arrival,
  .motion-enter .instrument,
  .motion-event::after {
    animation: none !important;
  }
}

@keyframes sp-arrival {
  0% {
    opacity: 0.45;
    transform: translate3d(0, 14px, 0) scale(0.985);
  }
  60% {
    opacity: 0.9;
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes sp-orbit {
  0% {
    opacity: 0.45;
    transform: rotateX(68deg) rotateZ(0deg) scale(1);
  }
  25% {
    opacity: 0.7;
    transform: rotateX(68deg) rotateZ(90deg) scale(1.02);
  }
  50% {
    opacity: 0.9;
    transform: rotateX(68deg) rotateZ(180deg) scale(1.04);
  }
  75% {
    opacity: 0.7;
    transform: rotateX(68deg) rotateZ(270deg) scale(1.02);
  }
  100% {
    opacity: 0.45;
    transform: rotateX(68deg) rotateZ(360deg) scale(1);
  }
}

@keyframes sp-stars {
  0%, 100% {
    opacity: 0.25;
    transform: translate3d(0, 0, 0) scale(0.9);
  }
  30% {
    opacity: 0.8;
    transform: translate3d(0.5px, -0.5px, 0) scale(1.05);
  }
  55% {
    opacity: 0.45;
    transform: translate3d(0, -1px, 0) scale(0.95);
  }
  80% {
    opacity: 0.9;
    transform: translate3d(-0.5px, 0, 0) scale(1.1);
  }
}

@keyframes sp-scan-echo {
  0% {
    opacity: 0;
    transform: scale(0.15);
  }
  12% {
    opacity: 0.85;
  }
  70% {
    opacity: 0.25;
  }
  100% {
    opacity: 0;
    transform: scale(1.6);
  }
}

@keyframes sp-dispatch {
  0% {
    opacity: 0;
    transform: translate3d(-120%, 0, 0) scaleX(0.4);
  }
  15% {
    opacity: 1;
    transform: translate3d(-60%, 0, 0) scaleX(1.2);
  }
  85% {
    opacity: 1;
    transform: translate3d(260%, 0, 0) scaleX(1);
  }
  100% {
    opacity: 0;
    transform: translate3d(340%, 0, 0) scaleX(0.5);
  }
}

@keyframes sp-illumination {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  35% {
    opacity: 0.75;
    transform: scale(1.08);
  }
  100% {
    opacity: 0;
    transform: scale(1.35);
  }
}
