/* An initial deep link should reach its section before the mascot tests visibility. */
:root:not(.aviator-positioned):has(:target) { scroll-behavior: auto; }
.aviator-stage {
  --flight-time: 14s;
  --enter-x: -8vw;
  --enter-y: -96px;
  --glide-x: -3vw;
  position: absolute;
  inset-inline-end: clamp(22px, 6vw, 96px);
  bottom: clamp(50px, 5vw, 85px);
  width: clamp(160px, 19vw, 275px);
  aspect-ratio: 1;
  pointer-events: none;
  user-select: none;
  z-index: 1;
}
.aviator-intro, .aviator-intro > span {
  position: absolute;
  inset: 0;
}
.aviator-intro {
  --pose: aviator-arrive;
  transform-origin: 50% 78%;
  animation: var(--pose) var(--flight-time) both;
}
.aviator-intro > span {
  --pose: aviator-fly;
  background: url("aviator.webp") 0 50% / 300% 100% no-repeat;
  animation: var(--pose) var(--flight-time) both;
}
.aviator-intro > span:nth-child(2) {
  --pose: aviator-goggles;
  background-position-x: 50%;
}
.aviator-intro > span:nth-child(3) {
  --pose: aviator-heart;
  background-position-x: 100%;
}
@keyframes aviator-arrive {
  0% { opacity: 0; transform: translate(var(--enter-x),var(--enter-y)) scale(.4) rotate(-12deg); }
  5% { opacity: 1; }
  22% { transform: translate(var(--glide-x),-26px) scale(.83) rotate(-5deg); }
  33% { transform: translate(2px,3px) scale(1.025) rotate(2deg); }
  39%, 94% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(5px) scale(.98); }
}
@keyframes aviator-fly {
  0%, 30% { opacity: 1; }
  35%, 100% { opacity: 0; }
}
@keyframes aviator-goggles {
  0%, 30% { opacity: 0; }
  35%, 39% { opacity: 1; }
  44%, 100% { opacity: 0; }
}
@keyframes aviator-heart {
  0%, 39% { opacity: 0; }
  44%, 100% { opacity: 1; }
}
[dir="rtl"] .aviator-stage { --enter-x: 8vw; --glide-x: 3vw; }
@media (max-width: 850px) {
  .aviator-stage { width: clamp(125px, 17vw, 146px); inset-inline-end: 8px; }
}
@media (min-width: 681px) and (max-width: 1000px) and (max-height: 500px) {
  .aviator-stage { top: 18px; bottom: auto; }
}
@media (max-width: 680px) {
  .hero-copy {
    --bird-size: clamp(110px, 31vw, 144px);
    width: 100%;
    position: relative;
    padding-block-start: .6rem;
  }
  .hero-copy > .eyebrow {
    min-height: var(--bird-size);
    padding-inline-end: calc(var(--bird-size) + 8px);
    margin-block-end: .45rem;
  }
  .aviator-stage {
    --enter-x: 54px;
    --enter-y: -46px;
    --glide-x: 13px;
    width: var(--bird-size);
    inset-inline-end: 0;
    bottom: auto;
    top: .55rem;
  }
  [dir="rtl"] .aviator-stage { --enter-x: -54px; --glide-x: -13px; }
}
@media (prefers-reduced-motion: reduce) {
  .aviator-stage:not([data-motion-on]) .aviator-intro > span { opacity: 0; }
  .aviator-stage:not([data-motion-on]) .aviator-intro > span:last-child { opacity: 1; }
  /* A visitor can explicitly enable this flight while keeping the rest of the site still. */
  .aviator-stage[data-motion-on] .aviator-intro,
  .aviator-stage[data-motion-on] .aviator-intro > span {
    animation: var(--pose) var(--flight-time) both !important;
  }
  .aviator-control:not([hidden]) {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    min-height: 44px;
    width: max-content;
    max-width: 100%;
    padding: .25rem .65rem;
    border: 1px solid #ffffffa8;
    border-radius: 4px;
    background: #0c2944;
    color: white;
    font: 700 .83rem/1.15 Barlow, sans-serif;
    text-align: center;
    pointer-events: auto;
    cursor: pointer;
    z-index: 2;
  }
  .aviator-control:focus-visible { outline: 3px solid #ffcf21; outline-offset: 2px; }
}
@media (max-width: 680px) and (prefers-reduced-motion: reduce) {
  .hero-copy > .eyebrow { min-height: calc(var(--bird-size) + 44px); }
}
@media print { .aviator-stage { display: none; } }
