{# Breadcrumb trail — collapsed on narrow viewports, full on wide. Expects ``breadcrumbs``: list of dicts with ``label`` and optional ``url``. #}
{% if breadcrumbs %}
{# Full path — shown on wide viewports #}
{% for crumb in breadcrumbs %}
{% if not forloop.last %}
{{ crumb.label }}/
{% else %}
{{ crumb.label }}
{% endif %}
{% endfor %}
{# Collapsed path — shown on narrow viewports #}
{% with last=breadcrumbs|last %}
{% if breadcrumbs|length > 2 %}
{{ breadcrumbs.0.label }}//{{ last.label }}
{% for crumb in breadcrumbs %}
{% if not forloop.first and not forloop.last %}
{{ crumb.label }}
{% if not forloop.last %}/{% endif %}
{% endif %}
{% endfor %}
{% else %}
{# Only 2 crumbs — no collapse needed, just duplicate the full view #}
{% for crumb in breadcrumbs %}
{% if not forloop.last %}
{{ crumb.label }}/
{% else %}
{{ crumb.label }}
{% endif %}
{% endfor %}
{% endif %}
{% endwith %}
{% endif %}