During their formation, planets form large, hot atmospheres due to the ongoing accretion of solids. It has been customary to assume that all solids end up at the center constituting a core of refractory materials, whereas the envelope remains metal-free. Recent work, as well as observations by the JUNO mission, indicate however that the distinction may not be so clear cut. Indeed, small silicate, pebble-sized particles will sublimate in the atmosphere when they hit the sublimation temperature (T ~ 2,000 K). In this paper we extend previous analytical work to compute the properties of planets under such a pebble accretion scenario. We conduct 1D numerical calculations of the atmosphere of an accreting planet, solving the stellar structure equations, augmented by a non-ideal equation of state that describes a hydrogen/helium-silicate vapor mixture. Calculations terminate at the point where the total mass in metal equals that of the H/He gas, which we numerically confirm as the onset of runaway gas accretion. When pebbles sublimate before reaching the core, insufficient (accretion) energy is available to mix dense, vapor-rich lower layers with the higher layers of lower metallicity. A gradual structure in which Z decreases with radius is therefore a natural outcome of planet formation by pebble accretion. We highlight, furthermore, that (small) pebbles can act as the dominant source of opacity, preventing rapid cooling and presenting a channel for (mini-)Neptunes to survive in gas-rich disks. Nevertheless, once pebble accretion subsides, the atmosphere rapidly clears followed by runaway gas accretion. We consider atmospheric recycling to be the more probable mechanisms that have stalled the growth of these planets envelopes.