{# Cellular icon content — v0.3.0 visual refresh (48×48, 5×5 living grid).

   Replaces the prior 64×64 4×4-grid implementation. The new geometry pulls
   ALL dimension values from paradigm config (icon_grid_cols, icon_cell_size,
   icon_inner_inset, icon_glyph_size, etc.) so dimension changes don't
   require template edits and CLAUDE.md "Compose owns geometry, template
   renders" stays clean.

   Cell tier system (5 classes via (row*cols + col) % 5):
     cz1 → chart_levels[1]   (dark active)
     cz2 → mid_accent        (mid active)
     cz3 → info_accent       (bright active)
     cz4 → mid_accent        (alt-phase mid; same color, different stagger)
     czd → header_band       (dormant — opacity 0.08, no animation)

   Cell distribution by deterministic modulo means cz3 (bright) appears
   every 5 cells, cz4 (mid alt-phase) every 5 cells, etc. The hand-tuned
   composition in the v3-sulfur prototype emphasizes cz3 more than uniform
   distribution would; if proofset visual review prefers the prototype's
   concentration, swap to a hash-based dispatch later. The simple modulo
   gives a balanced grid acceptable as the initial render. #}

{% set _surface = icon_surface_fill | default('var(--dna-surface)') %}
{% set _cw = width | default(48) %}
{% set _ch = height | default(48) %}
{% set _inner_x = icon_inner_inset | default(10.08) %}
{% set _inner_size = icon_inner_size | default(27.84) %}
{% set _inner_rx = icon_inner_rx | default(4) %}
{% set _glyph_inset = icon_glyph_inset | default(13.44) %}
{% set _glyph_size = icon_glyph_size | default(21.12) %}
{% set _outer_rx = icon_outer_rx | default(6) %}
{% set _info = icon_info_accent %}
{% set _mid = icon_mid_accent %}

{# Card clip — masks any cell overflow inside the rounded outer rect so the
   8×8 cells along the edges of the 5×5 grid don't extrude past the corner
   curve. #}
<clipPath id="{{ uid }}-card-clip"><rect width="{{ _cw }}" height="{{ _ch }}" rx="{{ _outer_rx }}"/></clipPath>

{# Background — solid surface fill with rounded corners. #}
<rect width="{{ _cw }}" height="{{ _ch }}" fill="{{ _surface }}" rx="{{ _outer_rx }}"/>

{# Living cell substrate — 5×5 grid at opacity 0.75 so the layer reads as
   ambient texture rather than competing with the centered glyph. Cells
   are clipped to the card edge so corner cells stay inside the rounded
   rect. #}
<g opacity="0.75" clip-path="url(#{{ uid }}-card-clip)">
{% for cell in icon_cells %}
    <rect x="{{ cell.x }}" y="{{ cell.y }}" width="{{ cell.size }}" height="{{ cell.size }}" rx="{{ cell.rx }}" fill="{{ cell.fill }}" class="{{ cell.class_name }}"/>
{% endfor %}
</g>

{# Inner canvas — semi-opaque rect that mutes the cell substrate behind the
   glyph so the brand mark stays the focal point. Outlined in mid_accent at
   30% opacity for a subtle frame edge. #}
<rect x="{{ _inner_x }}" y="{{ _inner_x }}" width="{{ _inner_size }}" height="{{ _inner_size }}" fill="{{ _surface }}" opacity="0.72" rx="{{ _inner_rx }}"/>
<rect x="{{ _inner_x }}" y="{{ _inner_x }}" width="{{ _inner_size }}" height="{{ _inner_size }}" fill="none" stroke="{{ _mid }}" stroke-width="0.5" opacity="0.3" rx="{{ _inner_rx }}"/>

{# Glyph — centered inside the inner canvas. Filled with info_accent for
   maximum brand visibility against the muted backdrop. Embedded SVG sized
   to icon_glyph_size with the registry's glyph viewBox preserved. #}
{% if glyph_path %}
<svg x="{{ _glyph_inset }}" y="{{ _glyph_inset }}" width="{{ _glyph_size }}" height="{{ _glyph_size }}" viewBox="{{ glyph_viewbox }}">
  <path d="{{ glyph_path }}"{% if glyph_fill_rule %} fill-rule="{{ glyph_fill_rule }}"{% endif %} fill="{{ _info }}"/>
</svg>
{% endif %}

{# Outer border — single mid_accent hairline at full opacity tracing the
   rounded card edge. Reads as the icon's structural frame. #}
<rect x="{{ icon_geometry.cellular_border_x }}" y="{{ icon_geometry.cellular_border_y }}" width="{{ icon_outer_w }}" height="{{ icon_outer_h }}" fill="none" stroke="{{ _mid }}" stroke-width="0.5" rx="{{ _outer_rx }}"/>
