The atmosphere selectively absorbs different types of electromagnetic radiation based on their energy levels and interactions with atmospheric molecules. Gamma rays are blocked due to their high energy, which interacts strongly with atmospheric particles. UV rays are primarily absorbed by the ozone layer, while infrared radiation is mostly absorbed by water vapor. Visible light passes through the atmosphere because its energy is insufficient to excite oxygen but is too energetic for molecular vibrations in air. Overall, the varying composition of the atmosphere leads to different absorption characteristics for various electromagnetic waves before they reach the Earth's surface.