  A theory of electromagnetic wave propagation in a weakly anisotropic smoothly
inhomogeneous medium is developed, based on the quantum-mechanical
diagonalization procedure applied to Maxwell equations. The equations of motion
for the translational (ray) and intrinsic (polarization) degrees of freedom are
derived ab initio. The ray equations take into account the optical Magnus
effect (spin Hall effect of photons) as well as trajectory variations owing to
the medium anisotropy. Polarization evolution is described by the precession
equation for the Stokes vector. In generic case, the evolution of waves turns
out to be non-Abelian: it is accompanied by mutual conversion of the normal
modes and periodic oscillations of the ray trajectories analogous to electron
zitterbewegung. The general theory is applied to examples of wave evolution in
media with circular and linear birefringence.
