Layered Structure and Complex Mechanochemistry Underlie Strength and Versatility in a Bacterial Adhesive