/*
 * MAN-31 — alignment for text AND images in KB articles.
 *
 * ⚠ WHY THIS FILE EXISTS AT ALL. Quill's own stylesheet aligns a block's inline
 * content with `.ql-editor .ql-align-center { text-align: center }`. That centres
 * an <img> only while the image is an INLINE child of the aligned block. Quill
 * ships a dedicated rule for video (`.ql-editor .ql-video.ql-align-center
 * { margin: 0 auto }`) and NO equivalent for images — so an <img> that carries
 * the align class itself gets no rule at all and silently stays left.
 *
 * Which of the two shapes Quill emits depends on the blot (public-kb-editor
 * registers a custom PreservingImage). Rather than depend on that, both shapes
 * are handled here: the inline case is already covered by Quill's text-align,
 * and the class-on-the-image case is covered below.
 *
 * ⚠ SIZE AND ASPECT RATIO ARE NOT TOUCHED. Aligning sets margins and display
 * only. The image keeps the width attribute that kb-image-resize.js wrote, and
 * height stays unset so the aspect ratio follows the width. Do not add width,
 * height, max-width or object-fit here — that is how "align" quietly becomes
 * "resize".
 *
 * This file must be linked by BOTH editors and ALL readers, or an article will
 * align in one place and not the other. tests/unit/man31KbAlignAssets.test.js
 * enumerates the pages and asserts the link, so a new KB page cannot ship
 * without it.
 */

/* The class-on-the-image case. `display:block` is required for the margins to
   take effect; an inline image ignores `margin:auto`. */
.ql-editor img.ql-align-center {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.ql-editor img.ql-align-right {
  display: block;
  margin-left: auto;
  margin-right: 0;
}

/* Explicit left. Quill emits no class for left (it is the default), but an
   article authored elsewhere may carry it, and it must not fall through to the
   centre rule above. */
.ql-editor img.ql-align-left {
  display: block;
  margin-left: 0;
  margin-right: auto;
}
