.tq-mascot {
  --tq-size: clamp(58px, 9vw, 100px);
  margin-block-start: 8px;
  pointer-events: none;
}

.tq-mascot--walk-right {
  --tq-from: .06;
  --tq-to: .72;
}

.tq-mascot--walk-left {
  --tq-from: .83;
  --tq-to: .17;
}

.tq-mascot:is(.tq-mascot--walk-right, .tq-mascot--walk-left) {
  --tq-step-duration: .56s;
  --tq-steps: 6;
  --tq-walk-duration: calc(var(--tq-step-duration) * var(--tq-steps));
}

.tq-mascot--peek {
  --tq-size: clamp(50px, 7.4vw, 84px);
  inline-size: var(--tq-size);
  margin-inline-start: auto;
  border-block-end: 1px solid var(--line, #d5d6d2);
}

.tq-mascot__lane {
  position: relative;
  block-size: calc(var(--tq-size) + 20px);
  overflow: hidden;
}

.tq-mascot__position {
  position: absolute;
  inset: auto 0 0;
}

.tq-mascot:is(.tq-mascot--walk-right, .tq-mascot--walk-left) .tq-mascot__position {
  transform: translateX(calc((100% - var(--tq-size)) * var(--tq-from)));
}

.tq-mascot__character {
  position: relative;
  inline-size: var(--tq-size);
  block-size: var(--tq-size);
  transform-origin: center bottom;
}

.tq-mascot:is(.tq-mascot--walk-right, .tq-mascot--walk-left) .tq-mascot__character::before {
  content: "";
  position: absolute;
  inset: auto 23% 1px;
  height: 5px;
  border-radius: 50%;
  background: #25314223;
  filter: blur(2px);
}

.tq-mascot__character img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  transform-origin: center 91%;
}

.tq-mascot [data-tq-art="jump"] { visibility: hidden; }
.tq-mascot [data-tq-art] + [data-tq-art]:not([data-tq-art="jump"]) { opacity: 0; }

.tq-mascot-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 clamp(9px, 2vw, 20px);
}

.tq-mascot-heading .tq-mascot {
  --tq-size: clamp(45px, 6.4vw, 73px);
  flex: 0 0 var(--tq-size);
  inline-size: var(--tq-size);
  margin: 0;
}

.footer-top .tq-mascot {
  --tq-size: clamp(36px, 5vw, 52px);
}

.footer-top .tq-mascot__lane { block-size: var(--tq-size); }

@media (prefers-reduced-motion: no-preference) {
  .tq-mascot:is(.tq-mascot--walk-right, .tq-mascot--walk-left)[data-tq-seen] .tq-mascot__position {
    animation: tq-kun-travel var(--tq-walk-duration) ease-in-out forwards;
  }

  .tq-mascot:is(.tq-mascot--walk-right, .tq-mascot--walk-left)[data-tq-seen] .tq-mascot__character {
    animation: tq-kun-step var(--tq-step-duration) ease-in-out var(--tq-steps);
  }

  .tq-mascot:is(.tq-mascot--walk-right, .tq-mascot--walk-left)[data-tq-seen] [data-tq-art$="-a"] {
    animation: tq-kun-frame-a var(--tq-step-duration) step-end var(--tq-steps),
      tq-kun-hide .01s step-start var(--tq-walk-duration) forwards;
  }

  .tq-mascot:is(.tq-mascot--walk-right, .tq-mascot--walk-left)[data-tq-seen] [data-tq-art$="-b"] {
    animation: tq-kun-frame-b var(--tq-step-duration) step-end var(--tq-steps);
  }

  .tq-mascot:is(.tq-mascot--walk-right, .tq-mascot--walk-left)[data-tq-seen] [data-tq-art]:last-child {
    animation: tq-kun-show .01s step-start var(--tq-walk-duration) forwards;
  }

  .tq-mascot--hop[data-tq-seen] [data-tq-art="stand"] {
    animation: tq-kun-swap .72s steps(1, end) .14s;
  }

  .tq-mascot--hop[data-tq-seen] [data-tq-art="jump"] {
    animation: tq-kun-hop .72s ease-in-out .14s;
  }

  .tq-mascot--peek[data-tq-seen] [data-tq-art="peek"] {
    animation: tq-kun-peek .82s ease-out both;
  }

  .tq-mascot--wave[data-tq-seen] [data-tq-art="wave-a"] {
    animation: tq-kun-frame-a .6s step-end 3;
  }

  .tq-mascot--wave[data-tq-seen] [data-tq-art="wave-b"] {
    animation: tq-kun-frame-b .6s step-end 3;
  }

  .tq-mascot--bow[data-tq-seen] .tq-mascot__character {
    animation: tq-kun-bow 1.55s ease-in-out;
  }

  .tq-mascot--bow[data-tq-seen] [data-tq-art="stand"] {
    animation: tq-kun-bow-stand 1.55s step-end;
  }

  .tq-mascot--bow[data-tq-seen] [data-tq-art="bow"] {
    animation: tq-kun-bow-pose 1.55s step-end;
  }

  .tq-mascot--plush-3d[data-tq-seen] img {
    animation: tq-plush-appear 1.2s ease-out both;
  }

  .tq-mascot--sofubi-3d[data-tq-seen] img {
    animation: tq-sofubi-appear 1.15s ease-out both;
  }
}

@keyframes tq-plush-appear {
  from { opacity: .12; transform: translateY(9px) rotate(-6deg); }
  58% { opacity: 1; transform: translateY(-2px) rotate(5deg); }
  to { opacity: 1; transform: translateY(0) rotate(0); }
}

@keyframes tq-sofubi-appear {
  from { opacity: .15; transform: translateX(7px) rotate(4deg); }
  60% { opacity: 1; transform: translateX(-2px) rotate(-3deg); }
  to { opacity: 1; transform: translateX(0) rotate(0); }
}

@keyframes tq-kun-travel {
  from { transform: translateX(calc((100% - var(--tq-size)) * var(--tq-from))); }
  to { transform: translateX(calc((100% - var(--tq-size)) * var(--tq-to))); }
}

@keyframes tq-kun-frame-a {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes tq-kun-frame-b {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

@keyframes tq-kun-hide { to { opacity: 0; } }
@keyframes tq-kun-show { to { opacity: 1; } }

@keyframes tq-kun-bow {
  0%, 100% { transform: scaleY(1); }
  32%, 72% { transform: scaleY(.97); }
}

@keyframes tq-kun-bow-stand {
  0%, 78%, 100% { opacity: 1; }
  22% { opacity: 0; }
}

@keyframes tq-kun-bow-pose {
  0%, 78%, 100% { opacity: 0; }
  22% { opacity: 1; }
}

@keyframes tq-kun-step {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  25%, 75% { transform: translateY(-3px) rotate(0); }
  50% { transform: translateY(0) rotate(3deg); }
}

@keyframes tq-kun-swap {
  from { visibility: hidden; }
  to { visibility: visible; }
}

@keyframes tq-kun-hop {
  0% { visibility: visible; transform: translateY(0) scaleY(.92); }
  43% { visibility: visible; transform: translateY(-17px) rotate(-5deg); }
  82% { visibility: visible; transform: translateY(0) scaleX(1.04) scaleY(.94); }
  100% { visibility: visible; transform: translateY(0); }
}

@keyframes tq-kun-peek {
  from { transform: translateY(62%); opacity: .2; }
  68% { transform: translateY(-3px); opacity: 1; }
  to { transform: translateY(0); opacity: 1; }
}
