figure {
  position: relative;
  width: max-content;
  max-width: 100%;
  height: max-content;
  margin: 0 0 1em;
  border-radius: var(--#{$CSS_VAR_PFX}border-radius);

  img {
    width: 100%;
    height: 100%;
    border-radius: var(--#{$CSS_VAR_PFX}border-radius);
  }

  figcaption {
    font-size: 0.9em;
    padding: 1em 0;
  }

  .source {
    --#{$CSS_VAR_PFX}local-border-color: var(--#{$CSS_VAR_PFX}txt-color-light);
    position: absolute;
    top: 1em;
    font-size: 0.75em;
    line-height: 1;
    padding: 0.5em;
    color: var(--#{$CSS_VAR_PFX}txt-color-inverted);
    background: var(--#{$CSS_VAR_PFX}txt-color-dark);
    border: var(--#{$CSS_VAR_PFX}border-width) solid var(--#{$CSS_VAR_PFX}local-border-color);
    border-radius: calc(var(--#{$CSS_VAR_PFX}border-radius) * 0.75);
    inset-inline-end: 1em;
  }

  &.fill {
    width: 100% !important;
  }

  &.centered {
    margin-left: auto;
    margin-right: auto;
  }

  &.overlay-caption {
    overflow: hidden;

    figcaption {
      position: absolute;
      bottom: 0;
      left: 0;
      width: 100%;
      padding-left: 1em;
      padding-right: 1em;
      color: var(--#{$CSS_VAR_PFX}txt-color-inverted);
      background: linear-gradient(0, var(--#{$CSS_VAR_PFX}txt-color-dark), transparent);
    }
  }
}
