{% load ocyan_thumbnail wagtailcore_tags styling_tags coyote_tags %}
<section class="accordion-block-wrapper {{self.coyote_bg}}" id="{{ self.coyote_anchor }}">
    <div class="container">
        <div class="row">
            <div class="col-lg-5">
                <h3>{{ self.header }}</h3>
                <p class="mb-0">{{ self.body }}</p>
            </div>

            <div class="col-lg-7 ps-lg-5">
                {% get_unique_id as accordion_id %}
                <div class="accordion" id="accordion{{ accordion_id }}">
                    {% for accordion in self.accordion %}
                        {% get_unique_id as accordion_item_id %}
                        {% with heading_id="accordion-heading-"|add:accordion_item_id collapse_id="accordion-item-"|add:accordion_item_id %}
                        <div class="accordion-item">
                            <h4 class="accordion-header" id="{{ heading_id }}">
                                <button
                                    class="accordion-button collapsed p-3"
                                    type="button"
                                    data-bs-toggle="collapse"
                                    data-bs-target="#{{ collapse_id }}"
                                    aria-expanded="false"
                                    aria-controls="{{ collapse_id }}"
                                >
                                    {{ accordion.header }}
                                </button>
                            </h4>
                            <div id="{{ collapse_id }}" class="accordion-collapse collapse" aria-labelledby="{{ heading_id }}" data-bs-parent="#accordion{{ accordion_id }}">
                                <div class="accordion-body">
                                    {{ accordion.body }}
                                    {% if accordion.button %}
                                        <div class="mt-5">
                                            {% include "coyote/blocks/partials/button.html" with button=accordion.button %}
                                        </div>
                                    {% endif %}
                                </div>
                            </div>
                        </div>
                        {% endwith %}
                    {% endfor %}
                </div>
            </div>
        </div>
    </div>
</section>
