import os

# 1. Remove viewport from layout.tsx
layout_path = 'src/app/layout.tsx'
with open(layout_path, 'r') as f:
    layout_content = f.read()

layout_content = layout_content.replace("export const viewport = {\n  width: 'device-width',\n  initialScale: 1,\n};\n", "")

with open(layout_path, 'w') as f:
    f.write(layout_content)

# 2. Revert footer grid in page.tsx
page_path = 'src/app/page.tsx'
with open(page_path, 'r') as f:
    page_content = f.read()

# Change it to just be a standard horizontal flex / grid that matches desktop
page_content = page_content.replace('className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-5 gap-8 lg:gap-12 mb-16"', 'className="grid grid-cols-2 md:grid-cols-5 gap-8 mb-16"')
page_content = page_content.replace('className="col-span-1 sm:col-span-2 lg:col-span-1"', 'className="col-span-2 md:col-span-1"')

# Change CTA back to flex-row unconditionally, but with text sizes that don't overflow
page_content = page_content.replace('className="bg-gradient-to-r from-emerald-600 to-teal-700 rounded-3xl p-6 md:p-10 flex flex-col lg:flex-row items-center justify-between gap-6 overflow-hidden"', 'className="bg-gradient-to-r from-emerald-600 to-teal-700 rounded-3xl p-6 md:p-10 flex flex-row items-center justify-between gap-4 overflow-hidden"')

with open(page_path, 'w') as f:
    f.write(page_content)

print("Reverted mobile layout overrides.")
