Need text to fill container until it gets to a certain width

I made an accordion and the text within it has to have a maximum width, but when the accordion gets narrower I still want the text to fill that container. I made one that just fills so that the text resizes as the accordion resizes, but now that the text can only be a certain width, of course if I keep that text frame at a fixed width then it won’t adjust when the accordion is narrower. How can I make this work? Here’s an example file, with one with the fill container and one with fixed width.