import os
import shutil
import re

# 1. Clean copy of the PDFs with friendly names in assets/pdf/
pdf_dir = r"d:\iss\Franciscan Society\assets\pdf"
downloads = r"C:\Users\Abhiram P M\Downloads"

pdf_map = {
    "Jnanadeepa May- Aug 2025-5-9.pdf": "jnanadeepa-may-aug-2025.pdf",
    "Jnanadeepa May- Aug 2025-65-98.pdf": "jnanadeepa-may-aug-2025-pastoral-conversion.pdf",
    "Jnanadeepa OCT - DEC 2025-213-257.pdf": "jnanadeepa-oct-dec-2025-eco-theology.pdf",
    "Word and Worship Inner Page (9)-63-92.pdf": "word-and-worship-2026.pdf"
}

for src_name, dst_name in pdf_map.items():
    src_path = os.path.join(downloads, src_name)
    dst_path = os.path.join(pdf_dir, dst_name)
    if os.path.exists(src_path):
        shutil.copy2(src_path, dst_path)
        print(f"Copied {src_name} -> {dst_path}")

# 2. Build complete publications.html content
publications_list_html = """        <!-- Publications & Articles List -->
        <section class="has-vine-watermark" style="position: relative; padding: clamp(3.5rem, 6vw, 5.5rem) 0; background-color: #FFFFFF; color: #1c1917; min-height: 600px; overflow: hidden;">
            <div class="vine-corner-watermark" aria-hidden="true"></div>
            <div style="max-width: 1200px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.5rem); position: relative; z-index: 2;">
                
                <!-- Section Header -->
                <div style="text-align: center; margin-bottom: clamp(3rem, 6vw, 4.5rem);">
                    <h2 style="font-family: 'Phudu', sans-serif; font-size: clamp(2rem, 4vw, 2.8rem); font-weight: 700; color: #1c1917; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.8rem;">
                        ARTICLES &amp; RESEARCH
                    </h2>
                    <p style="font-family: 'Instrument Sans', sans-serif; font-size: 1.05rem; color: #78716c; max-width: 650px; margin: 0 auto;">
                        Scholarly papers, theological treatises, and peer-reviewed publications authored by our Franciscan Friars.
                    </p>
                </div>

                <!-- Articles Container -->
                <div style="display: flex; flex-direction: column; gap: 0;">

                    <!-- Publication 1: Jnanadeepa Marriage and Family -->
                    <div style="display: grid; grid-template-columns: minmax(80px, 120px) minmax(140px, 200px) 1fr auto; gap: clamp(1.2rem, 3vw, 2.5rem); align-items: center; padding: clamp(2rem, 4vw, 3rem) 0; border-top: 1px solid #f0ece1;" class="publication-item">
                        <div style="display: flex; flex-direction: column; align-items: flex-start; justify-content: center; font-family: 'Phudu', sans-serif;">
                            <span style="font-size: clamp(2.4rem, 4vw, 3.4rem); font-weight: 300; line-height: 1; color: #4A2A18;">05</span>
                            <span style="font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: #78716c; margin-top: 0.35rem; font-family: 'Instrument Sans', sans-serif;">MAY - AUG<br>2025</span>
                        </div>
                        <div style="width: 100%; aspect-ratio: 4/3; border-radius: 12px; overflow: hidden; box-shadow: 0 8px 20px rgba(74,42,24,0.12); border: 1px solid rgba(230,200,136,0.3); background: #FAF7F0;">
                            <img loading="lazy" decoding="async" src="assets/images/gallery/WhatsApp Image 2026-08-07 at 10.18.29 AM.jpeg" alt="Pope Francis Teachings on Marriage and Family" style="width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease;" onmouseover="this.style.transform='scale(1.05)'" onmouseout="this.style.transform='scale(1)'">
                        </div>
                        <div>
                            <h3 style="font-family: 'Phudu', sans-serif; font-size: clamp(1.15rem, 2.2vw, 1.4rem); font-weight: 700; color: #1c1917; text-transform: uppercase; letter-spacing: 0.02em; margin: 0 0 0.65rem 0; line-height: 1.35;">
                                Jnanadeepa: Pune Journal of Religious Studies
                            </h3>
                            <p style="font-family: 'Instrument Sans', sans-serif; font-size: clamp(0.92rem, 1.6vw, 1rem); color: #57534e; line-height: 1.65; margin: 0 0 0.85rem 0; font-weight: 400;">
                                Pope Francis’ Teachings on Marriage and Family
                            </p>
                            <div style="display: flex; align-items: center; gap: 0.5rem; font-family: 'Instrument Sans', sans-serif; font-size: 0.84rem; color: #78716c; font-weight: 500;">
                                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/><polyline points="10 9 9 9 8 9"/></svg>
                                <span>Religious Studies &amp; Theology • PDF Document</span>
                            </div>
                        </div>
                        <div style="white-space: nowrap;">
                            <a href="assets/pdf/jnanadeepa-may-aug-2025.pdf" target="_blank" class="pub-btn" style="display: inline-flex; align-items: center; gap: 0.6rem; padding: 0.8rem 1.8rem; border: 1.5px solid #c4a45a; border-radius: 4px; background: transparent; color: #4A2A18; font-family: 'Instrument Sans', sans-serif; font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; text-decoration: none; transition: all 0.3s ease;" onmouseover="this.style.background='#4A2A18'; this.style.color='#ffffff'; this.style.borderColor='#4A2A18';" onmouseout="this.style.background='transparent'; this.style.color='#4A2A18'; this.style.borderColor='#c4a45a';">
                                VIEW PDF
                                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg>
                            </a>
                        </div>
                    </div>

                    <!-- Publication 2: Jnanadeepa Pastoral Conversion -->
                    <div style="display: grid; grid-template-columns: minmax(80px, 120px) minmax(140px, 200px) 1fr auto; gap: clamp(1.2rem, 3vw, 2.5rem); align-items: center; padding: clamp(2rem, 4vw, 3rem) 0; border-top: 1px solid #f0ece1;" class="publication-item">
                        <div style="display: flex; flex-direction: column; align-items: flex-start; justify-content: center; font-family: 'Phudu', sans-serif;">
                            <span style="font-size: clamp(2.4rem, 4vw, 3.4rem); font-weight: 300; line-height: 1; color: #4A2A18;">15</span>
                            <span style="font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: #78716c; margin-top: 0.35rem; font-family: 'Instrument Sans', sans-serif;">MAY - AUG<br>2025</span>
                        </div>
                        <div style="width: 100%; aspect-ratio: 4/3; border-radius: 12px; overflow: hidden; box-shadow: 0 8px 20px rgba(74,42,24,0.12); border: 1px solid rgba(230,200,136,0.3); background: #FAF7F0;">
                            <img loading="lazy" decoding="async" src="assets/images/gallery/WhatsApp Image 2026-08-07 at 1.39.46 PM (2).jpeg" alt="Pastoral Conversion in Shaping Pastoral Ministry" style="width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease;" onmouseover="this.style.transform='scale(1.05)'" onmouseout="this.style.transform='scale(1)'">
                        </div>
                        <div>
                            <h3 style="font-family: 'Phudu', sans-serif; font-size: clamp(1.15rem, 2.2vw, 1.4rem); font-weight: 700; color: #1c1917; text-transform: uppercase; letter-spacing: 0.02em; margin: 0 0 0.65rem 0; line-height: 1.35;">
                                Jnanadeepa: Pune Journal of Religious Studies
                            </h3>
                            <p style="font-family: 'Instrument Sans', sans-serif; font-size: clamp(0.92rem, 1.6vw, 1rem); color: #57534e; line-height: 1.65; margin: 0 0 0.85rem 0; font-weight: 400;">
                                The Central Role of Pastoral Conversion in Shaping Pastoral Ministry
                            </p>
                            <div style="display: flex; align-items: center; gap: 0.5rem; font-family: 'Instrument Sans', sans-serif; font-size: 0.84rem; color: #78716c; font-weight: 500;">
                                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>
                                <span>Fr. Gigesh Meckel, TOR • Vol. 29/2</span>
                            </div>
                        </div>
                        <div style="white-space: nowrap;">
                            <a href="assets/pdf/jnanadeepa-may-aug-2025-pastoral-conversion.pdf" target="_blank" class="pub-btn" style="display: inline-flex; align-items: center; gap: 0.6rem; padding: 0.8rem 1.8rem; border: 1.5px solid #c4a45a; border-radius: 4px; background: transparent; color: #4A2A18; font-family: 'Instrument Sans', sans-serif; font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; text-decoration: none; transition: all 0.3s ease;" onmouseover="this.style.background='#4A2A18'; this.style.color='#ffffff'; this.style.borderColor='#4A2A18';" onmouseout="this.style.background='transparent'; this.style.color='#4A2A18'; this.style.borderColor='#c4a45a';">
                                VIEW PDF
                                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg>
                            </a>
                        </div>
                    </div>

                    <!-- Publication 3: Jnanadeepa Eco-Theology -->
                    <div style="display: grid; grid-template-columns: minmax(80px, 120px) minmax(140px, 200px) 1fr auto; gap: clamp(1.2rem, 3vw, 2.5rem); align-items: center; padding: clamp(2rem, 4vw, 3rem) 0; border-top: 1px solid #f0ece1;" class="publication-item">
                        <div style="display: flex; flex-direction: column; align-items: flex-start; justify-content: center; font-family: 'Phudu', sans-serif;">
                            <span style="font-size: clamp(2.4rem, 4vw, 3.4rem); font-weight: 300; line-height: 1; color: #4A2A18;">20</span>
                            <span style="font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: #78716c; margin-top: 0.35rem; font-family: 'Instrument Sans', sans-serif;">SEP - DEC<br>2025</span>
                        </div>
                        <div style="width: 100%; aspect-ratio: 4/3; border-radius: 12px; overflow: hidden; box-shadow: 0 8px 20px rgba(74,42,24,0.12); border: 1px solid rgba(230,200,136,0.3); background: #FAF7F0;">
                            <img loading="lazy" decoding="async" src="assets/images/gallery/WhatsApp Image 2026-08-07 at 8.42.19 AM (2).jpeg" alt="Harmonizing Human Welfare and Intrinsic Value" style="width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease;" onmouseover="this.style.transform='scale(1.05)'" onmouseout="this.style.transform='scale(1)'">
                        </div>
                        <div>
                            <h3 style="font-family: 'Phudu', sans-serif; font-size: clamp(1.15rem, 2.2vw, 1.4rem); font-weight: 700; color: #1c1917; text-transform: uppercase; letter-spacing: 0.02em; margin: 0 0 0.65rem 0; line-height: 1.35;">
                                Jnanadeepa: Pune Journal of Religious Studies
                            </h3>
                            <p style="font-family: 'Instrument Sans', sans-serif; font-size: clamp(0.92rem, 1.6vw, 1rem); color: #57534e; line-height: 1.65; margin: 0 0 0.85rem 0; font-weight: 400;">
                                Harmonizing Human Welfare and Intrinsic Value: Hierarchical Theology in Catholic Eco-Theology
                            </p>
                            <div style="display: flex; align-items: center; gap: 0.5rem; font-family: 'Instrument Sans', sans-serif; font-size: 0.84rem; color: #78716c; font-weight: 500;">
                                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>
                                <span>Fr. Gigesh Thomas Meckel, TOR • Vol. 29/3</span>
                            </div>
                        </div>
                        <div style="white-space: nowrap;">
                            <a href="assets/pdf/jnanadeepa-oct-dec-2025-eco-theology.pdf" target="_blank" class="pub-btn" style="display: inline-flex; align-items: center; gap: 0.6rem; padding: 0.8rem 1.8rem; border: 1.5px solid #c4a45a; border-radius: 4px; background: transparent; color: #4A2A18; font-family: 'Instrument Sans', sans-serif; font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; text-decoration: none; transition: all 0.3s ease;" onmouseover="this.style.background='#4A2A18'; this.style.color='#ffffff'; this.style.borderColor='#4A2A18';" onmouseout="this.style.background='transparent'; this.style.color='#4A2A18'; this.style.borderColor='#c4a45a';">
                                VIEW PDF
                                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg>
                            </a>
                        </div>
                    </div>

                    <!-- Publication 4: Word & Worship -->
                    <div style="display: grid; grid-template-columns: minmax(80px, 120px) minmax(140px, 200px) 1fr auto; gap: clamp(1.2rem, 3vw, 2.5rem); align-items: center; padding: clamp(2rem, 4vw, 3rem) 0; border-top: 1px solid #f0ece1;" class="publication-item">
                        <div style="display: flex; flex-direction: column; align-items: flex-start; justify-content: center; font-family: 'Phudu', sans-serif;">
                            <span style="font-size: clamp(2.4rem, 4vw, 3.4rem); font-weight: 300; line-height: 1; color: #4A2A18;">01</span>
                            <span style="font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: #78716c; margin-top: 0.35rem; font-family: 'Instrument Sans', sans-serif;">JAN - JUN<br>2026</span>
                        </div>
                        <div style="width: 100%; aspect-ratio: 4/3; border-radius: 12px; overflow: hidden; box-shadow: 0 8px 20px rgba(74,42,24,0.12); border: 1px solid rgba(230,200,136,0.3); background: #FAF7F0;">
                            <img loading="lazy" decoding="async" src="assets/images/gallery/IMG_1157.JPG" alt="Word and Worship Theological Perspectives" style="width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease;" onmouseover="this.style.transform='scale(1.05)'" onmouseout="this.style.transform='scale(1)'">
                        </div>
                        <div>
                            <h3 style="font-family: 'Phudu', sans-serif; font-size: clamp(1.15rem, 2.2vw, 1.4rem); font-weight: 700; color: #1c1917; text-transform: uppercase; letter-spacing: 0.02em; margin: 0 0 0.65rem 0; line-height: 1.35;">
                                Word &amp; Worship: Journal of Pastoral Liturgy &amp; Catechetics
                            </h3>
                            <p style="font-family: 'Instrument Sans', sans-serif; font-size: clamp(0.92rem, 1.6vw, 1rem); color: #57534e; line-height: 1.65; margin: 0 0 0.85rem 0; font-weight: 400;">
                                The Poor as Sacrament of Divine Encounter: Liberationist and Thomistic Perspectives
                            </p>
                            <div style="display: flex; align-items: center; gap: 0.5rem; font-family: 'Instrument Sans', sans-serif; font-size: 0.84rem; color: #78716c; font-weight: 500;">
                                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>
                                <span>Fr. Gigesh Meckel, TOR • Vol. 59, No. 1</span>
                            </div>
                        </div>
                        <div style="white-space: nowrap;">
                            <a href="assets/pdf/word-and-worship-2026.pdf" target="_blank" class="pub-btn" style="display: inline-flex; align-items: center; gap: 0.6rem; padding: 0.8rem 1.8rem; border: 1.5px solid #c4a45a; border-radius: 4px; background: transparent; color: #4A2A18; font-family: 'Instrument Sans', sans-serif; font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; text-decoration: none; transition: all 0.3s ease;" onmouseover="this.style.background='#4A2A18'; this.style.color='#ffffff'; this.style.borderColor='#4A2A18';" onmouseout="this.style.background='transparent'; this.style.color='#4A2A18'; this.style.borderColor='#c4a45a';">
                                VIEW PDF
                                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg>
                            </a>
                        </div>
                    </div>

                    <!-- Publication 5: PubMed Peer-Reviewed Paper -->
                    <div style="display: grid; grid-template-columns: minmax(80px, 120px) minmax(140px, 200px) 1fr auto; gap: clamp(1.2rem, 3vw, 2.5rem); align-items: center; padding: clamp(2rem, 4vw, 3rem) 0; border-top: 1px solid #f0ece1; border-bottom: 1px solid #f0ece1;" class="publication-item">
                        <div style="display: flex; flex-direction: column; align-items: flex-start; justify-content: center; font-family: 'Phudu', sans-serif;">
                            <span style="font-size: clamp(2.4rem, 4vw, 3.4rem); font-weight: 300; line-height: 1; color: #4A2A18;">11</span>
                            <span style="font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: #78716c; margin-top: 0.35rem; font-family: 'Instrument Sans', sans-serif;">MAY<br>2017</span>
                        </div>
                        <div style="width: 100%; aspect-ratio: 4/3; border-radius: 12px; overflow: hidden; box-shadow: 0 8px 20px rgba(74,42,24,0.12); border: 1px solid rgba(230,200,136,0.3); background: #FAF7F0;">
                            <img loading="lazy" decoding="async" src="assets/images/new_uploads/ChatGPT_Image_Aug_18_2026_05_24_08_PM.png" alt="Farmer suicide in India biotechnology research" style="width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease;" onmouseover="this.style.transform='scale(1.05)'" onmouseout="this.style.transform='scale(1)'">
                        </div>
                        <div>
                            <h3 style="font-family: 'Phudu', sans-serif; font-size: clamp(1.15rem, 2.2vw, 1.4rem); font-weight: 700; color: #1c1917; text-transform: uppercase; letter-spacing: 0.02em; margin: 0 0 0.65rem 0; line-height: 1.35;">
                                Farmer-suicide in India: debating the role of biotechnology
                            </h3>
                            <p style="font-family: 'Instrument Sans', sans-serif; font-size: clamp(0.92rem, 1.6vw, 1rem); color: #57534e; line-height: 1.65; margin: 0 0 0.85rem 0; font-weight: 400;">
                                Indian Biotech opponents have attributed the increase of suicides to the monopolization of GM seeds, centering on patent control, application of terminator technology, marketing strategy, and increased production costs.
                            </p>
                            <div style="display: flex; align-items: center; gap: 0.5rem; font-family: 'Instrument Sans', sans-serif; font-size: 0.84rem; color: #78716c; font-weight: 500;">
                                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>
                                <span>National Library of Medicine (PubMed: 28497354) • Peer-Reviewed Paper</span>
                            </div>
                        </div>
                        <div style="white-space: nowrap;">
                            <a href="https://pubmed.ncbi.nlm.nih.gov/28497354/" target="_blank" rel="noopener noreferrer" class="pub-btn" style="display: inline-flex; align-items: center; gap: 0.6rem; padding: 0.8rem 1.8rem; border: 1.5px solid #c4a45a; border-radius: 4px; background: transparent; color: #4A2A18; font-family: 'Instrument Sans', sans-serif; font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; text-decoration: none; transition: all 0.3s ease;" onmouseover="this.style.background='#4A2A18'; this.style.color='#ffffff'; this.style.borderColor='#4A2A18';" onmouseout="this.style.background='transparent'; this.style.color='#4A2A18'; this.style.borderColor='#c4a45a';">
                                VIEW ARTICLE
                                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg>
                            </a>
                        </div>
                    </div>

                </div>

            </div>
        </section>"""

# Replace main section in publications.html
with open('publications.html', 'r', encoding='utf-8') as f:
    pub_c = f.read()

hero_pattern = re.compile(r'<section style="padding: 11rem 2rem 7rem 2rem;.*?</section>', re.DOTALL)
new_hero = """    <!-- Page Hero -->
    <section style="padding: 11rem 2rem 7rem 2rem; background-image: url('assets/images/new_uploads/ChatGPT_Image_Aug_18_2026_05_51_30_PM.png'); background-size: cover; background-position: center; position: relative; overflow: hidden;">
        <div style="position: absolute; inset: 0; background-color: rgba(12, 11, 10, 0.72);"></div>
        <div style="max-width: 800px; margin: 0 auto; position: relative; z-index: 2; text-align: center;">
            <div style="display: inline-flex; align-items: center; gap: 0.6rem; background: rgba(255,255,255,0.1); backdrop-filter: blur(10px); padding: 0.5rem 1.2rem; border-radius: 50px; margin-bottom: 1.5rem; border: 1px solid rgba(255,255,255,0.2);">
                <span style="width: 8px; height: 8px; background-color: #e6c888; border-radius: 50%; display: inline-block;"></span>
                <span style="color: #ffffff; font-size: 0.85rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; font-family: 'Instrument Sans', sans-serif;">SCHOLARSHIP &amp; ESSAYS</span>
            </div>
            <h1 style="font-family: 'Phudu', sans-serif; font-size: clamp(2.8rem, 5vw, 4.2rem); font-weight: 700; color: #ffffff; text-transform: uppercase; margin: 0;">PUBLICATIONS</h1>
        </div>
    </section>"""

main_regex = re.compile(r'<main id="main-content"[^>]*>.*?</main>', re.DOTALL)
pub_c = main_regex.sub(f'<main id="main-content" style="padding-top: 0; background-color: #FFFFFF;">\n{new_hero}\n{publications_list_html}\n    </main>', pub_c)

with open('publications.html', 'w', encoding='utf-8') as f:
    f.write(pub_c)
print("Updated publications.html with all 4 PDFs + PubMed paper!")

# 3. Global Responsive Breakpoint Fix across CSS and all 34 HTML files
responsive_header_css = """
/* ============================================================
   RESPONSIVE TABLET & DESKTOP NAVIGATION BREAKPOINT (1200px)
   ============================================================ */
@media (min-width: 1201px) {
    .fs-desktop-nav {
        display: flex !important;
        gap: clamp(0.75rem, 1.3vw, 1.8rem) !important;
        align-items: center !important;
    }
    .fs-desktop-nav a,
    .fs-desktop-nav button,
    .fs-desktop-nav .fs-mega-toggle {
        font-size: clamp(0.82rem, 0.9vw, 0.9rem) !important;
        white-space: nowrap !important;
    }
    .fs-mobile-toggle {
        display: none !important;
    }
    .fs-mobile-nav,
    .mobile-nav-drawer {
        display: none !important;
    }
    .fs-header-inner {
        max-width: 1440px !important;
        width: 100% !important;
    }
}

@media (max-width: 1200px) {
    .fs-desktop-nav {
        display: none !important;
    }
    .fs-mega-menu {
        display: none !important;
    }
    .fs-mobile-toggle {
        display: flex !important;
    }
    .fs-header-actions {
        order: 1 !important;
        display: flex !important;
        align-items: center !important;
    }
    .fs-logo {
        order: 2 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
    }
    .fs-logo img {
        height: 38px !important;
        width: auto !important;
        max-width: 48px !important;
    }
    .fs-logo-text {
        display: none !important;
    }
}
"""

with open(r'css\styles.css', 'r', encoding='utf-8') as f:
    c = f.read()
c += "\n" + responsive_header_css
with open(r'css\styles.css', 'w', encoding='utf-8') as f:
    f.write(c)

with open(r'css\design-system.css', 'r', encoding='utf-8') as f:
    c = f.read()
c += "\n" + responsive_header_css
with open(r'css\design-system.css', 'w', encoding='utf-8') as f:
    f.write(c)

# Inject into all 34 HTML files
html_files = [f for f in os.listdir('.') if f.endswith('.html')]
for fname in html_files:
    with open(fname, 'r', encoding='utf-8') as f:
        content = f.read()
        
    if 'id="custom-menu-active-styles"' in content:
        content = re.sub(
            r'(<style id="custom-menu-active-styles">)',
            r'\1\n' + responsive_header_css + '\n',
            content
        )
    elif '<head>' in content:
        content = content.replace('</head>', f'<style>\n{responsive_header_css}\n</style>\n</head>', 1)
        
    with open(fname, 'w', encoding='utf-8') as f:
        f.write(content)

print(f"Applied 1200px responsive navbar breakpoint across all {len(html_files)} HTML files!")
