Deductions for home sale

I sold my primary residence in 2024 for 800,000.  I realize I get a 500,000 deduction for married.  Why can’t I deduct what I originally paid for the house, improvements such as roof, heating, pool, etc.?