WordPress theme inline styles from shortcodes

According to the WordPress Envato requirements no hardcoded inline styles are permitted. Instead I used wp_add_inline_style custom styles from shortcodes.

But by the time the shortcodes are processed the header has already been assembled. Then, the inline styles are rendered in the <body> but this causes a validation error because all <style> tags must be in the <head>

Some suggestions are to use a static class to store all custom css https://forums.envato.com/t/soft-reject-inline-style/180752/3

But the problem is the same, the styles are obtained only when the shortcode has been processed.

Do you know of another method to add styles from shortcodes on the <head>?