/* Floating lesson images in Filament RichEditor and student portal */

.fi-fo-rich-editor-content .ProseMirror {
    position: relative;
    min-height: 18rem;
    isolation: isolate;
}

.fi-fo-rich-editor-content .ProseMirror > :not(.ysl-free-image-frame) {
    position: relative;
    z-index: 1;
}

.fi-fo-rich-editor-content .ProseMirror img.ysl-floating-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.fi-fo-rich-editor-content .ProseMirror img.ysl-floating-image--wrap-left {
    float: left;
    margin: 0 1rem 0.75rem 0;
    max-width: 45%;
}

.fi-fo-rich-editor-content .ProseMirror img.ysl-floating-image--wrap-right {
    float: right;
    margin: 0 0 0.75rem 1rem;
    max-width: 45%;
}

.fi-fo-rich-editor-content .ProseMirror li:has(img.ysl-floating-image--wrap-left),
.fi-fo-rich-editor-content .ProseMirror li:has(img.ysl-floating-image--wrap-right) {
    overflow: hidden;
}

.fi-fo-rich-editor-content .ProseMirror li:has(img.ysl-floating-image--wrap-left)::after,
.fi-fo-rich-editor-content .ProseMirror li:has(img.ysl-floating-image--wrap-right)::after {
    clear: both;
    content: '';
    display: block;
}

.fi-fo-rich-editor-content .ProseMirror .ysl-free-image-anchor {
    display: inline-block;
    width: 0 !important;
    height: 0 !important;
    line-height: 0;
    overflow: visible;
    vertical-align: top;
}

.fi-fo-rich-editor-content .ProseMirror > .ysl-free-image-frame {
    cursor: move;
    display: block;
    line-height: 0;
    pointer-events: auto;
    position: absolute;
    user-select: none;
    white-space: nowrap;
}

.fi-fo-rich-editor-content .ProseMirror > .ysl-free-image-frame img {
    border-radius: 8px;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
    display: block;
    max-width: min(70vw, 420px);
}

.fi-fo-rich-editor-content .ProseMirror > .ysl-free-image-frame.ysl-floating-image--behind {
    z-index: 0 !important;
}

.fi-fo-rich-editor-content .ProseMirror > .ysl-free-image-frame.ysl-floating-image--behind img {
    box-shadow: none;
    opacity: 0.45;
}

.fi-fo-rich-editor-content .ProseMirror > .ysl-free-image-frame.ysl-floating-image--free {
    z-index: 2 !important;
}

.student-course__richtext {
    position: relative;
    isolation: isolate;
}

.student-course__richtext > :not(.ysl-free-image-frame) {
    position: relative;
    z-index: 1;
}

.student-course__richtext img.ysl-floating-image {
    border-radius: 8px;
}

.student-course__richtext img.ysl-floating-image--wrap-left {
    float: left;
    margin: 0 1rem 0.75rem 0;
    max-width: 45%;
}

.student-course__richtext img.ysl-floating-image--wrap-right {
    float: right;
    margin: 0 0 0.75rem 1rem;
    max-width: 45%;
}

.student-course__richtext li:has(img.ysl-floating-image--wrap-left),
.student-course__richtext li:has(img.ysl-floating-image--wrap-right) {
    overflow: hidden;
}

.student-course__richtext li:has(img.ysl-floating-image--wrap-left)::after,
.student-course__richtext li:has(img.ysl-floating-image--wrap-right)::after {
    clear: both;
    content: '';
    display: block;
}

.student-course__richtext .ysl-free-image-anchor {
    display: inline-block;
    width: 0;
    height: 0;
    line-height: 0;
    overflow: visible;
    vertical-align: top;
}

.student-course__richtext .ysl-free-image-frame {
    display: block;
    line-height: 0;
    pointer-events: none;
    position: absolute;
    white-space: nowrap;
}

.student-course__richtext .ysl-free-image-frame img {
    display: block;
    max-width: min(100%, 420px);
}

.student-course__richtext .ysl-free-image-frame.ysl-floating-image--behind {
    z-index: 0 !important;
}

.student-course__richtext .ysl-free-image-frame.ysl-floating-image--behind img {
    opacity: 0.4;
}

.student-course__richtext .ysl-free-image-frame.ysl-floating-image--free {
    z-index: 2 !important;
}
