const fs = require('fs');
const file = 'src/components/SpatialSanctuary.tsx';
let content = fs.readFileSync(file, 'utf8');

// Fix cream/dark green cards padding
content = content.replace(/rounded-2xl shadow-sm p-6 flex flex-col/g, 'rounded-2xl shadow-sm p-4 sm:p-6 flex flex-col');

// Fix intro card 4, 6, 9, 10, 12 small subtitle
content = content.replace(/<span className="font-sans text-sm tracking-\[0.25em\] uppercase text-\[\#bc9e65\] font-bold block mb-1">/g, '<span className="font-sans text-[10px] sm:text-sm tracking-[0.2em] sm:tracking-[0.25em] uppercase text-[#bc9e65] font-bold block mb-1">');
content = content.replace(/<span className="font-sans text-sm sm:text-sm tracking-\[0.25em\] uppercase text-\[\#bc9e65\] font-bold block mb-1">/g, '<span className="font-sans text-[10px] sm:text-sm tracking-[0.2em] sm:tracking-[0.25em] uppercase text-[#bc9e65] font-bold block mb-1">');

// Fix intro card 4, 6, 9, 10, 12 title
content = content.replace(/<h3 className="font-serif text-lg sm:text-lg font-bold tracking-wider text-\[\#0a4a2b\] uppercase mb-2">/g, '<h3 className="font-serif text-base sm:text-lg font-bold tracking-wider text-[#0a4a2b] uppercase mb-1 sm:mb-2">');
content = content.replace(/<h3 className="font-serif text-lg sm:text-lg font-bold tracking-wider text-white uppercase mb-2">/g, '<h3 className="font-serif text-base sm:text-lg font-bold tracking-wider text-white uppercase mb-1 sm:mb-2">');

// Fix intro card 4, 6, 9, 10, 12 desc
content = content.replace(/<p className="font-sans text-base sm:text-base text-stone-700 leading-relaxed">/g, '<p className="font-sans text-xs sm:text-base text-stone-700 leading-snug sm:leading-relaxed">');
content = content.replace(/<p className="font-sans text-base sm:text-base text-\[\#e4d7bc\] leading-relaxed">/g, '<p className="font-sans text-xs sm:text-base text-[#e4d7bc] leading-snug sm:leading-relaxed">');

// Fix image cards padding
content = content.replace(/<div className="absolute inset-x-0 bottom-0 bg-gradient-to-t from-black\/90 via-black\/60 to-transparent p-4 z-20">/g, '<div className="absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/90 via-black/60 to-transparent p-3 sm:p-4 z-20">');

// Fix image cards subtitle
content = content.replace(/<span className="font-sans text-sm tracking-\[0.15em\] text-\[\#bc9e65\] font-bold uppercase block mb-0.5">/g, '<span className="font-sans text-[10px] sm:text-sm tracking-[0.1em] sm:tracking-[0.15em] text-[#bc9e65] font-bold uppercase block mb-0.5">');

// Fix image cards title
content = content.replace(/<h4 className="font-serif text-sm font-bold text-white uppercase tracking-wider leading-tight">/g, '<h4 className="font-serif text-xs sm:text-sm font-bold text-white uppercase tracking-wider leading-tight">');

// Write back
fs.writeFileSync(file, content);
console.log('Fixed cards formatting');
