#bot {
  --bot-close: 3.3;
  --bot-drop: 27vh;
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  pointer-events: none;
}

.bot-stage {
  position: relative;
  transform-origin: 50% 22.9%;
  animation: bot-float 7s ease-in-out infinite;
}

#bot svg {
  display: block;
  height: min(92vh, 150vw);
  width: auto;
  overflow: visible;
  opacity: 0.15;
  transition: opacity 0.9s;
}

#bot.awake > .bot-stage > svg {
  opacity: 0.24;
}

#bot .sh {
  fill: url(#botShell);
  stroke: #2f5274;
  stroke-width: 3;
  stroke-linejoin: round;
}
#bot .jt {
  fill: url(#botJoint);
  stroke: #12293f;
  stroke-width: 2.5;
}
#bot .jt-ring {
  fill: none;
  stroke: #8fb0cf;
  stroke-width: 2.5;
  stroke-linecap: round;
}
#bot .ln {
  fill: none;
  stroke: #b3c6d9;
  stroke-width: 2.5;
  stroke-linecap: round;
}
#bot .rod {
  fill: none;
  stroke: #2f5274;
  stroke-width: 6;
  stroke-linecap: round;
}
#bot .tip {
  fill: #fff;
  stroke: #2f5274;
  stroke-width: 6;
}
#bot .glass {
  fill: url(#botGlass);
  stroke: #12293f;
  stroke-width: 3;
}
#bot .shine {
  fill: #fff;
  opacity: 0.13;
}
#bot .screen {
  fill: #eef4fa;
  stroke: #b3c6d9;
  stroke-width: 2.5;
}
#bot .core {
  fill: none;
  stroke: #7f9bb6;
  stroke-width: 34;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.5s;
}
#bot .dot {
  fill: #b3c6d9;
}
#bot .ground {
  fill: #12293f;
  opacity: 0;
  transition: opacity 0.6s;
}

/* Asleep until the robot is complete: the eyes and lamps are grey. */
#bot .eye,
#bot .lamp {
  fill: #5f7f9e;
  transition: fill 0.5s;
}
#bot .smile {
  fill: none;
  stroke: #5f7f9e;
  stroke-width: 5;
  stroke-linecap: round;
  transition: stroke 0.5s;
}
#bot .eye {
  transform-box: fill-box;
  transform-origin: center;
  animation: bot-blink 5.5s infinite;
}
#bot .eyes {
  transform: translate(calc(var(--look-x, 0) * 1px), calc(var(--look-y, 0) * 1px));
  transition: transform 0.25s ease-out;
}

#bot.awake .eye,
#bot.awake .lamp,
#bot.intro .eye,
#bot.intro .lamp {
  fill: #3aa5ff;
}
#bot.awake .smile,
#bot.intro .smile {
  stroke: #3aa5ff;
}
#bot.awake .core,
#bot.intro .core {
  stroke: #0a84ff;
}
#bot.awake .eyes,
#bot.intro .eyes {
  filter: drop-shadow(0 0 7px rgb(58 165 255 / 0.8));
}

@keyframes bot-float {
  50% {
    transform: translateY(-7px);
  }
}
@keyframes bot-blink {
  0%,
  95%,
  100% {
    transform: scaleY(1);
  }
  97.5% {
    transform: scaleY(0.08);
  }
}
@keyframes bot-arm-up {
  22%,
  78% {
    transform: rotate(148deg);
  }
}
@keyframes bot-hand {
  0%,
  22%,
  78%,
  100% {
    transform: rotate(0);
  }
  36%,
  64% {
    transform: rotate(24deg);
  }
  50% {
    transform: rotate(-12deg);
  }
}

@media (max-width: 899px) {
  #bot {
    --bot-close: 2.3;
    --bot-drop: 12vh;
  }
  /* On phones the robot is always behind the text column, so it is paler
     and its dark visor is lightened. The opening keeps full strength. */
  #bot:not(.intro) > .bot-stage > svg {
    opacity: 0.11;
  }
  #bot.awake:not(.intro) > .bot-stage > svg {
    opacity: 0.15;
  }
  #bot:not(.intro) .glass {
    fill-opacity: 0.5;
    stroke-opacity: 0.5;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bot-stage,
  #bot .eye {
    animation: none;
  }
}
