For sea legs we use the European ferry lines from OpenStreetMap: the distance is that of the route, from the port of departure to the port of arrival. Livorno–Olbia, for example, is about 308 km.
If there is no known line between two ports, the calculation says so and uses the corrected straight-line distance.