import re

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

old_code = '''        timeline.to(preloaderLogo, {
            opacity: 0,
            duration: 0.4,
            ease: "power2.inOut"
        }, "+=0.3")
        
        // Trigger hero title animation right as circle expands
        const heroWords = document.querySelectorAll(".hero-title .gsap-heading-word");
        if (heroWords.length > 0) {
            timeline.to(heroWords, {
                opacity: 1,
                y: 0,
                stagger: 0.08,
                duration: 0.7,
                ease: "power4.out"
            }, "-=0.1"); // Start at the same time as the circle expands
        }
          .to(preloaderCircle, {
              scale: 50,
              duration: 1.2,
              ease: "power3.inOut"
          }, "-=0.1")
          .to(preloader, {
              opacity: 0,
              duration: 0.6,
              ease: "power2.inOut"
          }, "-=0.6");'''

# Using a more robust regex replacement since spacing might be slightly different
import re
# Find the broken part
broken_pattern = r'\}\s*\.to\(preloaderCircle'
fixed_part = '} timeline.to(preloaderCircle'
if re.search(broken_pattern, content):
    content = re.sub(broken_pattern, fixed_part, content)
    with open('index.html', 'w', encoding='utf-8') as f:
        f.write(content)
    print("Syntax error fixed via regex.")
else:
    print("Pattern not found, maybe spacing is different.")

