{#
Autodoc Parameters List Partial

Renders parameters as a definition list (alternative to table).

Required: params (list of dicts or DocElements)
Optional: title (str)
#}

{% let section_title = title ?? 'Parameters' %}

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

  <dl class="autodoc-params">
    {% for param in params %}
    {# ChainableUndefined handles both dict and object access #}
    {% let is_required = param?.metadata?.required ?? param?.required ?? false %}
    {% let param_name = param?.name ?? 'unknown' %}
    {% let param_type_val = param?.metadata?.type ?? param?.type ?? '' %}
    {% let param_default = param?.metadata?.default ?? param?.default %}
    {% let param_desc = param?.description ?? param?.docstring ?? '' %}
    <div class="autodoc-param" data-required="{{ 'true' if is_required else 'false' }}">
      <dt class="autodoc-param-name">
        <code>{{ param_name }}</code>
        {% if param_type_val %}
        <span class="autodoc-param-type">{{ param_type_val }}</span>
        {% end %}
      </dt>
      <dd class="autodoc-param-desc">
        {{ param_desc }}
        {% if param_default %}
        <span class="autodoc-param-default">Default: <code>{{ param_default }}</code></span>
        {% end %}
      </dd>
    </div>
    {% end %}
  </dl>
</section>
{% end %}
