Shape-preserving physical and chemical transformations of Si and SiO₂ nano- and microstructures