$content = [System.IO.File]::ReadAllText("index.html", [System.Text.Encoding]::UTF8)

# Fix Header Logo
$content = $content -replace 'park cubix log\.jpg', 'The-view-logo-transparent.png'
# Fix any remaining 'park cubix' image references
$content = $content -replace 'park cubix bird view\.jpg', 'Shriram-Shankari -Elevation-2.jpg'
$content = $content -replace 'Park Cubix amenities\.jpg', 'Shriram-Shankari -Amenities-01.jpg'
$content = $content -replace 'Salarpuria park cubix location map\.jpg', 'Shriram-Shankari -Location.jpg'

# 1. Fix USP Grid (I had injected <div class="usp-card reveal"> but didn't use the original formatting for h3, I used h3 but no icon class correctly, oh wait, I used <div class="usp-icon">. Looking at CSS, the original was <div class="usp-icon">, so my USP grid is actually fine. Let's make sure it has h3 and p, which it does. So USP is okay).

# 2. Fix Amenities Grid (I used <div class="amenities-grid"> but the CSS says <div class="amenity-grid">, and I used <h4> instead of <h3> for the title! And <p> instead of <ul class="amenity-list">).
$newAmenities = '<div class="amenity-grid">
                <div class="amenity-card reveal">
                    <div class="amenity-icon">&#127947;</div>
                    <h3>Health &amp; Fitness</h3>
                    <ul class="amenity-list">
                        <li><span>Fully-equipped gymnasium</span></li>
                        <li><span>Sprawling outdoor swimming pool</span></li>
                        <li><span>Dedicated yoga/meditation halls</span></li>
                        <li><span>Safe jogging and cycling loops</span></li>
                    </ul>
                </div>
                <div class="amenity-card reveal">
                    <div class="amenity-icon">&#128110;</div>
                    <h3>Convenience &amp; Safety</h3>
                    <ul class="amenity-list">
                        <li><span>In-house supermarket</span></li>
                        <li><span>Child daycare/crèche facility</span></li>
                        <li><span>24/7 multi-tier perimeter security</span></li>
                        <li><span>Piped gas lines</span></li>
                    </ul>
                </div>
                <div class="amenity-card reveal">
                    <div class="amenity-icon">&#127955;</div>
                    <h3>Sports &amp; Leisure</h3>
                    <ul class="amenity-list">
                        <li><span>Indoor gaming room</span></li>
                        <li><span>Multipurpose halls</span></li>
                        <li><span>Senior citizen seating pavilions</span></li>
                        <li><span>Kids play areas with sand pits</span></li>
                    </ul>
                </div>
                <div class="amenity-card reveal">
                    <div class="amenity-icon">&#9889;</div>
                    <h3>Power &amp; Tech</h3>
                    <ul class="amenity-list">
                        <li><span>Reputed modular fittings</span></li>
                        <li><span>Split AC points pre-provisioned</span></li>
                        <li><span>Structured partial power backup</span></li>
                    </ul>
                </div>
            </div>'
$content = $content -replace '(?s)<div class="amenities-grid">.*?</div>\s*</div>\s*</section>', "$newAmenities</div></section>"


# 3. Fix Location Section
# My previous injection placed <div style="display:grid..."> AND left the original <div class="location-grid"> map!
$newLocationHTML = '<div class="location-grid">
                <div class="location-map">
                    <img id="mapImage" src="Shriram-Shankari -Location.jpg" alt="Shriram Shankari Location Map" loading="lazy">
                </div>
                <div class="location-info">
                    <div class="proximity-wrapper">
                        <div class="proximity-section reveal">
                            <h3>&#128646; Transit Links</h3>
                            <div class="proximity-list">
                                <div class="proximity-item"><span class="proximity-place">GST Road</span><span class="proximity-time">5 mins (5 km)</span></div>
                                <div class="proximity-item"><span class="proximity-place">Outer Ring Road (ORR)</span><span class="proximity-time">10 mins</span></div>
                                <div class="proximity-item"><span class="proximity-place">Guduvanchery Railway Station</span><span class="proximity-time">15 mins</span></div>
                                <div class="proximity-item"><span class="proximity-place">Kilambakkam Bus Terminus</span><span class="proximity-time">20 mins</span></div>
                            </div>
                        </div>
                        <div class="proximity-section reveal">
                            <h3>&#127970; Tech &amp; Corporate Parks</h3>
                            <div class="proximity-list">
                                <div class="proximity-item"><span class="proximity-place">Estancia IT Park</span><span class="proximity-time">7 km</span></div>
                                <div class="proximity-item"><span class="proximity-place">Shriram The Gateway IT Zone</span><span class="proximity-time">14 km</span></div>
                                <div class="proximity-item"><span class="proximity-place">Mahindra World City</span><span class="proximity-time">18 km</span></div>
                                <div class="proximity-item"><span class="proximity-place">MEPZ</span><span class="proximity-time">19 km</span></div>
                                <div class="proximity-item"><span class="proximity-place">Zoho Corporation</span><span class="proximity-time"></span></div>
                            </div>
                        </div>
                        <div class="proximity-section reveal">
                            <h3>&#127891; Educational Institutions</h3>
                            <div class="proximity-list">
                                <div class="proximity-item"><span class="proximity-place">Velammal Vidhyashram</span><span class="proximity-time">2 km</span></div>
                                <div class="proximity-item"><span class="proximity-place">SRM Public School</span><span class="proximity-time">3 km</span></div>
                                <div class="proximity-item"><span class="proximity-place">SRM University campus</span><span class="proximity-time">8.9 km</span></div>
                                <div class="proximity-item"><span class="proximity-place">VIT Chennai campus</span><span class="proximity-time">15 km</span></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>'

# Let's cleanly replace the entire location grid area.
$content = $content -replace '(?s)<div style="display:grid; grid-template-columns: repeat\(auto-fit, minmax\(300px, 1fr\)\).*?</div>\s*</div>\s*</div>\s*</div>\s*</div>\s*</section>', "$newLocationHTML</div></section>"
# The above regex might be tricky if it doesn't match perfectly. Let's do a more robust approach.
# We know it starts with <div style="display:grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap:2rem; margin-top:2rem;">
# And the whole section ends at </section>. Let's replace from that div all the way to </section>!
$content = $content -replace '(?s)<div style="display:grid; grid-template-columns: repeat\(auto-fit, minmax\(300px, 1fr\)\).*?</section>', "$newLocationHTML</div></section>"

# 4. Fix Floor Plan Images (Currently they are placeholders)
$content = $content -replace '<div style="width:100%; height:100%; background:#f0f0f0; display:flex; align-items:center; justify-content:center; color:#888;">2 BHK Floor Plan</div>', '<img src="Shriram-Shankari -2bhk-Floorplan.jpg" alt="2 BHK Floor Plan">'
$content = $content -replace '<div style="width:100%; height:100%; background:#f0f0f0; display:flex; align-items:center; justify-content:center; color:#888;">3 BHK Floor Plan</div>', '<img src="Shriram-Shankari -TOWER PLAN-2.jpg" alt="3 BHK Floor Plan">'


# 5. Fix Gallery Section (Replace dummy images with actual gallery images)
$content = $content -replace 'gallery1\.jpg', 'Shriram-Shankari -Gallery-1.jpg'
$content = $content -replace 'gallery2\.jpg', 'Shriram-Shankari -Gallery-2.jpg'
$content = $content -replace 'gallery3\.jpg', 'Shriram-Shankari -Gallery-3.jpg'
$content = $content -replace 'gallery4\.jpg', 'Shriram-Shankari -Gallery-4.jpg'
$content = $content -replace 'gallery5\.jpg', 'Shriram-Shankari -Gallery-5.jpg'
$content = $content -replace 'gallery6\.jpg', 'Shriram-Shankari -Elevation-2.jpg'


# 6. Fix FAQ arrow icons (I used &#43; but CSS expects an arrow class maybe? The CSS says .faq-arrow { transform: rotate(180deg); } )
$content = $content -replace '<div class="faq-icon">&#43;</div>', '<div class="faq-arrow">&#9660;</div>'

[System.IO.File]::WriteAllText("index.html", $content, [System.Text.Encoding]::UTF8)
