I mean he "only" won California by 9
Kerry underperformed in many solid blue states (compared to the Clintons, Gore, and Obama), which is really how Dubya won the popular vote.
It is astounding the number of solidly Democratic states where Bush came within single digits in 2004. Bush lost Oregon by 4%, New Jersey and Washington by 7%, Delaware by 8%, Hawaii by 9%, and California by slightly under 10%. He "only" lost Illinois and Maryland by around 10-12%, and managed to reach the 40% mark in New York, the last Republican to do so. And of course, Bush was within single digits in Michigan, Minnesota, Maine, New Hampshire, and Pennsylvania as well, in addition to the other swing states that year.
Kerry really didnt underform by much in many of those states
OR PVI in 2004: Dem +6.6
OR PVI in 2016: Dem +8.9
NJ PVI in 2004: Dem +9.1
NJ PVI in 2016: Dem +12
DE PVI in 2004: Dem +10
DE PVI in 2016: Dem +9.3