/* Optional, token-page-only motion. The original atlas is the static fallback. */
.funding-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.token-motion-toggle {
  appearance: none;
  border: 0;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  color: #667588;
  min-height: 44px;
  padding: 8px 0 8px 12px;
  font:
    700 12px/1.3 Nunito,
    sans-serif;
  cursor: pointer;
}
.token-motion-toggle:hover {
  color: #132750;
}
.token-motion-toggle:focus-visible {
  outline: 2px solid #3575bb;
  outline-offset: 3px;
}
.token-motion-toggle[hidden] {
  display: none;
}
.token-page .token-art {
  position: relative;
}
.chest-rig,
.motion-detail {
  display: none;
  pointer-events: none;
}
.chest-rig,
.laptop-screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.token-page[data-token-motion="playing"] .art-fees {
  background-image: none;
}
.token-page[data-token-motion="playing"] .chest-rig,
.token-page[data-token-motion="playing"] .motion-detail {
  display: block;
}

/* Pause offscreen or in a background tab; the browser owns all frame timing. */
.token-page .motion-part {
  animation-play-state: paused;
}
.token-page[data-token-motion="playing"]
  [data-motion-visible="true"]
  .motion-part {
  animation-play-state: running;
}

/* Six aligned, genuinely drawn poses: brace, push, strain, pop, then pout.
   Only the sprite frame changes discretely; the tiny strain tremble is smooth. */
.chest-rig {
  overflow: hidden;
}
.chest-rig .motion-part {
  transform-box: view-box;
}
.chest-sequence {
  animation: chest-story 8.8s steps(1, end) infinite;
}
.chest-strain {
  animation: chest-strain 8.8s ease-in-out infinite;
}
@keyframes chest-story {
  0%,
  12% {
    transform: translateX(0);
  }
  18% {
    transform: translateX(-256px);
  }
  26% {
    transform: translateX(-512px);
  }
  32% {
    transform: translateX(-256px);
  }
  37% {
    transform: translateX(-512px);
  }
  44% {
    transform: translateX(-768px);
  }
  62% {
    transform: translateX(-1024px);
  }
  71%,
  94% {
    transform: translateX(-1280px);
  }
  97%,
  100% {
    transform: translateX(0);
  }
}
@keyframes chest-strain {
  0%,
  43%,
  63%,
  100% {
    transform: translate(0, 0);
  }
  45%,
  49%,
  53%,
  57%,
  61% {
    transform: translate(1.2px, 0.7px);
  }
  47%,
  51%,
  55%,
  59% {
    transform: translate(-1.2px, -0.7px);
  }
}

/* Small terminal lines write themselves, scroll once, then settle. */
.code-row {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: code-type 8s ease-out infinite;
}
.code-row-two {
  animation-delay: 0.6s;
}
.code-row-three {
  animation-delay: 1.2s;
}
.code-row-four {
  animation-delay: 1.8s;
}
.code-scroll {
  animation: code-scroll 8s ease-in-out infinite;
}
.code-cursor {
  animation: code-cursor 1.4s steps(1, end) infinite;
}
.code-success {
  transform-origin: 46px 42px;
  opacity: 0;
  animation: code-success 8s ease-out infinite;
}
.code-check {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: code-check 8s ease-out infinite;
}
@keyframes code-success {
  0%,
  60%,
  91%,
  100% {
    opacity: 0;
    transform: scale(0.75);
  }
  65%,
  82% {
    opacity: 1;
    transform: scale(1);
  }
  69% {
    transform: scale(1.08);
  }
}
@keyframes code-check {
  0%,
  64%,
  100% {
    stroke-dashoffset: 1;
  }
  72%,
  90% {
    stroke-dashoffset: 0;
  }
}
@keyframes code-type {
  0%,
  10% {
    stroke-dashoffset: 1;
  }
  23%,
  82% {
    stroke-dashoffset: 0;
  }
  94%,
  100% {
    stroke-dashoffset: 1;
  }
}
@keyframes code-scroll {
  0%,
  54%,
  100% {
    translate: 0 0;
    opacity: 1;
  }
  61% {
    translate: 0 -6px;
    opacity: 0;
  }
  62%,
  93% {
    translate: 0 3px;
    opacity: 0;
  }
}
@keyframes code-cursor {
  0%,
  55% {
    opacity: 1;
  }
  56%,
  100% {
    opacity: 0.15;
  }
}

/* Screen-only light: no rapid full-device flash, no layout movement. */
.handheld-screen {
  position: absolute;
  inset: 0;
  clip-path: polygon(26.6% 13.7%, 67.5% 16.3%, 65.1% 50.5%, 22.5% 47.8%);
  background:
    linear-gradient(
      112deg,
      transparent 34%,
      #d9f8ff88 46%,
      #fff9d0b0 50%,
      transparent 63%
    ),
    repeating-linear-gradient(0deg, #b1edff15 0 1px, transparent 1px 4px);
  background-size:
    350% 100%,
    100% 100%;
  animation: handheld-screen 8.5s ease-in-out -1s infinite;
}
.handheld-screen::before,
.handheld-screen::after {
  content: "";
  position: absolute;
  animation-duration: 8.5s;
  animation-delay: -1s;
  animation-iteration-count: infinite;
  animation-play-state: inherit;
}
.handheld-screen::before {
  inset: 12% 28% 47% 20%;
  background: #132c54;
  animation-name: handheld-boot;
}
.handheld-screen::after {
  left: 30%;
  top: 33%;
  width: 29%;
  height: 2.5%;
  border-radius: 1px;
  background: #ffda60;
  transform-origin: left center;
  animation-name: handheld-load;
}
@keyframes handheld-boot {
  0%,
  7% {
    opacity: 0.96;
  }
  16%,
  100% {
    opacity: 0;
  }
}
@keyframes handheld-load {
  0% {
    opacity: 0;
    transform: rotate(3deg) scaleX(0);
  }
  2% {
    opacity: 1;
    transform: rotate(3deg) scaleX(0);
  }
  10%,
  12% {
    opacity: 1;
    transform: rotate(3deg) scaleX(1);
  }
  16%,
  100% {
    opacity: 0;
    transform: rotate(3deg) scaleX(1);
  }
}
.handheld-button {
  position: absolute;
  left: 56.2%;
  top: 57.1%;
  width: 6%;
  height: 6%;
  border-radius: 50%;
  background: #fff7a7;
  filter: blur(1px);
  animation: handheld-button 8.5s ease-in-out -1s infinite;
}
@keyframes handheld-screen {
  0%,
  20% {
    background-position:
      100% 0,
      0 0;
    opacity: 1;
  }
  24% {
    opacity: 1;
  }
  29% {
    opacity: 1;
  }
  34% {
    opacity: 1;
  }
  53%,
  100% {
    background-position:
      0 0,
      0 5px;
    opacity: 1;
  }
}
@keyframes handheld-button {
  0%,
  27%,
  42%,
  100% {
    opacity: 0;
  }
  32%,
  36% {
    opacity: 0.7;
  }
}

/* Highlights stay inside the original gold silhouettes. */
.coin-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    110deg,
    transparent 42%,
    #fffce080 48%,
    #ffffffdc 50%,
    #fff6bf80 52%,
    transparent 58%
  );
  background-size: 320% 100%;
  -webkit-mask-image: url("/assets/token/studio-icons-v1.png");
  -webkit-mask-size: 300% 300%;
  -webkit-mask-repeat: no-repeat;
  mask-image: url("/assets/token/studio-icons-v1.png");
  mask-size: 300% 300%;
  mask-repeat: no-repeat;
  animation: coin-shine 8s ease-in-out infinite;
}
.art-payments .coin-shine {
  -webkit-mask-position: 0 100%;
  mask-position: 0 100%;
  animation-delay: -2s;
}
.art-game-fees .coin-shine {
  -webkit-mask-position: 50% 100%;
  mask-position: 50% 100%;
  clip-path: ellipse(19% 19% at 68% 60%);
  animation-delay: -1.55s;
}
.art-burn .coin-shine {
  -webkit-mask-position: 100% 100%;
  mask-position: 100% 100%;
  clip-path: ellipse(25% 26% at 38% 49%);
  animation-delay: -1.1s;
}
@keyframes coin-shine {
  0%,
  10% {
    background-position: 100% 0;
    opacity: 0;
  }
  13% {
    opacity: 0.8;
  }
  33% {
    background-position: 0 0;
    opacity: 0.8;
  }
  37%,
  100% {
    background-position: 0 0;
    opacity: 0;
  }
}
.coin-spark {
  position: absolute;
  width: 11%;
  height: 11%;
  left: 64%;
  top: 22%;
  background: #fffde9;
  clip-path: polygon(
    50% 0,
    62% 38%,
    100% 50%,
    62% 62%,
    50% 100%,
    38% 62%,
    0 50%,
    38% 38%
  );
  animation: coin-spark 8s ease-in-out -2s infinite;
}
@keyframes coin-spark {
  0%,
  24%,
  35%,
  100% {
    opacity: 0;
    transform: scale(0.2);
  }
  29% {
    opacity: 1;
    transform: scale(1);
  }
}
.flame-warmth {
  position: absolute;
  left: 55%;
  top: 14%;
  width: 16%;
  height: 38%;
  border-radius: 50%;
  background: #ffe78b;
  filter: blur(3px);
  clip-path: polygon(
    8% 85%,
    36% 58%,
    22% 22%,
    43% 0,
    69% 23%,
    92% 67%,
    81% 93%
  );
  animation: flame-warmth 4s ease-in-out infinite;
}
@keyframes flame-warmth {
  0%,
  100% {
    opacity: 0.06;
    scale: 1 0.95;
  }
  40% {
    opacity: 0.3;
    scale: 0.94 1.03;
  }
  70% {
    opacity: 0.16;
    scale: 1 0.98;
  }
}
.citizen-dots {
  position: absolute;
  top: 29.7%;
  left: 67.1%;
  width: 18%;
  height: 6%;
}
.citizen-dots i {
  position: absolute;
  top: 0;
  width: 23%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #d9f1ff;
  animation: citizen-dot 5.5s ease-in-out infinite;
}
.citizen-dots i:nth-child(2) {
  left: 38%;
  animation-delay: 0.18s;
}
.citizen-dots i:nth-child(3) {
  left: 76%;
  animation-delay: 0.36s;
}
@keyframes citizen-dot {
  0%,
  15%,
  39%,
  100% {
    opacity: 0;
  }
  25% {
    opacity: 1;
  }
}
.server-light {
  position: absolute;
  left: 55.1%;
  top: 31.5%;
  width: 4%;
  height: 4%;
  border-radius: 50%;
  background: #e5ff9a;
  box-shadow: 0 0 5px #d8fb8c;
  animation: server-light 5.5s ease-in-out -2s infinite;
}
@keyframes server-light {
  0%,
  60%,
  100% {
    opacity: 0.05;
  }
  70%,
  82% {
    opacity: 0.9;
  }
}

@media (prefers-reduced-motion: reduce) {
  .token-page:not([data-token-motion-opt-in="true"]) .motion-part {
    animation: none !important;
  }
  .token-page:not([data-token-motion-opt-in="true"]) .chest-rig,
  .token-page:not([data-token-motion-opt-in="true"]) .motion-detail {
    display: none !important;
  }
}
