/* Blog layout fixes - ensure proper float clearing and read-more positioning */
.blog .article-body {
    width: 100%;
    display: flow-root; /* Modern clearfix that creates new block formatting context */
}

.blog .newsberg-article-content {
    width: 100%;
    display: flow-root; /* Isolates floats */
}

.blog .newsberg-article-introtext {
    width: 100%;
    display: flow-root; /* Prevents float escape */
}

.blog .newsberg-article-introtext img {
    max-width: 100%;
    height: auto;
}

/* Fix malformed content HTML */
.blog .newsberg-article-introtext > br:first-child {
    display: none;
}

.blog .entry-content {
    width: 100%;
    display: flow-root; /* Critical: creates new block formatting context */
}

.blog .entry-content > *:last-child {
    margin-bottom: 0;
}

.blog .newsberg-article-introtext-bottom {
    clear: both !important;
    width: 100%;
}

/* Force read-more to always appear below content */
.blog .readmore {
    clear: both !important;
    display: block !important;
    width: 100% !important;
    margin-top: 20px !important;
    float: none !important;
}

.blog .readmore a {
    display: inline-block;
}

/* Ensure each article is contained properly */
.blog .item {
    margin-bottom: 30px;
    width: 100%;
}

/* Don't override Bootstrap grid - let it work naturally */
.blog .items-row {
    width: 100%;
}

/* Article info above styling */
.blog .article-info-above,
.blog .newsberg-title-top {
    margin-bottom: 10px;
    clear: both;
    width: 100%;
}

/* Ensure Twitter embeds render properly on blog layouts */
.blog .twitter-tweet {
    margin: 20px auto !important;
    clear: both;
    max-width: 100% !important;
}

.blog .twitter-tweet iframe {
    max-width: 100% !important;
}

/* Fix blockquotes and embedded content */
.blog blockquote {
    clear: both;
    margin-bottom: 20px;
}

.blog .wp-embedded-content {
    clear: both;
    margin-bottom: 20px;
}

.blog .wpdev-iframe-wrapper {
    clear: both;
    margin-bottom: 20px;
}

/* Force clear floats throughout article */
.blog .article-body > * {
    position: relative;
}

/* Ensure article image doesn't interfere with layout */
.blog .newsberg-article-image {
    clear: both;
    width: 100%;
    margin-bottom: 15px;
}

.blog .article-intro-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Additional fixes for malformed HTML */
.blog .newsberg-article-content a:not([href]) {
    display: block;
    width: 100%;
}

/* Ensure proper spacing after content */
.blog .article-body > div[style*="clear"] {
    height: 0;
    margin: 0;
    padding: 0;
    line-height: 0;
}

/* Force readmore outside any floated or positioned elements */
.blog .article-body > .readmore,
.blog .article-body > div[style*="clear"] + .readmore {
    position: static !important;
    transform: none !important;
}

/* Let Bootstrap handle the responsive grid naturally - don't override */

/* Clear any stray floats or positioning */
.blog .item.column-1,
.blog .item.column-2,
.blog .item.column-3 {
    width: 100% !important;
    float: none !important;
}

/* Nuclear option: force read-more to break out of any parent container issues caused by malformed HTML */
.blog article .readmore {
    clear: left !important;
    clear: right !important;
}

.blog article::after {
    content: "";
    display: table;
    clear: both;
}

/* Ensure article wraps all its floated children */
.blog .article-body::before,
.blog .article-body::after {
    content: "";
    display: table;
    clear: both;
}
