NY prisons must comply with law limiting solitary confinement, judge says