Dear student
The speed of light depend upon the bending of light. When a light travels from rarer to denser medium it bends away from the normal and it's speed get slowed down while when it travels from denser to rarer medium it bends towards the normal and it's speed fast up.
Regards