A roof functions as a layered system, where decking, underlayment, flashing, and ventilation work together to protect a home, not just the visible shingles.