import re

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

# Find the friars section
idx_start = content.find('<section id="friars-section"')
idx_end = content.find('</section>', idx_start)

friars_html = content[idx_start:idx_end]

# Change text colors for dark mode
friars_html = friars_html.replace('color: #1c1917;', 'color: #ffffff;')
friars_html = friars_html.replace('color: #57534e;', 'color: rgba(255, 255, 255, 0.7);')

# The Necrology list is inside a white card, so its inner elements shouldn't be touched.
# But wait, my replace might have touched the inner elements if they had those colors.
# Let's check if there are inner colors that we accidentally changed.
# Necrology list doesn't have explicit color: #1c1917 on the list items, they inherit.
# The card has background: #FFFFFF; we should make sure the text inside the card is still dark.
# Let's add color: #1c1917 to the Necrology card style explicitly, just in case.

friars_html = friars_html.replace('background: #FFFFFF; padding: 2rem;', 'background: #FFFFFF; color: #1c1917; padding: 2rem;')

content = content[:idx_start] + friars_html + content[idx_end:]

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

print("Fixed text colors in friars-section")
