import sys, re

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

# Remove 'text-center' from the row container
content = content.replace('<div class="row gutter-y-40 text-center">', '<div class="row gutter-y-40">')

pattern = re.compile(
    r'<div class="service-card-two__title-wrapper"[^>]*>\s*'
    r'<h3 class="service-card-two__title" style="margin-bottom: 0;">(.*?)</h3>\s*'
    r'<div class="service-card-two__icon" style="margin: 0;">(.*?)</div>\s*'
    r'</div>', flags=re.DOTALL
)

def replace_structure(match):
    title = match.group(1).strip()
    icon = match.group(2).strip()
    return f'<div class="service-card-two__icon">{icon}</div>\n                                <h3 class="service-card-two__title">{title}</h3>'

content = pattern.sub(replace_structure, content)

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

print("Fixed services.html")
