Differential renormalization-group approach to the layered sine-Gordon model