/*
 * Public rendering contract for HTML produced by TinyMCE.
 * Keep every selector limited to editor-owned classes so loading this file
 * cannot change images or layout components elsewhere on the website.
 */

.tiny-content-image--center {
    display: block;
    margin-inline: auto;
}

.tiny-content-image--start {
    float: right;
    max-width: 50% !important;
    margin: 0 0 1rem 1rem;
}

.tiny-content-image--end {
    float: left;
    max-width: 50% !important;
    margin: 0 1rem 1rem 0;
}

.tiny-content-image--full {
    display: block;
    width: 100% !important;
}

.tiny-content-video {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 1rem auto;
    border-radius: 10px;
}

.tiny-content-file {
    overflow-wrap: anywhere;
}

/* Legacy responsive image/text blocks still present in saved content. */
.rsp-img-text {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
    margin: 12px 0;
}

.rsp-img-text.img-start .rsp-img-col { order: 1; }
.rsp-img-text.img-start .rsp-txt-col { order: 2; }
.rsp-img-text.img-end .rsp-img-col { order: 2; }
.rsp-img-text.img-end .rsp-txt-col { order: 1; }

.rsp-img-col { flex: 0 0 auto; }

.rsp-img-col img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 4px;
}

.rsp-txt-col {
    flex: 1 1 200px;
    min-width: 0;
}

.rsp-img-full { display: block; width: 100%; height: auto; }
.rsp-img-75 { display: block; width: 75%; height: auto; }
.rsp-img-50 { display: block; width: 50%; height: auto; }
.rsp-img-33 { display: block; width: 33.33%; height: auto; }
.rsp-img-25 { display: block; width: 25%; height: auto; }

.rsp-cols {
    box-sizing: border-box;
    width: 100%;
    margin: 12px 0;
}

.rsp-col {
    min-width: 0;
    box-sizing: border-box;
}

/* Current image + text block. The modifier is authoritative for placement. */
.tiny-content-side-by-side {
    display: flex;
    flex-direction: row;
    width: 100%;
    max-width: 100%;
    margin: 1rem 0;
    align-items: flex-start;
    gap: 0;
    clear: both;
    box-sizing: border-box;
}

.tiny-content-side-by-side:not(:has(.tiny-content-side-by-side__divider)) {
    gap: 24px;
}

.tiny-content-side-by-side__media {
    flex: 0 1 40%;
    width: 40%;
    max-width: 40%;
    min-width: 0;
    overflow: hidden;
    box-sizing: border-box;
}

.tiny-content-side-by-side__text {
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    box-sizing: border-box;
}

.tiny-content-side-by-side__media img,
.tiny-content-side-by-side__media figure,
.tiny-content-side-by-side__media a {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0;
    box-sizing: border-box;
}

.tiny-content-side-by-side__text pre,
.tiny-content-side-by-side__text code {
    max-width: 100%;
    overflow-x: auto;
}

.tiny-content-side-by-side__divider {
    position: relative;
    display: block;
    align-self: stretch;
    flex: 0 0 24px;
    width: 24px;
    min-height: 3rem;
    box-sizing: border-box;
}

.tiny-content-side-by-side__ratio,
.tiny-content-side-by-side__gap-value {
    display: none;
}

/* In RTL: start is right and end is left. Explicit order prevents a stale
   DOM child order or an unrelated flex rule from reverting the selection. */
.tiny-content-side-by-side--media-start .tiny-content-side-by-side__media,
.tiny-content-side-by-side--media-end .tiny-content-side-by-side__text {
    order: 0;
}

.tiny-content-side-by-side__divider {
    order: 1;
}

.tiny-content-side-by-side--media-start .tiny-content-side-by-side__text,
.tiny-content-side-by-side--media-end .tiny-content-side-by-side__media {
    order: 2;
}

/* Generic content boxes produced by the full TinyMCE profile. */
.tiny-content-box-layout {
    display: flex;
    flex-direction: row;
    width: 100%;
    max-width: 100%;
    margin: 1rem 0;
    align-items: stretch;
    gap: 0;
    clear: both;
    box-sizing: border-box;
}

.tiny-content-box-layout__box {
    flex: 1 1 0%;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    box-sizing: border-box;
}

.tiny-content-box-layout__box img,
.tiny-content-box-layout__box video,
.tiny-content-box-layout__box iframe,
.tiny-content-box-layout__box figure {
    max-width: 100% !important;
    height: auto;
    box-sizing: border-box;
}

.tiny-content-box-layout__divider {
    position: relative;
    display: block;
    align-self: stretch;
    flex: 0 0 24px;
    width: 24px;
    min-height: 3rem;
    box-sizing: border-box;
}

.tiny-content-box-layout__ratio,
.tiny-content-box-layout__gap-value {
    display: none;
}

@media (max-width: 767.98px) {
    .tiny-content-image--start,
    .tiny-content-image--end {
        float: none;
        display: block;
        width: auto !important;
        max-width: 100% !important;
        margin: 0 auto 1rem;
    }

    .rsp-img-text,
    .tiny-content-side-by-side,
    .tiny-content-box-layout {
        flex-direction: column !important;
        gap: 1rem;
    }

    .rsp-img-col {
        order: 2 !important;
        width: 100% !important;
    }

    .rsp-txt-col { order: 1 !important; }
    .rsp-img-text[data-mobile-img="75%"] .rsp-img-col { width: 75% !important; }
    .rsp-img-text[data-mobile-img="50%"] .rsp-img-col { width: 50% !important; }
    .rsp-cols { grid-template-columns: 1fr !important; }
    .rsp-cols[data-mob-cols="2"] { grid-template-columns: 1fr 1fr !important; }

    .rsp-img-75,
    .rsp-img-50,
    .rsp-img-33,
    .rsp-img-25 {
        width: 100% !important;
    }

    .tiny-content-side-by-side__media,
    .tiny-content-side-by-side__text,
    .tiny-content-box-layout__box {
        flex: 1 1 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0;
    }

    .tiny-content-side-by-side--media-start .tiny-content-side-by-side__media,
    .tiny-content-side-by-side--media-end .tiny-content-side-by-side__text {
        order: 0;
    }

    .tiny-content-side-by-side--media-start .tiny-content-side-by-side__text,
    .tiny-content-side-by-side--media-end .tiny-content-side-by-side__media {
        order: 1;
    }

    .tiny-content-side-by-side__divider,
    .tiny-content-box-layout__divider {
        display: none !important;
    }
}
