Light doesn’t slow down it is always c! It’s an effect of travelling through the material – the wavefront is absorbed and re-emitted by atoms in the material, slowing the wavefront. Interestingly, in plasmas, the “phase velocity” can move faster than the speed of light! The light still only moves at c.
The speed of light that we normally talk about is the speed of light in a vacuum, but the speed of light is actually different in any material. The ratio between the speed of light in a material and in a vacuum is the refractive index of a material, you might have heard about that because it’s why light bends when it goes into a material too?
Rather than being about gravity, it’s about electromagnetic force and is fully covered by Maxwell’s equations.
Let me know if you want to know more!
I’ve been thinking about this and in understanding it I realised that I have answered a previous question incorrectly so will have to go back and find it. The light enters the material and hits atoms of that material, which absorb and then reemit photons this effectlivey ‘holds back’ the light for a instant and then it carries on. The denser the material, the more often this happen and so the slower light can travel.
When atoms absorb a photon of light, it is actually the electrons of the atom that do this – they rise into another energy state (i.e. temporarily take the photons energy) and then drop back down (releasing the photon in a sense).
The confusing part for me is that light isn’t a stream of photons necessarily – it is a wave in the electromagnetic field. Photons are just a good way of explaining this setup. It is the energy of this wave that is absorbed released and not a photon itself.
An analogy would be thinking about waves crashing at the shore. If you put a boat in the way then energy from those waves can be absorbed by the boat (maybe it squishes up slightly or tilts over a bit) and then released (as it unsquishes or tilts back to normal) and this would slow the wave down a bit. Put 100 boats in the way and you’ll slow down the wave more.
Light doesnt ever slow down! But it looks like it does, and that is because glass is a different medium to a vacuum so the light reacts differently with the particles in the glass than it would with the ‘nothingness’ in the vacuum.