The carbon dioxide absorbs energy from the Sun. Then the temperature should increase with altitude, instead of decreasing.