{# Associated entries on blog listing cards — loaded via widget registry #}
{% set widget_entries = post[w.context_key] if post[w.context_key] is defined else [] %}
{% if widget_entries %}
  <div class="mt-4 mb-2">
    <h3 class="text-sm font-semibold text-stone-700 mb-2 px-2">Events:</h3>
    <div class="overflow-x-auto scrollbar-hide" style="scroll-behavior: smooth;">
      <div class="flex gap-2 px-2">
        {% for entry in widget_entries %}
          {% set _entry_path = '/' + post.slug + '/calendars/' + entry.calendar_slug + '/' + entry.start_at.year|string + '/' + entry.start_at.month|string + '/' + entry.start_at.day|string + '/entries/' + entry.id|string + '/' %}
          <a
            href="{{ events_url(_entry_path) }}"
            class="flex flex-col gap-1 px-3 py-2 bg-stone-50 hover:bg-stone-100 rounded border border-stone-200 transition text-sm whitespace-nowrap flex-shrink-0 min-w-[180px]">
            <div class="font-medium text-stone-900 truncate">{{ entry.name }}</div>
            <div class="text-xs text-stone-600">
              {{ entry.start_at.strftime('%a, %b %d') }}
            </div>
            <div class="text-xs text-stone-500">
              {{ entry.start_at.strftime('%H:%M') }}
              {% if entry.end_at %} – {{ entry.end_at.strftime('%H:%M') }}{% endif %}
            </div>
          </a>
        {% endfor %}
      </div>
    </div>
  </div>

  <style>
  .scrollbar-hide::-webkit-scrollbar {
    display: none;
  }
  .scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  </style>
{% endif %}
