/* Mathematician visitors: paper-puppet bodies around historical portraits. */
.math-guest {
  display: flex;
  align-items: center;
  gap: 13px;
  position: relative;
  width: 100%;
  min-height: 116px;
  padding: 12px;
  border: 1px solid #475662;
  border-radius: 12px;
  background: linear-gradient(125deg, #1c2a30, #1a212d);
  color: #e7f3ed;
  box-shadow: 0 10px 24px #0002;
}
.math-guest-puppet {
  flex: none;
  position: relative;
  width: 82px;
  height: 94px;
}
.math-guest-figure {
  position: absolute;
  left: 2px;
  top: 8px;
  width: 78px;
  height: 79px;
  animation:
    guest-hop 1.1s cubic-bezier(0.18, 0.65, 0.3, 1) both,
    guest-idle 3.8s ease-in-out 1.1s 3; /* a few bobs, then still (WCAG 2.2.2) */
}
.math-guest-head {
  position: absolute;
  left: 11px;
  top: 0;
  width: 56px;
  height: 56px;
  z-index: 3;
  overflow: hidden;
  border: 3px solid var(--guest-accent);
  border-radius: 50%;
  background: #e4e4d9;
  box-shadow:
    0 2px 0 #101922,
    0 5px 12px #0006;
  transform: rotate(-4deg);
}
.math-guest-head img {
  position: absolute;
  max-width: none;
  width: var(--portrait-size);
  height: auto;
  left: var(--portrait-x);
  top: var(--portrait-y);
  display: block;
}
.math-guest-outfit {
  position: absolute;
  left: 25px;
  top: 48px;
  width: 29px;
  height: 25px;
  z-index: 2;
  border: 2px solid #d4e9d5;
  border-radius: 10px 10px 8px 8px;
  background: var(--guest-accent);
  box-shadow: inset 0 -7px 0 #20333d;
}
.math-guest-bow {
  display: block;
  text-align: center;
  color: #223441;
  font-size: 11px;
  line-height: 15px;
}
.math-guest-arm,
.math-guest-leg {
  position: absolute;
  display: block;
  background: var(--guest-accent);
  border: 2px solid #d4e9d5;
  border-radius: 9px;
  transform-origin: center top;
}
.math-guest-arm {
  top: 52px;
  width: 9px;
  height: 22px;
  z-index: 1;
}
.math-guest-arm-left {
  left: 19px;
  transform: rotate(27deg);
}
.math-guest-arm-right {
  left: 52px;
  transform: rotate(-27deg);
  animation: guest-wave 1.1s ease-in-out both;
}
.math-guest-leg {
  top: 68px;
  width: 8px;
  height: 13px;
}
.math-guest-leg-left {
  left: 30px;
  transform: rotate(12deg);
}
.math-guest-leg-right {
  left: 42px;
  transform: rotate(-12deg);
}
.math-guest-spark {
  position: absolute;
  z-index: 5;
  left: 67px;
  top: 4px;
  color: #efdda1;
  font-size: 18px;
  opacity: 0;
  animation: guest-spark 1.1s ease-out both;
}
@keyframes guest-hop {
  0%,
  100% {
    transform: translateY(0) rotate(-3deg);
  }
  30% {
    transform: translateY(4px) rotate(2deg);
  }
  58% {
    transform: translateY(-16px) rotate(5deg);
  }
  82% {
    transform: translateY(1px) rotate(-2deg);
  }
}
@keyframes guest-idle {
  0%,
  100% {
    transform: translateY(0) rotate(-3deg);
  }
  50% {
    transform: translateY(-3px) rotate(0);
  }
}
@keyframes guest-wave {
  0%,
  100% {
    transform: rotate(-27deg);
  }
  45%,
  65% {
    transform: rotate(-105deg);
  }
}
@keyframes guest-spark {
  0%,
  28%,
  100% {
    opacity: 0;
    transform: scale(0.4);
  }
  55% {
    opacity: 1;
    transform: scale(1.2);
  }
}
.math-guest-copy {
  min-width: 0;
  padding-right: 18px;
}
.math-guest-eyebrow {
  display: block;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #b5cfc3;
}
.math-guest-copy strong {
  display: block;
  font-size: 16px;
  line-height: 1.3;
  font-family: Georgia, serif;
}
.math-guest-copy p {
  font-size: 13px;
  line-height: 1.35;
  margin: 4px 0;
  color: #d2ded7;
}
.math-guest-copy a {
  display: inline-block;
  white-space: nowrap;
  font-size: 12px;
  color: #bee6cf;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.math-guest-source {
  margin-left: 8px;
}
.math-guest-credit {
  display: block;
  font-size: 10px;
  color: #b5cfc3;
  margin-top: 4px;
}
.math-guest-credit a {
  font-size: 10px;
}
.math-guest-next {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border: 1px solid #66786f;
  border-radius: 50%;
  background: #253932;
  color: #e6f5dc;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.math-guest-next:hover {
  background: #3c5747;
}
.math-guest-next:focus-visible,
.math-guest-copy a:focus-visible {
  outline: 2px solid #d6edaa;
  outline-offset: 3px;
}
.controls > .math-guest {
  margin: 0;
}
.scene .math-guest {
  grid-column: 1/-1;
}
@media (max-width: 760px) {
  .math-guest {
    grid-column: 1/-1;
  }
  .math-guest-copy p {
    font-size: 14px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .math-guest-figure,
  .math-guest-arm-right,
  .math-guest-spark {
    animation: none;
  }
  .math-guest-figure {
    transform: none;
  }
  .math-guest-spark {
    opacity: 0;
  }
}
