/*
 * Shared styles for CKEditor 5 rich text.
 *
 * Loaded after ckeditor5-content.css in both the admin editor and the front pages,
 * so what editors see in CKEditor matches the published page.
 * Every rule is scoped to .ck-content (the editor's editable area and the front wrapper).
 */

/* Editor only: same base font as the article body on the site (.plsx-24-22-black). */
.ck.ck-editor__editable.ck-content {
    font-family: 'pslxtextregular', Arial, Helvetica, sans-serif;
    font-size: 24px;
    line-height: 25.39px;
    color: #000;
}

/* Editor only: Bootstrap's thin rule, as on the site, instead of CKEditor's 4px bar. */
.ck.ck-editor__editable.ck-content hr {
    display: block;
    width: auto;
    height: 0;
    margin: 1rem 0;
    background: none;
    border: 0;
    border-top: 1px solid;
    color: inherit;
    opacity: 0.25;
    vertical-align: baseline;
}

/* Paragraph spacing and table defaults the site used before CKEditor 5; older articles rely on them. */
.ck-content p {
    margin-bottom: 1rem;
}

.ck-content p:last-child {
    margin-bottom: 0;
}

.ck-content table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    table-layout: fixed;
}

.ck-content th,
.ck-content td {
    padding: 0.75rem 0.9rem;
    min-width: 2rem;
    word-break: break-word;
}

/* Bootstrap's .table class also matches CKEditor's <figure class="table">; undo it. */
.ck-content figure.table {
    width: auto;
    max-width: 100%;
    vertical-align: baseline;
    --bs-table-bg: transparent;
    --bs-table-accent-bg: transparent;
    --bs-table-striped-bg: transparent;
    --bs-table-active-bg: transparent;
    --bs-table-hover-bg: transparent;
}

.ck-content figure.table > table > * > tr > td,
.ck-content figure.table > table > * > tr > th {
    word-break: break-word;
}

/* Small screens: fit the table to the screen and scroll sideways if it is still too wide. */
@media (max-width: 767.98px) {
    .ck-content figure.table:not(.layout-table) {
        display: block;
        float: none;
        width: auto !important;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        overflow-x: auto;
    }
}

/* Embedded video: same size in the editor and on the page. */
.ck-content figure.media {
    width: 100%;
    min-width: 0;
    max-width: 720px;
    margin: 1.5rem auto;
}

.ck-content figure.media iframe {
    display: block;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9;
    border: 0;
}

.ck-content img {
    height: auto !important;
}

/* Legacy CKEditor 4 highlight. */
.ck-content .marker {
    background: #fff3a0;
    padding: 0 0.15em;
}

/* Styles from the editor's "Styles" dropdown. */
.ck-content h2[style*="font-style: italic"],
.ck-content .ck-style-italic-title {
    font-style: italic;
}

.ck-content h3[style*="font-style: italic"],
.ck-content .ck-style-subtitle {
    color: #aaa;
    font-style: italic;
}

.ck-content .ck-style-special-container {
    padding: 5px 10px;
    background: #eee;
    border: 1px solid #ccc;
}

.ck-content table.ck-style-compact-table td,
.ck-content table.ck-style-compact-table th {
    padding: 5px;
    border-color: #ccc;
}

.ck-content table.ck-style-borderless-table,
.ck-content table.ck-style-borderless-table td,
.ck-content table.ck-style-borderless-table th {
    border-style: hidden;
    background-color: #E6E6FA;
}

.ck-content ul.ck-style-square-bullets {
    list-style-type: square;
}

.ck-content .ck-style-big {
    font-size: 1.25em;
}

.ck-content .ck-style-small {
    font-size: 0.85em;
}

.ck-content .ck-style-typewriter,
.ck-content .ck-style-computer-code,
.ck-content .ck-style-keyboard-phrase,
.ck-content .ck-style-sample-text,
.ck-content .ck-style-variable {
    font-family: monospace;
}

.ck-content .ck-style-deleted-text {
    text-decoration: line-through;
}

.ck-content .ck-style-inserted-text {
    text-decoration: underline;
}

.ck-content .ck-style-cited-work {
    font-style: italic;
}

.ck-content .ck-style-inline-quotation::before {
    content: open-quote;
}

.ck-content .ck-style-inline-quotation::after {
    content: close-quote;
}

.ck-content .ck-style-keyboard-phrase {
    padding: 0.1rem 0.35rem;
    border-radius: 0.2rem;
    background: #212529;
    color: #fff;
    font-size: 0.875em;
}

.ck-content .ck-style-language-rtl {
    direction: rtl;
    unicode-bidi: embed;
}

.ck-content .ck-style-language-ltr {
    direction: ltr;
    unicode-bidi: embed;
}

.ck-content img.left,
.ck-content img.ck-style-image-left {
    float: left;
    margin: 0 1rem 1rem 0;
}

.ck-content img.right,
.ck-content img.ck-style-image-right {
    float: right;
    margin: 0 0 1rem 1rem;
}
