Why does the sun burn your skin and not your hair?

I have an extremely bad sunburn, but i wondered why does the sun only burn your skin and not your hair? Why doesn’t it singe your hair? Why does it lighten your hair?

Moderator’s Note: Linking to original thread here.