/*
 * Crop/default is intentionally untouched.
 * The other modes only affect images to which the plugin adds its classes.
 */
.fil-wrap {
    max-width: 100%;
}

/*
 * For left/right, frontend.js promotes the layout to the theme's outer
 * preview container (for example Enfold's .big-preview). That outer block
 * must float; floating only the <img> wrapper is not enough when the theme
 * puts the preview in a separate header before .entry-content.
 */
.fil-preview--full-left,
.fil-preview--full-right {
    width: 40% !important;
    max-width: 40% !important;
    clear: none !important;
}

.fil-preview--full-left {
    float: left !important;
    margin: 0 1.5em 1em 0 !important;
}

.fil-preview--full-right {
    float: right !important;
    margin: 0 0 1em 1.5em !important;
}

.fil-preview--full-left > a,
.fil-preview--full-right > a,
.fil-preview--full-left .fil-wrap,
.fil-preview--full-right .fil-wrap {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    float: none !important;
}

/* Fallback for themes where no suitable outer preview container is found. */
.fil-wrap--full-left,
.fil-wrap--full-right {
    display: block;
    width: 40%;
    max-width: 40%;
}

.fil-wrap--full-left {
    float: left;
    margin: 0 1.5em 1em 0;
}

.fil-wrap--full-right {
    float: right;
    margin: 0 0 1em 1.5em;
}

.fil-image--full-left,
.fil-image--full-right {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
}

.fil-image--full-left {
    object-position: left top !important;
}

.fil-image--full-right {
    object-position: right top !important;
}

/* Do not let common theme rules clear the article text below our float. */
.entry-content-wrapper > .fil-preview--full-left + .entry-content,
.entry-content-wrapper > .fil-preview--full-right + .entry-content {
    clear: none !important;
}

.fil-wrap--full-width {
    display: block;
    width: 100%;
    max-width: 100%;
}

.fil-image--full-width {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
}

/* On narrow screens, avoid squeezing text into an unusably small column. */
@media (max-width: 600px) {
    .fil-preview--full-left,
    .fil-preview--full-right,
    .fil-wrap--full-left,
    .fil-wrap--full-right {
        float: none !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 1em !important;
    }
}
