/* Step transitions: the only copy. Shared by the player (Player.razor, standalone export via ExportAssets) and the
   editor's Preview (App.razor, js/transition-preview.js). player.js / transition-preview.js put dt-tx dt-tx-{style}
   (+ dt-tx-back) and --dt-tx-ms on the stage, add a dt-leaving layer (the step being left) and
   dt-entering on the arriving step (the player's .dt-zoom-box or text/chapter page, the Preview's own layer), and
   remove them all after --dt-tx-ms. */

.dt-tx-layer { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.dt-tx-pic { position: absolute; inset: 0; transform-origin: 0 0; }
.dt-tx-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; user-select: none; }
.dt-leaving [inert], .dt-leaving * { pointer-events: none; }

/* While a transition runs the picture is hidden unless it is the arriving step (then its box animates in, live frame
   and all), and the choices and bare Back/Next wait for the landing like the click target does. */
.dt-tx .dt-zoom, .dt-tx .dt-choices, .dt-tx .dt-bare-nav { visibility: hidden; }
.dt-tx .dt-zoom-box.dt-entering > .dt-zoom { visibility: visible; }

.dt-tx .dt-leaving, .dt-tx .dt-entering {
  animation-duration: var(--dt-tx-ms, 450ms);
  animation-timing-function: var(--ease, ease-out);
  animation-fill-mode: both;
}

/* Fade */
.dt-tx-fade .dt-leaving { animation-name: dt-tx-fade-out; }
.dt-tx-fade .dt-entering { animation-name: dt-tx-fade-in; }

/* Slide: the new step slides over the old one (from the left going Back). */
.dt-tx-slide .dt-entering { animation-name: dt-tx-from-right; }
.dt-tx-slide.dt-tx-back .dt-entering { animation-name: dt-tx-from-left; }

/* Push: both move together. */
.dt-tx-push .dt-leaving { animation-name: dt-tx-to-left; }
.dt-tx-push .dt-entering { animation-name: dt-tx-from-right; }
.dt-tx-push.dt-tx-back .dt-leaving { animation-name: dt-tx-to-right; }
.dt-tx-push.dt-tx-back .dt-entering { animation-name: dt-tx-from-left; }

/* Zoom: the old step grows away, the new one settles in. */
.dt-tx-zoom .dt-leaving { animation-name: dt-tx-zoom-out; }
.dt-tx-zoom .dt-entering { animation-name: dt-tx-zoom-in; }

/* Blur dissolve */
.dt-tx-blur .dt-leaving { animation-name: dt-tx-blur-out; }
.dt-tx-blur .dt-entering { animation-name: dt-tx-blur-in; }

/* Wipe: the new step is uncovered left to right (right to left going Back). */
.dt-tx-wipe .dt-entering { animation-name: dt-tx-wipe-ltr; }
.dt-tx-wipe.dt-tx-back .dt-entering { animation-name: dt-tx-wipe-rtl; }

/* Pop: the old step shrinks back and fades while the new one springs up past full size and settles (the overshoot
   is the curve, not a keyframe). Its callout card pops in after the landing (.dt-pop below). */
.dt-tx-pop .dt-leaving { animation-name: dt-tx-pop-out; animation-timing-function: cubic-bezier(.4, 0, 1, 1); }
.dt-tx-pop .dt-entering { animation-name: dt-tx-pop-in; animation-timing-function: cubic-bezier(.34, 1.56, .64, 1); }

/* Tooltip pop: a callout card springs out of its pointer once the step has landed. player.js adds dt-pop (and
   --dt-pop-delay, the landing time) for a Pop step, or on every step when the demo's "Pop tooltips" is on. It
   animates the scale property, so the card's placement transform is left alone. */
.dt-callout.dt-pop { animation: dt-pop-card 460ms cubic-bezier(.34, 1.56, .64, 1) var(--dt-pop-delay, 0ms) both; }
.dt-callout--bottom.dt-pop { transform-origin: 24px 0; }
.dt-callout--top.dt-pop { transform-origin: 24px 100%; }
.dt-callout--right.dt-pop { transform-origin: 0 20px; }
.dt-callout--left.dt-pop { transform-origin: 100% 20px; }

@keyframes dt-tx-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes dt-tx-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes dt-tx-from-right { from { translate: 100% 0; } to { translate: 0 0; } }
@keyframes dt-tx-from-left { from { translate: -100% 0; } to { translate: 0 0; } }
@keyframes dt-tx-to-left { from { translate: 0 0; } to { translate: -100% 0; } }
@keyframes dt-tx-to-right { from { translate: 0 0; } to { translate: 100% 0; } }
@keyframes dt-tx-zoom-out { from { scale: 1; opacity: 1; } to { scale: 1.08; opacity: 0; } }
@keyframes dt-tx-zoom-in { from { scale: 0.96; opacity: 0; } to { scale: 1; opacity: 1; } }
@keyframes dt-tx-blur-out { from { filter: blur(0); opacity: 1; } to { filter: blur(12px); opacity: 0; } }
@keyframes dt-tx-blur-in { from { filter: blur(12px); opacity: 0; } to { filter: blur(0); opacity: 1; } }
@keyframes dt-tx-wipe-ltr { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes dt-tx-wipe-rtl { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0 0 0 0); } }
@keyframes dt-tx-pop-out { from { scale: 1; opacity: 1; } to { scale: .9; opacity: 0; } }
@keyframes dt-tx-pop-in { from { scale: .82; opacity: 0; } 40% { opacity: 1; } to { scale: 1; opacity: 1; } }
@keyframes dt-pop-card { from { scale: .5; opacity: 0; } 35% { opacity: 1; } to { scale: 1; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .dt-tx .dt-leaving, .dt-tx .dt-entering, .dt-callout.dt-pop { animation: none; }
}
