<section class="rounded-md border border-slate-300 bg-slate-50 p-4">
  <div class="flex items-center justify-between gap-4">
    <div class="flex min-w-0 items-center gap-1">
      <%= image_tag domain_model_icon_path(post), class: "w-6 h-6" %>
      <span class="truncate text-lg font-medium">
        <%= link_to title_for_post_model(post),
                        post.external_url_for_view.to_s,
                        class: "text-blue-600 hover:underline",
                        target: "_blank",
                        rel: "noopener noreferrer" %>
      </span>
      <i class="fa-solid fa-arrow-up-right-from-square text-slate-400"></i>
    </div>
    <div class="flex items-center gap-2 whitespace-nowrap text-slate-600 float-right">
      <% if creator = post.primary_creator_for_view %>
        <span class="flex gap-1 items-center text-lg">
          <span class="text-slate-500 italic text-sm">by</span>
          <%= render(
            "domain/has_description_html/inline_link_domain_user",
            user: creator,
            visual_style: "sky-link",
            icon_size: "large"
          ) %>
        </span>
      <% else %>
        <%= post.primary_creator_name_fallback_for_view %>
      <% end %>
    </div>
  </div>
  <div class="mt-2 flex flex-wrap gap-x-4  text-slate-600 leading-relaxed justify-between">
    <span title="<%= post.posted_at&.strftime("%Y-%m-%d") %>">
      <i class="fa-regular fa-calendar mr-1"></i>
      <% if posted_at = post.posted_at %>
        Posted <%= time_ago_in_words(posted_at) %> ago
      <% else %>
        Unknown when posted
      <% end %>
    </span>
    <%= render_for_model(post, "section_title_details", as: :post) %>
    <% if post.class.has_faving_users? && (num_favorites = post.num_favorites_for_view) %>
      <span>
        <i class="fa-solid fa-heart mr-1"></i>
        Favorites: <%= num_favorites %>
        <% if policy(post).view_faved_by? %>
          (<%= link_to "#{pluralize(post.faving_users.count, "fav")} known",
                faved_by_domain_post_users_path(post),
                class: "text-blue-600 hover:underline" %>)
        <% end %>
      <% end %>
    </span>
  </div>
  <%= render_for_model(post, "scan_metadata", as: :post) %>
</section>
