https://drafts.csswg.org/css-position/#position-box
The position box is its margin box, except that for any side for which the distance between its margin edge and the corresponding edge of its containing block is less than its corresponding margin, that distance is used in place of that margin.
This doesn't make much sense to me, should the distance be from the border edge instead?
CC @fantasai c66a57a