On a sharp Poincaré-type inequality on the 2-sphere and its application in micromagnetics