So you have three tables:
LayoutTable----<DetailPortal (DetailPortal is a second table occurrence of Details.)
With scripting support, you can do this.
LayoutTable::PrimaryKey = MasterPortal::ForeignKey
LayoutTable::gSelectedDetailID = DetailPortal::DetailID
On the layout, the Details portal should refer to DetailPortal, not Details.
Either format all the fields in the Master Portal as a button or put a button in the row that performs this script:
Set Field [LayoutTable::gSelectedDetailID ; MasterPortal::DetailID ]
You can even use conditional formatting to "highlight" the portal row of the selected MasterPortal record.
Note: gSelectedDetailID is most often defined as a global field though this is not strictly necessary.
Thanks for your comment.