Now it may also be related that light bends in a denser media compared to a rarer media because an additional rotational force is working. In other words, the definition of straight line has to change in the medium, that is of different density, because path of light is changing. Light is the guy who suffers the least when something tries to buzz it, because its inertial property of mass is zero. The curvature of light or the bending or deflection known as Refraction is thus a measure of the sideways force or energy.
Thus speed of light in different media is a measure of this bending or curvature and is known as Snail’s law ( — Pun intended, its actually; Snell’s Law — ) . Automatically when distance and time have to readjust, to produce an angle or bending, known as refraction ( — possible because distance and time can produce an angle if they are equivalents — ) the speed must also change.
All these are inter related. Light refracts and its speed changes, in relative change in density of media because there are rotational or non-inertial effects.
( — or additional energy is available, or a force is acting to bring a curvature in light’s path, perhaps the electromagnetic effects of the molecules? Its not only distance or time that are equivalents, read one article of mine “All You Need To Know About Relativity” to understand; how energy and time and distance and in short all Physical Variables are equivalents of each other — )