If it is leaving the more dense medium, this refraction would be expected to bend the ray away from the normal as it emerges. However, if this would bend the ray at more than 90° from the normal ...