Sunburn is caused by excessive exposure to ultraviolet (UV) light, which can come from the sun or artificial sources like tanning beds. UV light penetrates the skin and damages skin cells, with UVA penetrating deeper into the skin and leading to skin damage over time, while UVB penetrates more superficially and causes sunburn. The immune system responds to this damage by increasing blood flow to the affected area, resulting in inflamed skin, also known as erythema. It is important to note that one can still get sunburn even on cool or cloudy days, and UV rays can reflect off surfaces like snow, sand, and water and still burn the skin.