Resonance behavior of diffraction on encapsulated guided-mode grating of subwavelength thickness