/*
 * Blueprint scenes (geometry topic). Markup: js/visuals/scenes-geometry.js.
 * Base sizing and the reveal typing animation come from css/scenes-b.css (the
 * roots also carry .scene-b). State classes on #play-visual come from
 * js/ext/scenes.js. Only transform and opacity are animated.
 */

.scene-geo .geo-art,
.scene-geo .geo-wheel,
.scene-geo .geo-unknown {
  transform-box: fill-box;
  transform-origin: center;
}

/* The worked measurement stays hidden until a correct answer. */
.scene-geo .geo-solve {
  opacity: 0;
}

/* Unknowns breathe gently while the question is open. */
#play-visual:not(.is-answered) .scene-geo .geo-unknown {
  animation: geo-pulse 1.6s ease-in-out infinite;
}

/* ---------- correct: the measurement lights up, the vault wheel turns ---------- */

.is-correct .scene-geo .geo-solve {
  animation: geo-fade-in 0.5s ease-out 0.1s both;
}
.is-correct [data-scene="geo-vault"] .geo-wheel {
  animation: geo-spin 0.9s cubic-bezier(0.3, 1.3, 0.5, 1) both;
}
.is-correct [data-scene="geo-rails"] .geo-beam,
.is-correct [data-scene="geo-beams"] .geo-beam {
  animation: geo-flicker 0.5s ease-out both;
}

/* ---------- wrong / timeout: a short shake, then the plan dims ---------- */

.is-wrong .scene-geo .geo-art,
.is-partial .scene-geo .geo-art {
  animation: geo-shake 0.4s ease-in-out both;
}
.is-timeout .scene-geo .geo-art {
  animation: geo-dim 0.5s ease-out both;
}

@keyframes geo-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes geo-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(180deg);
  }
}

@keyframes geo-flicker {
  0% {
    opacity: 1;
  }
  30% {
    opacity: 0.35;
  }
  60% {
    opacity: 1;
  }
  80% {
    opacity: 0.6;
  }
  100% {
    opacity: 1;
  }
}

@keyframes geo-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  50% {
    transform: translateX(5px);
  }
  75% {
    transform: translateX(-3px);
  }
}

@keyframes geo-dim {
  from {
    opacity: 1;
  }
  to {
    opacity: 0.55;
  }
}

@keyframes geo-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

/* Reduced motion: no movement, jump straight to the final frame. */
@media (prefers-reduced-motion: reduce) {
  .scene-geo *,
  #play-visual:not(.is-answered) .scene-geo .geo-unknown {
    animation: none !important;
    transition: none !important;
  }
  .is-correct .scene-geo .geo-solve {
    opacity: 1;
  }
  .is-timeout .scene-geo .geo-art {
    opacity: 0.55;
  }
}
