For a planet which has a temperature gradient, hot in the center and cooler on the surface, why do we see absorption lines?

Similarly, why do we see emission lines if the planet is hot on the surface and gets cooler as you move to the center?

Note, for this question I am only thinking of the planet as a black body, not as something, for example, transiting a star and observing the spectra (transit spectra) of the light that shines through the planet's atmosphere. The source of the spectra is the planet itself.