To summarize, we suggest that the high-temperature treatment of Y-CNx induces partial heptazine fragmentation accompanied by NH3 evolution which under the given conditions is decomposed into H2 and N2. The reductive atmosphere causes formation of C-NH-NH-C linkages in place of the opened heptazine, whichupon further deammonificationeventually produce the C-N=N-C azo moieties. In other words, a PCN material with strongly extended visible light absorption is obtained that contains, apart from typical PCN structural features, also poly(heptazine/triazine) azo-linked fragments that are chiefly responsible for the red shift of the optical absorption edge. In order to better understand the electronic structures and optical properties of the different systems, periodic density functional theory calculations have been performed on various systems. Figure shows the most relevant systems that were obtained after an extensive screening for possible structures of R-CNx and Y-CNx. For the red carbon nitride system two different configurations were found (see Fig. ), one in a planar configuration (planar-R-CNx), and a second one with an azo-linkage at the N=N group that leads to a step-like structure of the layer. Interestingly, the planar configuration is 0.42 eV less stable than the R-CNx system (Fig. ). However, while the latter one has a bandgap of 3.5 eV, which is in the expected range of carbon nitrides, the planar-R-CNx system has a direct bandgap of only 2.2 eV. Regarding the Y-CNx, a fully interconnected layer (Egap = 2.8 eV) as well as a configuration with hydrogenated amino endgroups (Egap = 3.6 eV), that leads to strand-like structures, were considered. All band structures and projected density of states of the different systems can be found in the Supplementary information (Fig. ), together with the charge density distributions at the corresponding valence band maxima (VBM) and conduction band minima (CBM) (Fig. ). The Fig. shows the calculated absorption spectra, which reveal the expected UV-absorbance for all CNx structures except for planar-R-CNx that shows absorption at longer wavelengths close to 400 nm. The question remains why the experimentally observed optical properties of red carbon nitride conforms with the calculated behavior of planar-R-CNx, though this structure is less stable than the step-like R-CNx configuration (see Figure ). Our present hypothesis is that red carbon nitride is confined in a Y-CNx framework (as shown in Figure ), which stabilizes the planar configuration, leading to localized planar-R-CNx units. The azolinkages in the planar-R-CNx units then lead to reduction of the overall bandgap as depicted in the energy scheme shown in Figure . Such confinement effects have also been observed for other two-dimensional systems (e.g., TaSe2), where the embedding in a larger framework leads to a stabilization of the usually less preferred configuration.