Air is a gas mixture, mostly nitrogen some oxygen and tiny amounts of others. When a gas, including air, is compressed its temperature goes up. You might have experienced this if you have ever used a hand air pump to inflate a bicycle tire or anything else. After a few minutes work the barrel of the pump becomes warm. The opposite effect happens when a gas is allowed to expand. A CO2 fire extinguisher can demonstrate this. Stop by a fire station and see if you can get a fire safety demonstration, including the discharge of a CO2 fire extinguisher. The compressed gas when it expands through the nozzle can actually freeze moisture out of the air creating a small snow shower.
The next thing we need to know is that hot air is lighter than cold air. OK, I know it sounds like I am going backward since I am trying to make it seem reasonable that mountain-top air is colder than valley air, but bear with me a while. The hot air balloon gives evidence that air which is hotter than the air surrounding it, tends to rise. When the sun shines on the surface of the Earth the solar energy raises the temperature of the ground but the temperature increase depends on how much energy is absorbed and this differs from place to place. The air over each little hot spot begins to rise and the cooler surrounding air sinks to take its place. The result of all this is cells of rising and sinking air establishing a vertical circulation throughout the lower atmosphere up to 18,000 feet or so.
The last piece of this puzzle is the effect of altitude on atmospheric pressure. At sea level a column of air one square foot in area and extending up to the edge of space weighs a little over a ton. This works out to a sea level atmospheric pressure of about 15 pounds per square inch. At 18,000 feet the pressure is about half this value so rising air is allowed to expand and falling air is compressed.
Remember that for air to keep rising it needs only be warmer than the air at its level, not warmer than air at the surface. So the air cools due to expansion as it rises and warms by compression as it falls. The net result is a decrease in temperature with increasing altitude. Mount Ranier is about 14,000 feet high so it sticks well up into the frigid levels of the atmosphere.