Atmospheric refraction causes several optical phenomena including advanced sunrise and delayed sunset, twinkling of stars, apparent flattening of the sun's disc at sunrise and sunset, and mirages. Refraction occurs when light travels from one medium to another of different densities, such as from air to air of different temperatures in the atmosphere. This causes the light's path to bend and results in the sun appearing above the horizon before actual sunrise or remaining visible after sunset. Stars twinkle due to the fluctuating refractive index of the lower atmosphere bending the starlight. Planets do not twinkle as their larger apparent size averages out the fluctuations. Mirages occur due to variations in the refractive index profile of the atmosphere distorting the appearance