But things like coal, oil, natural gas come from underground.
Most mining is now strip mining, so anything that has to be mined automatically loses. All three of these are also sequestered carbon; when we produce them, and then burn them, we cause ourselves problems related to CO2 release. Natural Gas production is now predicated upon fracking (we otherwise have already hit peak natgas, in terms of just getting it out of the ground as opposed to making it) which has its own severe problems, not least being based on injecting refinery wastes into the ground instead of disposing of them properly. Oil spills are an ongoing rather than regular occurrence; there is basically no time that there is not a serious oil spill going on somewhere in the world. Burning coal puts nuclear material into the atmosphere, including tons of fissile uranium per year.
The environmental cost of solar, especially non-PV systems or modern PV systems which use ever-vanishing quantities of rare earths or even organic materials, is minuscule compared to any fossil fuel.