Regarding sleep quality, why did humans evolve to require full darkness? - eviltoast

I know evolution is governed by chance and it is random but does it make sense to “ruin” sleep if there’s light? I mean normally, outside, you never have pure darkness, there are the moon and stars even at night. In certain zones of the Earth we also have long periods of no sunshine and long periods of only sunshine.

I don’t know if my question is clear enough but I hope so.

Bonus question: are animals subject to the same contribution of light or lack of it to the quality of sleep?