.bb-lazy-embed {
    position: relative;
    display: block;
    width: 100%;
    max-width: 100%;
    aspect-ratio: var(--bb-embed-ratio, 16 / 9);
    margin: 10px 0;
    background: #111;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid #333;
    box-sizing: border-box;
    touch-action: manipulation;
}

.bb-lazy-embed--portrait {
    max-width: min(100%, 420px);
}

/* Fallback only when aspect-ratio is unsupported. */
@supports not (aspect-ratio: 16 / 9) {
    .bb-lazy-embed::before {
        content: '';
        display: block;
        padding-top: 56.25%;
    }
}

/* Once media is loaded, disable pseudo fallback spacing. */
.bb-lazy-embed[data-loaded="1"]::before {
    content: none;
    display: none;
}

.bb-lazy-embed-thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bb-lazy-embed--video .bb-lazy-embed-thumb {
    object-fit: contain;
    background: #000;
}

.bb-lazy-embed-label {
    position: absolute;
    left: 12px;
    top: 12px;
    color: #fff;
    background: rgba(0, 0, 0, 0.6);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.bb-lazy-embed-play {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 64px;
    height: 64px;
    transform: translate(-50%, -50%);
    border: 0;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 0, 0, 0.9);
    color: transparent;
    border-radius: 999px;
    font-size: 0;
    line-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
    -webkit-tap-highlight-color: transparent;
}

.bb-lazy-embed-play::before {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-top: 13px solid transparent;
    border-bottom: 13px solid transparent;
    border-left: 22px solid #fff;
    transform: translateX(3px);
}

.bb-lazy-embed:hover .bb-lazy-embed-play,
.bb-lazy-embed:focus-within .bb-lazy-embed-play {
    background: rgba(255, 0, 0, 1);
}

.bb-lazy-embed--youtube::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.05));
    pointer-events: none;
}

.bb-lazy-embed-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border: 0;
    display: block;
}

.bb-lazy-embed .bb-video {
    margin: 0 !important;
    border-radius: 0;
    box-shadow: none;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    object-fit: contain;
    background: #000;
}

.post_body .bb-lazy-embed .bb-video.bb-lazy-embed-frame {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
}

/* Default to half-width images on non-mobile screens. */
.post_body .slormImg {
    width: 50%;
    max-width: 50%;
    height: auto;
}

/* Keep Imgur suffix-sized images at their intended size. */
.post_body .slormImg.slormImg--imgur-sized {
    width: auto !important;
    max-width: 100% !important;
}

/* Keep images full-width on mobile. */
@media (max-width: 767.98px) {
    .post_body .slormImg {
        width: 100%;
        max-width: 100%;
    }

    .post_body .slormImg.slormImg--imgur-sized {
        width: auto !important;
        max-width: 100% !important;
    }
}

/* Keep videos/gifs narrower on non-mobile screens. */
.post_body video,
.post_body .bb-video,
.post_body .bb-video-wrap,
.post_body .bb-lazy-embed {
    width: 50% !important;
    max-width: 50% !important;
}

/* On mobile, media should fill the available post width. */
@media (max-width: 767.98px) {
    .post_body video,
    .post_body .bb-video,
    .post_body .bb-video-wrap,
    .post_body .bb-lazy-embed {
        width: 100% !important;
        max-width: 100% !important;
    }
}

.post_body .bb-video {
    height: auto !important;
}

.post_body .bb-video-wrap iframe,
.post_body .bb-video-wrap video,
.post_body .bb-lazy-embed-frame {
    max-width: 100% !important;
}

