Electromagnetism as an emergent phenomenon: a step-by-step guide