  In this paper, we suggest a new heterogeneous multiscale method (HMM) for the
time-harmonic Maxwell equations in locally periodic media. The method is
constructed by using a divergence-regularization in one of the cell problems.
This allows us to introduce fine-scale correctors that are not subject to a
cumbersome divergence-free constraint and which can hence easily be
implemented. To analyze the method, we first revisit classical homogenization
theory for time-harmonic Maxwell equations and derive a new homogenization
result that makes use of the divergence-regularization in the two-scale
homogenized equation. We then show that the HMM is equivalent to a
discretization of this equation. In particular, writing both problems in a
fully coupled two-scale formulation is the crucial starting point for a
corresponding numerical analysis of the method. With this approach we are able
to prove rigorous a priori error estimates in the $\mathbf{H}(\mbox{curl})$-
and the $H^{-1}$-norm and we derive reliable and efficient localized
residual-based a posteriori error estimates.
