Principles underlying the complex dynamics of temperature entrainment by a circadian clock