/// Compute the maximum depth of a map
/// @param {Map} $map
/// @return {Number} max depth of `$map`

@function map-depth($map) {
  $level: 1;

  @each $key, $value in $map {
    @if type-of($value)=="map" {
      $level: max(map-depth($value) + 1, $level);
    }
  }

  @return $level;
}