State high court allows attorney general to seek records tied to investigation into gender-affirming care for minors.