/* "Sprout", the login mascot. Pure SVG built by js/mascot.js — no images.
   Two states:
     .is-covering  paws over the eyes (default, while the password is hidden)
     no class      paws lowered, eyes open and following the pointer (password shown)
   .is-oops / .is-happy are short reactions to a failed / successful submit. */

.mascot {
  --px: 0;
  --py: 0;
  width: min(280px, 62vw);
  aspect-ratio: 1;
  position: relative;
}

.mascot svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.mascot .m-body-group {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: m-breathe 4.8s ease-in-out infinite;
}

.mascot .m-sprout {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: m-sway 5.5s ease-in-out infinite;
}

.mascot .m-eyes {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  animation: m-blink 6s infinite;
}

.mascot .m-pupils {
  transform: translate(calc(var(--px) * 6px), calc(var(--py) * 5px));
  transition: transform 180ms ease-out;
}

/* Paws rest at the sides; the transform origin is near the bottom of the paw. */
.mascot .m-arm {
  transform-box: fill-box;
  transform-origin: 50% 80%;
  transition: transform 420ms var(--ease-spring);
}

.mascot .m-mouth-o,
.mascot .m-mouth-smile {
  transition: opacity 160ms ease;
}

.mascot .m-mouth-o {
  opacity: 0;
}

/* ---- Covering: paws centred exactly on the eyes (94,135) and (146,135).
   Offsets account for the 12° rotation about the paw's lower pivot. */
.mascot.is-covering .m-arm-left {
  transform: translate(39px, -49px) rotate(12deg);
}

.mascot.is-covering .m-arm-right {
  transform: translate(-39px, -49px) rotate(-12deg);
}

.mascot.is-covering .m-mouth-smile {
  opacity: 0;
}

.mascot.is-covering .m-mouth-o {
  opacity: 1;
}

.mascot.is-oops .m-body-group {
  animation: m-shake 420ms ease-in-out;
}

.mascot.is-happy .m-body-group {
  animation: m-hop 520ms var(--ease-spring);
}

/* ---- Dashboard moods ---- */

.mascot .m-eyes-closed,
.mascot .m-mouth-flat,
.mascot .m-zzz {
  opacity: 0;
  transition: opacity 200ms ease;
}

.mascot .m-zzz {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 500;
  fill: var(--ink-soft);
}

.mascot.is-sleepy .m-eyes,
.mascot.is-sleepy .m-mouth-smile {
  opacity: 0;
}

.mascot.is-sleepy .m-eyes-closed,
.mascot.is-sleepy .m-mouth-flat,
.mascot.is-sleepy .m-zzz {
  opacity: 1;
}

.mascot.is-sleepy .m-zzz {
  animation: m-float 3s ease-in-out infinite;
}

.mascot.is-proud .m-body-group {
  animation: m-hop 900ms var(--ease-spring) 2, m-breathe 4.8s ease-in-out 1.8s infinite;
}

/* The sprout grows with the user's best current streak (--growth 0..1). */
.mascot .m-sprout {
  scale: calc(1 + var(--growth, 0) * 0.7);
}

@keyframes m-float {
  50% {
    transform: translateY(-6px);
  }
}

@keyframes m-breathe {
  50% {
    transform: scale(1.015, 0.985);
  }
}

@keyframes m-sway {
  50% {
    transform: rotate(6deg);
  }
}

@keyframes m-blink {
  0%,
  46%,
  50%,
  100% {
    transform: scaleY(1);
  }
  48% {
    transform: scaleY(0.1);
  }
}

@keyframes m-shake {
  20%,
  60% {
    transform: translateX(-8px) rotate(-3deg);
  }
  40%,
  80% {
    transform: translateX(8px) rotate(3deg);
  }
}

@keyframes m-hop {
  40% {
    transform: translateY(-18px) scale(0.97, 1.04);
  }
  70% {
    transform: translateY(0) scale(1.04, 0.96);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mascot .m-body-group,
  .mascot .m-sprout,
  .mascot .m-eyes,
  .mascot .m-zzz,
  .mascot.is-proud .m-body-group {
    animation: none !important;
  }
}
