Kapitza homogenization of deep gratings for designing dielectric metamaterials