Starfish Prime caused EMP damage in Honolulu... which was about 900 miles away - in the direction where the EMP effect was minimalized!
The Soviet Test damaged 570 km of power lines, 1000 km of buried power lines, and destroyed a power plant.
Both of which were experimental tests, in the upper atmosphere. In the event of a nuclear war, nobody is going to be nuking space.
And also, those tests were conducted before the protections were known to prevent that kind of damage.
A Faraday Cage is all you need. As I said, something stupid simple to make, and is included in almost all military equipment as part of it's design.
And other things cause EMPs, lightning, and solar flares for example. Which is why all commercial aircraft have such protections as part of their design. Aircraft get hit my lightning on a daily basis.
And is also included in many other equipment, because it protects against other similar problems. Such as building it in such shielding in satellites today. I worked at Hughes Satellite (now Boeing Satellite) in 2000-2001, and remember the engineers working hard to modify the birds to include them after the multiple failures from the 2000 event. For those that remember, a lot of birds went dark after solar flares took them out in 2000. Since then birds now incorporate such technology as part of their design, to keep it from happening again.
For example, all PATRIOT equipment have metal gaskets around all hatches. More then once I had a new kid question how a gasket of metal mesh would keep water from getting into the equipment. And each time I explained to them that the gasket was not to keep water out, the components were designed to not be effected by water. The mesh metal gasket was to create a Faraday Cage effect around all of the electronics, to keep them safe from any potential EMP. And conversely, it also protected them from either electronic monitoring, or from electronic interference from outside sources.
Back during the Cold War, many of the computers and other communications equipment we used in the military had similar technology incorporated into them. Not to protect against EMP, but to prevent eavesdropping remotely. Back then we called it TEMPEST. But it literally is the exact same technology. What works to keep emissions in also works to keep emissions out.
I am sure anybody that served from the late 1980's to early 1990's is familiar with the ugly AN/UYK series computers. They were big, green, and weighed a ton (a typical desktop came in 4 crates, and weighed over 250 pounds). And were horribly expensive, in the range of $10k in 1990 for an 80386. But they were quickly phased out for day to day use in the mid-1990's after the end of the Cold War, and the ever increasing speed and lower cost of computers that came after. The only computers similarly equipped today are the proprietary systems found in military equipment, which do not need speed because they only perform 1 or 2 functions.
And Faraday Cage technology is simple, they were invented in 1836. And I can bet that everybody has one in their kitchen and do not even know it.