{% if section_only -%}
# {{ section_header }}
Accession: {{ accession }}
{% else -%}
# {{ name }}

Accession: {{ accession }}
{% if entry_id %}Entry: {{ entry_id }}{% endif %}
{% if gene_symbol %}Gene: {{ gene_symbol }}{% endif %}
{% if organism %}Organism: {{ organism }}{% endif %}
{% if length %}Length: {{ length }} aa{% endif %}
Source: UniProt

{% if function -%}
## Function (UniProt)

{{ function }}
{% endif -%}
{% endif -%}
{% if show_structures_section and structures -%}
## Structures (PDB / AlphaFold via UniProt)
{% if structure_count and structure_count > (structures | length) -%}
Showing top {{ structures | length }} of {{ structure_count }} structures by resolution.
{% endif -%}
{% for s in structures -%}
- {{ s }}
{% endfor -%}
{% endif -%}
{% if show_domains_section and domains -%}
## Domains (InterPro)

| Accession | Name | Type |
|---|---|---|
{% for d in domains -%}
| {{ d.accession }} | {{ d.name or "-" }} | {{ d.domain_type or "-" }} |
{% endfor -%}
{% endif -%}
{% if show_interactions_section and interactions -%}
## Interactions (STRING)

| Partner | Score |
|---|---|
{% for i in interactions -%}
| {{ i.partner }} | {% if i.score is not none %}{{ i.score | score }}{% else %}-{% endif %} |
{% endfor -%}
{% endif -%}
{% if show_complexes_section and complexes -%}
## Complexes (ComplexPortal)

| ID | Name | Members | Curation |
|---|---|---:|---|
{% for c in complexes -%}
| {{ c.accession }} | {{ c.name | truncate(52) }} | {{ c.component_count }} | {{ c.curation }} |
{% endfor -%}
{% for c in complex_details -%}
- `{{ c.accession }}` members ({{ c.component_count }}): {{ c.component_preview }}{% if c.remaining_count > 0 %}, +{{ c.remaining_count }} more{% endif %}{% if c.description %}
  Description: {{ c.description }}{% endif %}
{% endfor -%}
{% endif -%}
{% if sections_block %}{{ sections_block }}
{% endif -%}
{% if related_block %}{{ related_block }}
{% endif -%}
