Highly reflective and high-$Q$ thin resonant subwavelength gratings