Judge rules nearly 1 million acres in Idaho off limits to grazing