figure {
  &.media {
    block-size: fit-content;
    border: none;
    padding: 5px;
    width: fit-content;

    footer {
      border: none !important;
      margin: 0 !important;
      padding: 0 2px !important;

      small {
        font-size: small;
        font-style: italic;
        padding-right: 2rem;
      }
    }
  }

  &.align-left,
  &.align-center,
  &.align-right {
    margin-left: 0;
    margin-right: 0;
  }

  /* Bootstrap 5: Medium devices (tablets, 768px and up) */
  @media only screen and (width >= 768px) {
    &.align-left {
      margin-bottom: 0;
      margin-right: 1.5rem;
    }

    &.align-center {
      margin-left: auto;
      margin-right: auto;
    }

    &.align-right {
      margin-bottom: 0;
      margin-left: 1.5rem;
    }
  }

  &.media.image {
    width: 100%;

    img {
      width: 100%;
    }

    /* Bootstrap 5: Medium devices (tablets, 768px and up) */
    @media only screen and (width >= 768px) {
      width: fit-content;

      img {
        width: auto;
      }
    }
  }

  &.media.document {
    align-items: center;
    display: flex;
    flex-flow: column nowrap;
  }

  &.caption {
    &.caption-drupal-media {
      border: none;
      padding: 5px;
    }

    figcaption {
      font-size: smaller;
      font-style: italic;
      padding-left: 2px;
    }

    /** Captioned media */
    .media {
      border: none;
      margin-bottom: 0;
      padding: 0;
    }
  }
}


