Newbie Taxonomy and Content Question
One way to implement this, assuming that you will show the entire document library as a block.
I'll build this in reverse order because in Drupal, there is no &quot;tree&quot; structure; philosophically, Drupal adopts a &quot;tag&quot; (multivalue) structure, so you have to nudge the tags into a tree structure.
This can seem like a disadvantage coming from a tree-based system, but it's one of Drupal's strengths because tags allow for multiple parents.
So first, for each sub category, create a view mode called &quot;Show documents&quot;.
View mode creation path: /admin/structure/taxonomy/manage/MY_VOCAB_MACHINE_NAME/overview/display, scroll down and choose &quot;Manage view modes&quot; under &quot;Custom settings.&quot;
After adding the view mode, go back to /admin/structure/taxonomy/manage/MY_VOCAB_MACHINE_NAME/overview/display, check the box for &quot;Use custom display settings for the following view modes&quot; and press Save.
Now you can edit this view mode to get the display of content you want.
For that, I would create a view.  This view should use a contextual filter to get the current taxonomy term, and then it should use fields to list the title, image, and file link.  The display mode should be block.
After you create the view, enable the Layout Builder module. This will allow you to completely customize the layout per view mode.
Now, you can go back to the view mode page and attach the block showing the content to the term.  Depending on how you implement the accordions, you should be able to adjust the CSS classes in Layout Build and the Views UI (for the block) to get what you want.  Using a view mode will also let you target a theme template specifically to that view mode.
Finally, you can make another view (block) of the sub categories, this time grouping them by parent.  And then set the view to show the display mode of the sub categories to the view mode that you created earlier, which will automatically bring in all the accordions.
This is not the only way to do this; another way is to use the embed feature of views, which lets you embed one view inside another.