{% set preTitle = post.get_field('pre-title') %}
{% set title =   post.get_field('section_title') %}
{% set hx = post.get_field('h_title') %}
{% set btns = post.get_field('boutons') %}
{% set nbBtns =  btns|length %}
{% set text =  post.get_field('text_center') %}
{% set style =  post.get_field('block_style') %}
{% set forceCenter =  post.get_field('force_center') %}
{#{% set forceLeft =  post.get_field('force_left') %}#}
{% set forceLeftClass =  'variant-text-left' %}
{% if forceCenter is iterable and forceCenter[0] == 'force-center' %}
    {% set forceLeftClass =  '' %}
{% endif %}
{% set animClass = isPreview ? '' : '' %}

<section class="container-text-center container-large scrollmagic-toggle-class {{ style }} {{ forceLeftClass }} list-circle">

    <header class="{{animClass}}">
        {% if preTitle is not empty  %}
            <span class="headline-text">{{ preTitle }}</span>
        {% endif %}
        {% if title is not empty  %}
            <{{ hx }} class="title-center">{{ title }}</{{ hx }}>
        {% endif %}
    </header>
    {% if text is not empty  %}
        <span class="{{animClass}}">{{ text }}</span>
    {% endif %}

    {% if nbBtns > 0  %}
        <div class="container-center-buttons {{animClass}}">

            {% for button in btns %}
                {% set icon =  'btn-arrow-right' %}
                {% set btnStyle = button['btn_style'] %}
                {% set btnIcon =  '' %}

                {% if btnStyle == icon  %}
                    {% set btnIcon = function('getSvgCode', icon) %}
                {% endif %}

                {% set target = "" %}
                {% if button['type'] == 'url'  %}
                    {% set href = button['url'] %}
                    {% set target = block.getTarget(href) %}
                {% elseif button['type'] == 'page_link' %}
                    {% set href =  button['page_link'] %}
                {% elseif button['type'] == 'email' %}
                    {% set href = 'mailto:' ~ button['txt_url_email_btn'] %}
                {% elseif button['type'] == 'category_page' %}
                    {% set href =  function('get_term_link', button['url']) %}
                {% endif %}

                {% if button['text'] is not empty %}
                    <a class="{{ btnStyle }}" href="{{ href }}" target="{{target}}">{{ button['text'] }}{{ btnIcon }}</a>
                {% endif %}
            {% endfor %}
        </div>
    {% endif %}

</section>
