Motion before sunset to turn on lights

I am trying to have my office lights turn on 1 hour before sunset, and every time after that. It does not seem to work. I checked that it is 39 minutes to sunset, walk into my office, motion got detected, but lights did not turn on automation did not run. Here is my code:

- id: '1594459311535'
  alias: Office motion lights 1hr before sunset
  description: ''
  trigger:
  - entity_id: binary_sensor.office_motion_sensor
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - after: sunset
    before_offset: 01:00:00
    condition: sun
  action:
  - device_id: 60138b1186b04b698f0e04d0ce9c0de1
    domain: switch
    entity_id: switch.office_lights
    type: turn_on
  mode: single

What am I doing wrong here?

You can’t use before_offset with after:. You need a negative after_offset instead. Docs.

Thank you kind sir!