Coastal communities are racing to protect the forests that shield them from storms and store vast amounts of carbon.