"Why are the clouds so flat on the bottom?" is the wrong question to ask. The flat bottom is just the boundary between the denser dry air below and the less dense wet air above. (The molecular weight of water is only eighteen. The molecular weight of nitrogen and oxygen are twenty-eight and thirty-two because they both form diatomic molecules; so dry air is conspicuously denser than wet air and stays near the ground while the wet air floats above it.) But "Why are the clouds so lumpy on top?" is the right question to ask. And it is because of the phase change of the water. It takes eighty-one calories per gram to melt ice without any change in temperature. (A mixture of ice and water will stay at the freezing point till all the ice has melted) And it takes only another hundred to bring it to a boil at sea level. (The boiling point of water varies with the atmospheric pressure. Water will not boil until the steam pressure is equal to the atmospheric pressure which at sea level on this planet is fifteen pounds per square inch.) But it takes another five hundred and forty calories to vaporize it. Now if it takes five hundred and forty calories to vaporize a gram of water, all that heat comes out again when the water vapor precipitates as droplets in a cloud. (Wet air is a mixture of water vapor and air. Steam is not a mixture. It is water vapor at or above the boiling point. When you look at the spout of a tea kettle on the stove, you can see through the steam at the spout. Only farther out it forms a cloud. The reason that steam burns are so damaging is because five hundred and forty calories of heat are released for every gram of water that condenses on your skin.) So the precipitation of fog, cloud or rain warms the air. It's not cold in San Francisco because it's foggy; it's foggy because it's cold. And it would be colder without the fog.
So the clouds are lumpy on top because the precipitation of the water vapor to cloud heats the air and causes it to rise. And the faster a cloud dumps its rain, the faster it warms and rises. And the faster it warms and rises, the faster it dumps its rain. So if the cloud is very large and very wet then the air that comes in from below to replace the rising cloud may blow your house away.
In the mountains the ground cools off at night by radiating. The heat energy is radiated away in the infrared to the night sky, and the air in contact with the ground cools off by this contact and flows downhill like water. That is why the clouds sometimes disappear at night. In the daytime, however, the ground is warmed by the Sun and heats the air in contact with it. So the warm moist air over the southwest slopes rises and cools till the water vapor in it precipitates out as clouds. That is why one often sees clouds forming over the mountains in the afternoon. But at night when the cloud layer is lowered, to replace the downhill breezes, the temperature and pressure rise and the clouds are vaporized.
By watching the edges of the clouds at dusk, to see if they are vaporizing, one can often tell whether or not the sky will clear at dark.
It is because the cold night air flows downhill like water that large night telescopes belong on the peaks and ridges. And it is because in the daytime the warm air goes up the slopes that sun telescopes belong elsewhere. When a balloon goes up in the air, the air inside it gets cooler because the molecules are colliding with a receding wall. It's like a baseball. When it's bunted, it slows down because it collides with a receding bat. (Temperature is a measure of the mean kinetic energy of the molecules; so if they collide with a receding wall and slow down, they cool off.) When the balloon comes down again, the air inside heats up because the molecules are colliding with an advancing wall. It's like a baseball on a home run pitch. It collides with an advancing bat. Air going up in this way cools off with or without the wall of the balloon because, as it expands, the molecules collide with receding molecules.