<article class="group relative overflow-hidden rounded-2xl bg-white/80 backdrop-blur shadow-lg transition hover:-translate-y-1 hover:shadow-xl">
  <div class="absolute inset-0 pointer-events-none bg-gradient-to-br from-indigo-50/40 via-transparent to-blue-50/50 opacity-0 group-hover:opacity-100 transition"></div>
  <div class="p-6 flex flex-col h-full relative z-10">
    <div class="flex items-center justify-between text-sm text-slate-500">
      <span class="inline-flex items-center gap-2 font-medium text-indigo-600">
        <span class="size-2 rounded-full bg-indigo-400"></span>{{ worker.category|default:"General" }}
      </span>
      {% if show_detail_link|default:True %}
        <a href="{% url 'pages:pretrained_worker_detail' worker.code %}" class="text-indigo-500 hover:text-indigo-600 transition text-sm">View details →</a>
      {% endif %}
    </div>
    <h3 class="mt-4 text-2xl font-medium text-slate-900">{{ worker.display_name }}</h3>
    <p class="mt-3 text-base text-slate-600 leading-relaxed">{{ worker.tagline }}</p>
    <dl class="mt-6 space-y-3 text-sm text-slate-500">
      <dt class="flex items-start gap-3 font-semibold text-slate-700">
        <span class="text-indigo-500 mt-0.5" aria-hidden="true">🗓️</span>
        <span>Cadence</span>
      </dt>
      <dd class="-mt-2 ml-7">{{ worker.schedule_description|default:worker.base_schedule }}</dd>
      {% if worker.event_triggers %}
        <dt class="flex items-start gap-3 font-semibold text-slate-700">
          <span class="text-indigo-500 mt-0.5" aria-hidden="true">⚡</span>
          <span>Event triggers</span>
        </dt>
        <dd class="-mt-2 ml-7 space-y-1">
          {% for trigger in worker.event_triggers|slice:":2" %}
            <p>{{ trigger.name|default:trigger.type|capfirst }}</p>
          {% endfor %}
          {% if worker.event_triggers|length > 2 %}
            <p class="text-indigo-500">+{{ worker.event_triggers|length|add:-2 }} more</p>
          {% endif %}
        </dd>
      {% endif %}
      {% if worker.display_default_tools %}
        <dt class="flex items-start gap-3 font-semibold text-slate-700">
          <span class="text-indigo-500 mt-0.5" aria-hidden="true">🔧</span>
          <span>Built-in integrations</span>
        </dt>
        <dd class="-mt-2 ml-7 flex flex-wrap gap-2">
          {% for tool in worker.display_default_tools|slice:":3" %}
            <span class="px-3 py-1 rounded-full bg-slate-100 text-slate-600 font-medium">{{ tool }}</span>
          {% endfor %}
          {% if worker.display_default_tools|length > 3 %}
            <span class="px-3 py-1 rounded-full bg-indigo-100 text-indigo-600 font-medium">+{{ worker.display_default_tools|length|add:-3 }}</span>
          {% endif %}
        </dd>
      {% endif %}
    </dl>
    <div class="mt-auto pt-6 flex flex-col gap-3">
      <form method="post" action="{% url 'pages:pretrained_worker_hire' worker.code %}" class="contents">
        {% csrf_token %}
        <input type="hidden" name="source_page" value="home_pretrained_workers" />
        <input type="hidden" name="trial_onboarding" value="1" />
        <input type="hidden" name="trial_onboarding_target" value="agent_ui" />
        <button type="submit" class="inline-flex items-center justify-center gap-2 px-5 py-3 bg-gradient-to-r from-indigo-600 to-blue-600 text-white font-semibold rounded-xl shadow-md hover:shadow-lg hover:from-indigo-500 hover:to-blue-500 transition">
          {% if not user.is_authenticated or home_spawn_requires_trial %}Start Free Trial{% else %}Spawn This Worker{% endif %}
          <span aria-hidden="true">→</span>
        </button>
      </form>
    </div>
  </div>
</article>
