Here and here are discussion on how to implement collapsible/expandable sections in LaTeX. To do that with arbitrary content will require some fiddling with tikz, to avoid the collapsed section taking up empty space in the pdf, but will enable structured proofs. Not sure how well that "nests", will need investigation.
Here is a discussion how to do tooltips/hoverboxes in TeX, which we might exploit for showing definitions on hovering over notations and symbol references.