A Gauge Invariant Multiscale Approach to Magnetic Spectroscopies in Condensed Phase: General Three-Layer Model, Computational Implementation and Pilot Applications