Ancient cave rocks reveal impact of climate change