Rainwater picks up dissolved carbon dioxide as it falls and moves through soil, forming a weak carbonic acid. Where that mildly acidic groundwater seeps through cracks in soluble bedrock — limestone, gypsum, dolomite — it slowly dissolves the rock along the fracture, widening it year after year into an underground cavity. This slow chemical erosion is called karst dissolution.
Denser, heavier soil above the cavity needs a thicker rock roof to stay supported; a lighter overburden can be held up longer by a thinner one. As the cavity keeps growing, the roof spanning it gets thinner and the load above stays the same, so the safety margin — the roof's remaining structural reserve — steadily shrinks.
Once the roof can no longer bear the weight above it, the collapse is sudden and often catastrophic rather than gradual: the ceiling gives way in seconds and the surface drops into a crater. This is exactly how real-world sinkholes in Florida, the Yucatán and other karst landscapes form — years of invisible dissolution followed by an abrupt, dramatic collapse.