import re

with open('index.html', 'r', encoding='utf-8') as f:
    html = f.read()

# Find inquiry section boundaries
inquiry_start = html.find('<section id="inquiry-section"')
if inquiry_start == -1:
    print("Inquiry section not found")
    exit()

# Find the matching closing tag for inquiry section
inquiry_end = html.find('</section>', inquiry_start) + len('</section>')

# Extract inquiry section
inquiry_content = html[inquiry_start:inquiry_end]

# Remove inquiry section from html
html = html[:inquiry_start] + html[inquiry_end:]

# Find gallery section
gallery_start = html.find('<section id="gallery-grid"')
if gallery_start == -1:
    print("Gallery section not found")
    exit()

# Find closing tag for gallery section
gallery_end = html.find('</section>', gallery_start) + len('</section>')

# Insert inquiry section after gallery section
html = html[:gallery_end] + '\n\n    ' + inquiry_content + html[gallery_end:]

with open('index.html', 'w', encoding='utf-8') as f:
    f.write(html)

print("Moved inquiry section after gallery section.")
