/* Figures whose visual is an interactive iframe carried in the figure legend.
   The static PNG stays in the source so the figure is a real Sphinx figure
   (numbered, referenceable with numref, and usable in PDF/LaTeX builds); on
   screen the widget stands in for it. */

figure.interactive-figure > a.image-reference,
figure.interactive-figure > img {
  display: none;
}

/* Legend (the iframe) renders after the caption by default; put it above. */
figure.interactive-figure > figcaption {
  display: flex;
  flex-direction: column;
}

figure.interactive-figure > figcaption > .legend {
  order: -1;
  margin-bottom: 0.5rem;
}

figure.interactive-figure > figcaption > .legend iframe {
  display: block;
  width: 100%;
  border: 0;
}

/* On paper the iframe is dead weight: show the static image instead. */
@media print {
  figure.interactive-figure > a.image-reference,
  figure.interactive-figure > img {
    display: inline-block;
  }

  figure.interactive-figure > figcaption > .legend {
    display: none;
  }
}
