An analytic model for high-contrast gratings