/* ---------- The player: a real capture that plays its steps ----------
   Shared by the tutorials and the component page. A <figure class="play">
   holds a stage of captures and an ordered list of steps; play.js zooms on
   the useful place, moves a pointer there and lights the step being played. */

.play { margin: clamp(14px, 2vh, 22px) 0 clamp(16px, 2.2vh, 24px); max-width: min(100%, 920px); }

.play-stage {
  position: relative;
  aspect-ratio: var(--ratio);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-card);
  background: var(--panel);
}

.play-layer {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  transition: transform .9s var(--ease-out);
  will-change: transform;
}

/* Fitted by width: a capture taller than the stage keeps its proportions and
   loses its foot, and play.js converts its coordinates. */
.play-layer img {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: auto;
  max-width: none;
  display: block;
  opacity: 0;
  transition: opacity .45s ease;
}
.play-layer img.is-on { opacity: 1; }

/* the pointer: an arrow that travels, and a ring where it clicks */
.play-cursor {
  position: absolute;
  left: 50%;
  top: 60%;
  width: 22px;
  height: 22px;
  margin: -3px 0 0 -4px;
  opacity: 0;
  pointer-events: none;
  transition: left .9s var(--ease-out), top .9s var(--ease-out), opacity .3s ease;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Cpath d='M4 3l13 7.2-5.6 1.5L8.6 17z' fill='%23fff' stroke='%23111' stroke-width='1.3' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .45));
  z-index: 2;
}
.play-cursor.is-on { opacity: 1; }

.play-cursor::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 3px;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  opacity: 0;
}
.play-cursor.is-tap::after { animation: play-tap 1.5s ease-out .9s infinite; }
@keyframes play-tap {
  0% { opacity: .95; transform: scale(.35); }
  70%, 100% { opacity: 0; transform: scale(1.25); }
}

/* the key pressed at that step */
.play-key {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -40%) scale(.94);
  padding: 12px 20px;
  border-radius: var(--r-card-sm);
  background: color-mix(in srgb, var(--ink) 88%, transparent);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-family: "MP Mono", ui-monospace, monospace;
  font-size: clamp(18px, 2.2vw, 28px);
  letter-spacing: .04em;
  opacity: 0;
  transition: opacity .35s ease, transform .5s var(--ease-out);
  pointer-events: none;
  z-index: 3;
}
.play-key.is-on { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* the steps: all readable at once, the one playing is lit. The second
   selector outweighs ".tut .prose li" on the tutorials page. */
.play .play-steps,
.tut .prose .play-steps {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  counter-reset: play;
  display: grid;
  gap: 2px;
}
.play .play-steps li,
.tut .prose .play-steps li {
  counter-increment: play;
  position: relative;
  margin: 0;
  max-width: none;
  padding: 8px 12px 8px 40px;
  border-radius: var(--r-card-sm);
  color: var(--label);
  font-size: 14.5px;
  line-height: 1.5;
  cursor: pointer;
  transition: color .3s ease, background .3s ease;
}
.play-steps li::before {
  content: counter(play);
  position: absolute;
  left: 12px;
  top: 9px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  font-family: "MP Mono", ui-monospace, monospace;
  font-size: 10.5px;
  line-height: 1;
  color: var(--label);
  transition: background .3s ease, color .3s ease, border-color .3s ease;
}
.play-steps li strong { color: inherit; font-weight: 520; }
.play-steps li:hover { color: var(--muted); }
.play .play-steps li.is-on,
.tut .prose .play-steps li.is-on { color: var(--text); background: var(--surface-high); }
.play-steps li.is-on strong { color: var(--text); }
.play-steps li.is-on::before { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.play-steps li:focus-visible { outline: 1px solid var(--focus); outline-offset: 1px; }

@media (prefers-reduced-motion: reduce) {
  .play-layer, .play-layer img, .play-cursor, .play-key { transition: none; }
  .play-cursor.is-tap::after { animation: none; opacity: .9; transform: none; }
}
