How structure defines affinity in protein-protein interactions