{{ attach_library('gesso/details') }}

{% set classes = [
  'c-details',
  modifier_classes ? modifier_classes : '',
]|join(' ')|trim %}

{% set summary_classes = [
  'c-details__summary',
  required ? 'is-required' : '',
]|join(' ')|trim %}

<details {{ add_attributes({ 'class': classes }) }}>
  {% if details_summary %}
    <summary {{ add_attributes({ 'class': summary_classes, 'role': 'button' }) }}>{{ details_summary }}</summary>
  {% endif %}
  <div class="c-details__content">
    {% if details_description %}
      <div class="c-details__description">{{ details_description }}</div>
    {% endif %}
    {{ details_content }}
  </div>
</details>
