Why Does the Stratosphere Cool When the Troposphere Warms?

There is more than one way to explain this, but one of the deepest relies on the Virial Theorem. The Virial Theorem says that the kinetic energy of a system of particles (atoms, stars, or galaxies) bound by gravity, and in suitable equilibrium, is equal to -(1/2) times the gravitational potential energy. This powerful idea explains a lot of things about stars and galaxies, one of which is why when the center heats up, the surface cools down. Thus, the Sun today is both redder and brighter than it was a couple of billion years ago.

Let us see how this idea applies to a planet like ours with a warming surface. the kinetic energy of a molecule is given by (1/2)*m*v^2 and its gravitational potential energy is given by -m*M(r)/r, so virial equilibrium implies that (on average) v^2 = M(r)/r.

When the lower layer of the atmosphere heats up, the kinetic energy per molecule increases, the layer expands, the average molecule moves up, and M(r)/r decreases (potential energy becomes less negative), so how can virial equilibrium be preserved? Somewhere else, the atmosphere must either cool or move downwards, or both. And that means the stratosphere cools.

So how does the stratosphere know about what's happening down below, and that consequently it needs to cool and contract? The details are complex, and I have yet to work it out in my mind. Pressure will change a bit as the stratosphere is pushed up.

Of course this picture is oversimplified. The atmosphere isn't exactly in virial equilibrium. Solar radiation is differentially absorbed for one thing.

For those who don't trust virial magic (and I am somewhat in that boat), a much more complex explanation can be found here.