Badge icon transform-rotate

In a badge, I want to rotate an mdi icon, based on the wind direction.
For this to happen, I’ve tried a few options, which don’t work.
Maybe I’m thinking in the wrong direction and someone has a simple solution.

type: entity
entity: sensor.weather_wind_dir_name_owm
icon: mdi:weather-windy
name: Windrichting
card_mod:
  style: |
    .icon {
         transform: rotateY(45deg); 
    }

I’ve also tried if this style approach would work, but no:

styles:
  icon:
    - animation: rotating 2s linear infinite

And different options with this approach

style: |
          .header .icon {
            transform: rotate({{state_attr('weather.home', 'wind_bearing')}}deg);
            }

Maybe there is a much simpler option I’m not aware of?