{# Generic content post viewer: blog post, project, activity, recipe. #}
{# Context: item (UnifiedContentItem), lang #}
<article class="max-w-3xl mx-auto px-4 py-8" itemscope itemtype="https://schema.org/Article">
  {% include "partials/content_header.j2" %}

  {% if item.excerpt %}
    <div class="text-lg ds-text-muted leading-relaxed mb-8 border-l-4 border-current pl-4 italic">
      {{ item.excerpt }}
    </div>
  {% endif %}

  <div class="prose prose-neutral dark:prose-invert max-w-none ds-text leading-relaxed" itemprop="articleBody">
    {{ body_html | safe }}
  </div>

  {% if item.translations and item.translations | length > 1 %}
    <footer class="mt-12 pt-6 border-t border-gray-200 dark:border-gray-700">
      <p class="text-sm ds-text-muted">
        {% if lang == "es" %}También disponible en:{% else %}Also available in:{% endif %}
        {% for tlang in item.translations %}
          {% if tlang != lang %}
            {% set tslug = item.translation_slugs[tlang] %}
            <a href="/{{ tlang }}/{{ item.content_type }}/{{ tslug }}"
               class="underline hover:ds-text"
               hx-get="/{{ tlang }}/{{ item.content_type }}/{{ tslug }}"
               hx-target="#main-content"
               hx-swap="innerHTML"
               hx-push-url="true">{{ tlang | upper }}</a>
          {% endif %}
        {% endfor %}
      </p>
    </footer>
  {% endif %}
</article>
