Let's focus on one problem at a time. Also, let's not forget that every step was simplified.
You can simplify the initial problem to the following: you have a source of energy (Sun), a black body screen (Earth's surface) and a transfer medium between the two that can act as a buffer.
Since both of them radiate, there should be a point where energy going in, is equal to the energy going out. If you'd have two bodies at T1 and T2 (T1 < T2) and connect them with a strip of copper, you could reasonably expect there's going to be a point on the strip where T = (T1 + T2) / 2. That's your basic concept of heat transfer.
Now, time for some facts regarding our buffer:
The density and pressure of the atmosphere change with the distance from the Earth's surface.
The amount of energy per volume that air can retain is proportional to the number of particles enclosed in said volume (and their energies).
The average velocity of those particles is proportional to temperature and kinetic energy. Mass is another important factor, pertinent to the original question.
Heavier gasses stay close to the surface while lighter ones go up. It affects the distribution of gasses throughout the atmosphere. All gasses in the atmosphere (at least up to at least 80-90 km) are composed of more than one atom. N2, O2, CO, CO2, H2O, O3, Ar, CH4, NOx. Those are the most important ones. I'm going to use the word 'particle' when referring to them.
The amount of energy a particle can retain, and how hard or easy it is to change its temperature, is related to its heat capacity and specific heat. This has three components, each related to the type of motion a particle can make. First is your basic translational motion, which is to say "how a particle travels in 3D space". Up, down, left, right, forwards, backwards and their combinations. Second is the way a particle can rotate. Because we have only three axes (and three moments of inertia associated with them), it can only spin around X, Y or Z axis (or a combination of them). The third way a particle can move is the way it can vibrate. Imagine balls connected by a spring, and you have the basic idea. For an n-atom particle, there are (n - 1) ways it can vibrate.
The more ways a particle can move, the number of degrees of freedom, gives it a broader range of energy it can absorb. Each of those plays their part due to the equipartition of energy. Broadly speaking, each degree of freedom gets proportional for its type share of energy. Meaning: they have more ways to absorb and emit radiation.
FYI: Wikipedia has a good article on rotational-vibrational spectroscopy.
I told you to consider what happens at various heights of the atmosphere. I did it to point you toward things like clouds and water vapour in general. They scatter light and absorb tremendous amounts of energy on their own. Combine it with all the greenhouse gasses, some mentioned above, that are most excited in the infrared spectrum, and you get even more buffer properties. They act like a one-way mirror, absorbing energy radiated from the ground and radiate almost all of it it back towards the ground. That's part of the reason (if not the sole reason, I'm not certain about the specifics) why satelite images of clouds are done in IR spectrum.
Now, let's bring those facts together. Close to Earth's surface, you have more of those massive, multi-atom particles. This skews the point of energy transfer equilibrium closer to the surface.
Wait, so where's the role of pressure? It's talked about indirectly. Pressure and temperature are related to a collective force given by all the particles hitting surfaces (translational motion). The higher you go and the fewer of those particles are present, the less energy they carry on average.
There's a second part to this post that I'm still writing. It's more about convective processes and why/how they don't matter nearly as much as you might be thinking. My goal is to write it from the first principles approach like this one, but it's going to take me a while.