{% set link = link|default("#") %}
{% set style = style|default(null) %}
{% set target = target|default(null) %}
{% set variation = variation|default(null) %}
{% set attributes = attributes|default([]) %}

{% if id %}
  {% set attributes = attributes|merge(['id="'~ id ~'"']) %}
{% endif %}

{% if target %}
  {% set attributes = attributes|merge(['target="'~ target ~'"']) %}
{% endif %}

{% if aria_label %}
  {% set attributes = attributes|merge(['aria-label="'~ aria_label ~'"']) %}
{% else %}
  {% set attributes = attributes|merge(['aria-label="'~ title ~'"']) %}
{% endif %}

{% if style and style in ['cta', 'link', 'social'] %}
  {% set classname = classname|split(' ')|merge(['--' ~ style])|join(' ')%}
{% endif %}

{% if variation %}
  {% set classname = classname|split(' ')|merge(variation|split(' ')|map(v => '--' ~ style ~ '-' ~ v))|join(' ')%}
{% endif %}

<a
  href="{{ link }}"
  class="btn {{ classname }}"
  title="{{ aria_label|default(title) }}"
  {{ attributes|join(" ") }}
>
  <span class="btn__bg" aria-hidden="true" data-ignore-css-empty></span>
  <span class="btn__label" aria-hidden="true">{{ title }}</span>
</a>
