{#
Autodoc Card Grid Partial

Renders a grid of element cards for child elements (subcommands, classes, functions, endpoints).

Usage as INCLUDE (renders card grid):
  {% set children = element.children %}
  {% set title = 'Commands' %}
  {% include 'autodoc/partials/cards.html' %}

Required context:
  children: list of DocElements to render as cards

Optional context:
  title: Section title (string)
  card_type: Override element type for all cards (string)

For individual cards, import the macro:
  {% from 'autodoc/partials/_macros/element-card.html' import element_card %}
  {{ element_card(child) }}
#}

{% from 'autodoc/partials/_macros/element-card.html' import element_card %}

{% let section_title = title ?? '' %}
{% let section_card_type = card_type ?? none %}

{% if children %}
{% if section_title %}
<section class="autodoc-section" data-section="children">
  <h2 class="autodoc-section-title">{{ section_title }}</h2>
{% end %}

  <div class="autodoc-cards">
    {% for child in children %}
    {{ element_card(child, section_card_type) }}
    {% end %}
  </div>

{% if section_title %}
</section>
{% end %}
{% end %}
