{# Cellular strip frame: void canvas + cellular flanking cells + content panel.

   v0.3.0: flanks always render when the resolver supplies flank_width > 0
   (cells are the genome's identity — a cellular strip without cells isn't
   automata). Paired variants render primary tone LEFT + secondary tone RIGHT;
   solo variants render primary tone on BOTH sides. cellular_palette.secondary
   mirrors primary in solo mode (per resolve_cellular_palette), so the
   left/right rendering is uniform code path with no is_paired branch needed
   at the structural level. #}

<g clip-path="url(#{{ uid }}-clip)">
  {# 1. Void ground #}
  <rect width="{{ width }}" height="{{ strip_h }}" fill="{{ surface_0 | default('var(--dna-surface)') }}"/>

  {% if has_flanks %}
  {# 2. Left flank — primary tone cells (always rendered when has_flanks).
     Asymmetric phi offsets via cz1/cz2/cz3/cz4/czf/czd classes. #}
  {% set primary_trio = cellular_palette.primary.cellular_cells %}
  <g opacity="{{ strip_zones.cellular.pattern_opacity }}">
  {% for cell in strip_zones.cellular.left_flank_cells %}
    <rect x="{{ cell.x }}" y="{{ cell.y }}" width="{{ cell.size }}" height="{{ cell.size }}" fill="{{ primary_trio[cell.color_idx] }}" class="{{ cell.class_name }}"/>
  {% endfor %}
  </g>

  {# 3. Right flank — secondary tone cells (paired variants get the secondary
     palette here; solo variants get primary mirrored via resolve_cellular_palette).
     Different cz-class rotation than the left so the pulse pattern doesn't echo. #}
  {% set secondary_trio = cellular_palette.secondary.cellular_cells %}
  <g opacity="{{ strip_zones.cellular.pattern_opacity }}">
  {% for cell in strip_zones.cellular.right_flank_cells %}
    <rect x="{{ cell.x }}" y="{{ cell.y }}" width="{{ cell.size }}" height="{{ cell.size }}" fill="{{ secondary_trio[cell.color_idx] }}" class="{{ cell.class_name }}"/>
  {% endfor %}
  </g>
  {% endif %}

  {# 4. Content panel — interior between flanks #}
  <rect x="{{ strip_zones.cellular.panel_x }}" y="{{ strip_cellular_panel_y }}" width="{{ strip_zones.cellular.panel_w }}" height="{{ strip_zones.cellular.panel_h }}" fill="{{ surface_0 | default('var(--dna-surface)') }}" opacity="0.95"/>
  <rect x="{{ strip_zones.cellular.panel_x }}" y="{{ strip_cellular_panel_y }}" width="{{ strip_zones.cellular.panel_w }}" height="{{ strip_zones.cellular.panel_h }}" fill="none" stroke="{{ border_tint | default('var(--dna-border-tint)') }}" stroke-width="0.5" opacity="0.28"/>
</g>
