  The modeling of the peculiar scattering polarization signals observed in some
diagnostically important solar resonance lines requires the consideration of
the detailed spectral structure of the incident radiation field as well as the
possibility of ground level polarization, along with the atom's hyperfine
structure and quantum interference between hyperfine F-levels pertaining either
to the same fine structure J-level, or to different J-levels of the same term.
Here we present a theoretical and numerical approach suitable for solving this
complex non-LTE radiative transfer problem. This approach is based on the
density-matrix metalevel theory (where each level is viewed as a continuous
distribution of sublevels) and on accurate formal solvers of the transfer
equations and efficient iterative methods. We show an application to the
D-lines of NaI, with emphasis on the enigmatic D1 line, pointing out the
observable signatures of the various physical mechanisms considered. We
demonstrate that the linear polarization observed in the core of the D1 line
may be explained by the effect that one gets when the detailed spectral
structure of the anisotropic radiation responsible for the optical pumping is
taken into account. This physical ingredient is capable of introducing
significant scattering polarization in the core of the NaI D1 line without the
need for ground-level polarization.
