Correctly adjust min-height to 0 before calculating new height.