{% if gun.grid_image_url %}

{% endif %}
{{ gun.name }}
{{ gun.caliber or '?' }}
{% if gun.wiki_url %}
wiki ↗{% endif %}
{{ "%.3f"|format(gun.weight_kg) if gun.weight_kg is not none else '?' }}
Base weight (kg)
{% if gun.ergonomics %}
{{ gun.ergonomics }}
Ergonomics
{% endif %}
{% if gun.recoil_vertical %}
{{ gun.recoil_vertical }}
Recoil (V)
{% endif %}
{% if gun.fire_rate %}
{{ gun.fire_rate }}
Fire rate
{% endif %}
Lightest possible build:
{{ "%.3f"|format(lightest_total) }} kg
base {{ "%.3f"|format(gun.weight_kg or 0) }} kg + lightest mod per required slot
{# ---- Macro to render a slot card ---- #}
{% macro slot_card(slot, extra_class='', open=False) %}
{% set lightest = slot.mods[0] if slot.mods else none %}
{% endmacro %}
{# ---- Required slots (key slots highlighted, open by default) ---- #}
{% if key_slots or req_slots %}
Required slots (counted in lightest build weight)
{% for slot in key_slots %}
{{ slot_card(slot, 'key-slot', open=True) }}
{% endfor %}
{% for slot in req_slots %}
{{ slot_card(slot, '', open=False) }}
{% endfor %}
{% endif %}
{# ---- Optional slots (collapsed behind toggle) ---- #}
{% if optional_slots %}
Optional slots (not counted in lightest build weight)
{% for slot in optional_slots %}
{{ slot_card(slot) }}
{% endfor %}
{% endif %}