Ice melting in salty water: layering and non-monotonic dependence on the mean salinity