Conditional Card for sunset and sunrise using Sun integration. Only show when it's 1h before sunset/sunrise

So I recently discovered the Horizon Card, and I really like it, but I still like how the Sun integration tells you not what time the Sun will set, but in how many minutes. But I only want the card to pop up when there’s less than 1 hour, because anything more than 1 hour it just lists as hours which is very vague IMO.

Just a little touch for the dashboard, not totally necessary.
sunset

I liked the idea so just got this from chat GPT as a template but wanted an hour before and after. Name it Sunset sunrise buffer with device as light.

{% set sunrise = state_attr('sun.sun', 'next_rising') | as_datetime | as_local %}
{% set sunset = state_attr('sun.sun', 'next_setting') | as_datetime | as_local %}
{% set now = now() %}
{% set today_sunrise = sunrise if sunrise.date() == now.date() else sunrise - timedelta(days=1) %}
{% set today_sunset = sunset if sunset.date() == now.date() else sunset - timedelta(days=1) %}
{{ (now >= today_sunrise - timedelta(hours=1) and now <= today_sunrise + timedelta(hours=1)) or
   (now >= today_sunset - timedelta(hours=1) and now <= today_sunset + timedelta(hours=1)) }}

use the template sensor in the visibility condition to show the card.

image