Nice post Joe.
The Compass is aligning itself with those magical lines of Flux extending from one pole to the other.
The compass will always point to north, unless somebody parked a Car right next to your compass.
That Car becomes a 'Deviation' and the lines will swarm around it one way or the other and your compass will point to the greater collection of those distorted lines.
Lay your Pistol up on your dash, behind your Binical and it becomes a Deviation. your Binical will always lead you to your Pistol.
The Closer to the earths core, the more accurate the compass will be. The lines are more concentrated down there.
Assuming there's no Deviation of those lines.
The Higher you go, up in the air, the less the effect will be on your compass. You are getting away from that group of lines.
I forgot to mention the Balls near your compass that function as a counter measure to the Distortion of those Flux lines that the Hull of your Sub or Aircraft Carrier become. That's how a Magnetic compass on a Sub stays on course.
Those Motorized Gyros (Directional Gyros) are used as a quick reference. My flight instructor told me to use it first. After awhile they get a little off course and you have to adjust them, but for hours n' hours of continued use they are normally sufficient for reference. Lot's easier to read than that little thing up above the Cocpit windshield.
A magnetic compass with a Small card, something less than a Foot or so across is a real difficult thing to navigate by.
The closer you get to the Poles of the Earth, the less accurate your Magnetic compass will be, because the lines are so concentrated the Compass has too many similar choices. The needle will wander back and forth, sometimes stopping, but then continuing on, and actually never stopping on any course.