from pathlib import Path

source = Path("/mnt/data/Pasted text(20261203-051802).txt")
css = source.read_text(encoding="utf-8")

addition = r"""

/* ==========================================================
   BLOG PAGE – ELEMENTOR FULL-WIDTH HERO
   Add the CSS class "blog-hero-full" to the OUTER hero container
   in Elementor. This only removes the theme width limit on the
   page that contains that hero; other pages and single posts stay
   unchanged.
   ========================================================== */

body.page #top:has(.blog-hero-full) {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

body.page #top > article.entry-wrap:has(.blog-hero-full) {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

body.page #top > article.entry-wrap:has(.blog-hero-full) > .entry-content {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

body.page #top > article.entry-wrap:has(.blog-hero-full) > .entry-content > .elementor {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

/* Full-width hero background and container */
body.page .blog-hero-full {
    display: flex !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden;
    background-size: cover !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
}

/* Elementor container inner width */
body.page .blog-hero-full > .e-con-inner,
body.page .blog-hero-full > .elementor-container {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
}

/* Avoid extra bottom spacing on widgets inside the hero */
body.page .blog-hero-full .elementor-widget {
    margin-bottom: 0;
}

/* Tablet */
@media (max-width: 1024px) {
    body.page #top:has(.blog-hero-full),
    body.page #top > article.entry-wrap:has(.blog-hero-full),
    body.page #top > article.entry-wrap:has(.blog-hero-full) > .entry-content,
    body.page #top > article.entry-wrap:has(.blog-hero-full) > .entry-content > .elementor {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    body.page .blog-hero-full {
        width: 100% !important;
        max-width: none !important;
        background-size: cover !important;
        background-position: center center !important;
    }
}

/* Mobile */
@media (max-width: 767px) {
    body.page .blog-hero-full {
        width: 100% !important;
        max-width: none !important;
        background-size: cover !important;
        background-position: center center !important;
    }

    body.page .blog-hero-full > .e-con-inner,
    body.page .blog-hero-full > .elementor-container {
        width: 100% !important;
        max-width: none !important;
    }
}
"""

# Ensure the appended block is separated from the existing final rule.
modified = css.rstrip() + "\n" + addition
out = Path("/mnt/data/astitva-reset-style-fullwidth-blog-fix.css")
out.write_text(modified, encoding="utf-8")

print(f"Created: {out.name}")
print(f"Total lines: {len(modified.splitlines())}")
