Associative detachment in the mesosphere and the diurnal variation of polar-cap absorption