/*
 * Content styles for HTML produced by CKEditor 5.
 *
 * CKEditor 5 stores image alignment, text wrapping and resizing as classes on
 * the <figure class="image"> wrapper (image-style-align-left/right/center,
 * image-style-side, image_resized) and only styles them inside its own
 * editable area. These rules make saved pluslet content look the same on the
 * public site and in the admin preview.
 */

.pluslet_body .image {
    display: table;
    clear: both;
    text-align: center;
    margin: 0.9em auto;
    max-width: 100%;
    min-width: 50px;
}

.pluslet_body .image img {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
}

.pluslet_body .image > figcaption {
    display: table-caption;
    caption-side: bottom;
    word-break: break-word;
    padding: 0.6em;
    font-size: 0.75em;
    color: #333;
}

/* Proportional resizing: the wrapper carries the width, the image follows. */
.pluslet_body .image.image_resized {
    max-width: 100%;
}

.pluslet_body .image.image_resized img {
    width: 100%;
}

/* Alignment and text wrapping. */
.pluslet_body .image-style-align-left {
    float: left;
    margin-right: 1.5em;
}

.pluslet_body .image-style-align-right {
    float: right;
    margin-left: 1.5em;
}

.pluslet_body .image-style-align-center {
    margin-left: auto;
    margin-right: auto;
}

.pluslet_body .image-style-side {
    float: right;
    margin-left: 1.5em;
    max-width: 50%;
}

/* Inline images keep their place in the text flow. */
.pluslet_body .image-inline {
    max-width: 100%;
}

.pluslet_body .image-inline img {
    max-width: 100%;
    height: auto;
}

.pluslet_body .image-inline.image-style-align-left {
    margin-right: 1.5em;
}

.pluslet_body .image-inline.image-style-align-right {
    margin-left: 1.5em;
}

/* Links created in CKEditor 5 (the editor tags them with the sp-cke-link
   class on downcast): the standard link blue, in both the editor and the
   rendered content. The .pluslet / .pluslet_body variants carry more
   specificity than the plain link rules — .portal-column-* .pluslet a in
   the admin guide theme and .pluslet_body a / .ui-widget-content a on the
   public pages — so the class wins regardless of stylesheet order.
   The small right margin keeps a text-like gap after the link.
   Document links inserted via the "Insert or Upload Document" dialog
   (fil tokens) get the class server-side in TextTokenizer::processFIL();
   the other tokenized links (resources, catalog, contacts, FAQs, TOC)
   keep their own styling. */
a.sp-cke-link,
.pluslet a.sp-cke-link,
.pluslet_body a.sp-cke-link {
    color: #40659B;
    margin-right: 0.25em;
}

a.sp-cke-link:hover,
.pluslet a.sp-cke-link:hover,
.pluslet_body a.sp-cke-link:hover {
    color: #cc6666;
    text-decoration: underline;
}

/* Headings: the public reset renders h4 as plain body text (no margins,
   inherited size), while the admin preview and the CKEditor editable area
   fall back to the browser defaults (1.33em margins). Match the public
   margins and size in both places, but keep the heading's own weight
   instead of inheriting the body text weight. */
.ck-editor__editable h4,
.pluslet_body h4 {
    margin: 0;
    padding: 0;
    border: 0;
    /* Do not inherit the body weight; override the public reset too. */
    font-weight: bold;
    font-style: inherit;
    font-size: 100%;
    font-family: inherit;
    vertical-align: baseline;
}

/* Ordered lists: the public theme renders them with a uniform 1em margin
   (the ".pluslet_simple ul, ol" rule), no left padding (the reset wins
   over pure.css's 40px) and a 5px/10px item offset (".pluslet li"),
   while the admin page inherits the pure.css defaults (1em top/bottom
   margins, 40px left padding, items touching). Match the public
   rendering in the editor and the preview; on the public site the rules
   are redundant with cleanwhite.css. */
.ck-editor__editable ol,
.pluslet_body ol {
    margin: 1em;
    padding-left: 0;
}

.ck-editor__editable ol li,
.pluslet_body ol li {
    margin-left: 5px;
    margin-bottom: 10px;
}
