/*
  Animated paper figures (static/js/figures.js). The figure is the file of
  the paper, inline; its parts start hidden and appear in steps.
*/

.fa-svg {
  display: block;
  width: 100%;
  height: auto;
}

/* A part fades in. Markers and verdicts also grow from their centre. */
.fa-part {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  transition: opacity 260ms ease-out, transform 420ms cubic-bezier(0.2, 0.9, 0.3, 1);
}

.fa-pop {
  transform: scale(0.35);
}

.fa-part.is-on {
  opacity: 1;
  transform: none;
}

/* The verdict that changes grows once more, so the eye lands on it. The
   animation does not hold its last frame: a held transform, even one that
   changes nothing, keeps the part on a layer of its own and the browser then
   draws the parts over it a hair differently from the still figure. */
.fa-changed.is-on {
  animation: fa-changed 900ms ease-out 420ms 1;
}

@keyframes fa-changed {
  0% { transform: scale(1); }
  35% { transform: scale(1.45); }
  100% { transform: scale(1); }
}

/* With reduced motion the figure is whole until the reader plays it. */
.fa-still .fa-part {
  opacity: 1;
  transform: none;
  transition: none;
  animation: none;
}

/* Pause and Replay, small and grey under the figure, on the right. */
.fa-controls {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 8px;
}

.fa-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  font: inherit;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--muted);
  background: none;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  cursor: pointer;
}

.fa-button svg {
  fill: currentColor;
}

.fa-button:hover {
  color: var(--ink);
  border-color: var(--muted);
}

.fa-button:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.fa-ready figcaption {
  margin-top: 8px;
}

/* The still image gives way to the inline file. */
.fa-ready .surface > picture,
.fa-ready .surface > img {
  display: none;
}
