/**
 * @file
 * Media embed: overrides to make focus styles and alignment work in CKEditor.
 */

/**
 * Allow the drupal-media element's width to collapse to the size of its
 * contents so that the outline has no extra white space (margin). This
 * emulates the image2 plugin's styles inherited by the drupallink CKEditor
 * plugin.
 */
drupal-media {
  display: inline-block;
}

/**
 * For center alignment, take advantage of drupal-media's inline-block
 * display and center it as if it were text.
 */
.cke_widget_drupalmedia.align-center {
  text-align: center;
}

/**
 * Fix positioning without delete button. Can be removed with this issue:
 * @see https://www.drupal.org/project/drupal/issues/3074859
 */
drupal-media .media-library-item__edit {
  right: 10px;
}

/**
 * Allow alignment to display in CKEditor.
 */
drupal-media[data-align=left],
drupal-media[data-align=right] {
  display: inline;
}
drupal-media[data-align=center] {
  display: flex;
}
