toggle dark mode via the post menu to see the animation. apparently the variable --tw-border-opacity is set to 1 in dark mode and not set in light mode. so you can use calc to multiply something by that value.
<div style="
transform: rotatex(calc(0.5turn * var(--tw-border-opacity, 0)));
transition: transform 500ms;
text-align: center;
border: 1px solid;
padding: 2rem 1rem;
">
hello there
</div>
