{# OOB swap for entry posts nav when posts are associated/disassociated #}
{% import 'macros/links.html' as links %}

{# Associated Posts - vertical on mobile, horizontal with arrows on desktop #}
{% if entry_posts %}
  <div class="flex flex-col sm:flex-row sm:items-center gap-2 border-r border-stone-200 mr-2 sm:max-w-2xl"
       id="entry-posts-nav-wrapper"
       hx-swap-oob="true">
    {% from 'macros/scrolling_menu.html' import scrolling_menu with context %}
    {% call(entry_post) scrolling_menu('entry-posts-container', entry_posts) %}
      <a
        href="{{ coop_url('/' + entry_post.slug + '/') }}"
        class="{{styles.nav_button}}"
      >
        {% if entry_post.feature_image %}
          <img src="{{ entry_post.feature_image }}"
               alt="{{ entry_post.title }}"
               class="w-8 h-8 rounded-full object-cover flex-shrink-0" />
        {% else %}
          <div class="w-8 h-8 rounded-full bg-stone-200 flex-shrink-0"></div>
        {% endif %}
        <div class="flex-1 min-w-0">
          <div class="font-medium truncate">{{ entry_post.title }}</div>
        </div>
      </a>
    {% endcall %}
  </div>
{% else %}
  {# Empty placeholder to remove nav posts when all are disassociated #}
  <div id="entry-posts-nav-wrapper" hx-swap-oob="true"></div>
{% endif %}
