Which statement best describes the formation of metamorphic rocks?

A. Magma cools and crystallizes slowly beneath Earth’s surface.
B. Liquid lava erupts from a volcano and cools quickly at Earth’s surface.
C. Sand and gravel are deposited at the mouth of a river and, over time, form layers that solidify into rock.
D. Ancient sandstone beaches become buried deep beneath Earth’s surface, where they are exposed to extreme heat and pressure.