{# Brutalist strip — DARK substrate brutalist strip grammar (v0.3.2 Phase C).
   Renders the FULL strip composition: substrate, perimeter, accent rail,
   brand panel (inset tone), ACCENT-VOID-ACCENT triple divider, identity
   ornament, HYPERWEAVE brand text, metric cells, bookend ornament, status
   indicator. The parent strip.svg.j2 wraps its shared zone pipeline in
   {% if not paradigm_owns_strip %} and skips it for brutalist; this partial
   owns every pixel of the strip body. Border motion overlay still runs from
   the parent after this block — it shares the {{ uid }}-clip clip path the
   <g> below defines.

   Geometry constants (brand_panel_x, triple_divider_x, ornament_x, etc.)
   come from data/paradigms/brutalist.yaml via ParadigmStripConfig and are
   plumbed through compose/resolver.py:resolve_strip into context. No
   template-side arithmetic per CLAUDE.md "compose owns geometry, template
   renders". #}
<g clip-path="url(#{{ uid }}-clip)">
  {# (1) Void substrate — full canvas. #}
  <rect width="{{ width }}" height="{{ strip_h }}" fill="var(--dna-surface)"/>

  {# (1b) Grain texture overlay — barely-visible darkening filter that
     gives the dark substrate material depth. Matches prototype line 68
     (the v0.3.2 brutalist strip prototype celadon panel). #}
  <rect width="{{ width }}" height="{{ strip_h }}" filter="url(#{{ uid }}-grain)"/>

  {# (2) Perimeter hairline border — accent at 0.20 opacity for definition. #}
  <rect x="{{ strip_perimeter_inset }}" y="{{ strip_perimeter_inset }}" width="{{ strip_perimeter_w }}" height="{{ strip_perimeter_h }}"
        fill="none" stroke="var(--dna-signal)" stroke-width="1" opacity="0.20"/>

  {# (3) Left accent rail — 6px solid accent (signature brutalist identity bar). #}
  <rect width="{{ accent_w }}" height="{{ strip_h }}" fill="var(--dna-signal)"/>

  {# (4) Brand panel — elevated inset tone. brand_panel_fill declared per dark
     variant in genome JSON; plumbed via assembler CSS mapping. #}
  <rect x="{{ strip_zones.core.brand_panel_x }}" y="{{ strip_origin_y }}"
        width="{{ strip_zones.core.brand_panel_w }}" height="{{ strip_h }}"
        fill="var(--dna-brand-panel-fill)"/>

  {# (5) ACCENT-VOID-ACCENT triple divider at brand-panel-right seam — the
     identity↔metrics separator, so it renders only when metrics are present
     (empty strips are identity-only, no dangling divider). Outer bars
     --dna-signal at 0.7 opacity; center void --dna-surface. #}
  {% if metrics %}
  <rect x="{{ strip_zones.core.triple_divider_x }}" y="{{ strip_origin_y }}"
        width="{{ triple_divider_bar_w }}" height="{{ strip_h }}"
        fill="var(--dna-signal)" opacity="0.7"/>
  <rect x="{{ strip_zones.core.triple_divider_void_x }}" y="{{ strip_origin_y }}"
        width="{{ triple_divider_void_w }}" height="{{ strip_h }}"
        fill="var(--dna-surface)"/>
  <rect x="{{ strip_zones.core.triple_divider_right_x }}" y="{{ strip_origin_y }}"
        width="{{ triple_divider_bar_w }}" height="{{ strip_h }}"
        fill="var(--dna-signal)" opacity="0.7"/>
  {% endif %}

  {# (6) Identity glyph slot — glyph_path is the explicit/provider glyph, or
     the HyperWeave sigil that the resolver defaults strips to. It renders at
     the ornament position scaled to ornament_size, filled with the variant's
     accent. glyph_path is empty only under ?glyph=none (suppression), in which
     case nothing renders here. #}
  {% if glyph_path %}
  {# v0.3.9 algorithmic strip glyph: identity glyph sized by ``strip_glyph_size``
     (derived from ``strip_height * strip_glyph_ratio`` in compose/resolver.py)
     instead of a hand-tuned magic number that had to be re-synced with
     chrome's glyph size. Distinct from ornament_size (14) which sizes the
     right bookend square below. Glyph y-shifts so it stays vertically
     centered at the same line as the legacy 14×14 ornament
     (center y = ornament_y + 7). #}
  <g data-hw-zone="brand-glyph" transform="translate({{ strip_zones.bookend.identity_glyph_x }},{{ strip_zones.bookend.identity_glyph_y }})">
    <svg viewBox="{{ glyph_viewbox }}" width="{{ strip_glyph_size }}" height="{{ strip_glyph_size }}">
      <path d="{{ glyph_path }}"{% if glyph_fill_rule %} fill-rule="{{ glyph_fill_rule }}"{% endif %} fill="var(--dna-glyph-inner, var(--dna-signal))"/>
    </svg>
  </g>
  {% endif %}

  {# (7) HYPERWEAVE identity text — Barlow Condensed 11px 900 inside brand panel.
     v0.3.9: textLength + lengthAdjust shrink-to-fit when identity overflows the
     brand panel (computed by compute_strip_zones). Empty for normal-length
     identities. Attribute lives on <text>, NOT <tspan> (Camo inconsistency). #}
  <text data-hw-zone="identity"
        x="{{ identity_text_x }}" y="{{ identity_text_y }}"
        class="{{ uid }}-brand-text"{% if identity_text_length and identity_text_length > 0 %} textLength="{{ identity_text_length }}" lengthAdjust="spacingAndGlyphs"{% endif %}>{{ identity | upper }}</text>

  {# (8) Metric cells with inter-cell dividers. Skips the first seam (already
     painted as the ACCENT-VOID-ACCENT triple at triple_divider_x). cell_layouts[i]
     supplies pre-resolved coordinates; no template arithmetic. #}
  {% for metric in metrics %}
    {% set _layout = cell_layouts[loop.index0] %}
    {% if _layout.show_leading_rule %}
    <line x1="{{ _layout.cell_x }}" y1="{{ strip_zones.core.metric_rule_y1 }}" x2="{{ _layout.cell_x }}" y2="{{ strip_zones.core.metric_rule_y2 }}"
          stroke="var(--dna-signal)" stroke-width="0.5" opacity="0.10"/>
    {% endif %}
    <g data-hw-zone="metric-{{ loop.index0 }}" transform="translate({{ _layout.cell_x }},0)">
      <text x="{{ _layout.label_x }}" y="{{ metric_label_y }}"
            text-anchor="{{ _layout.text_anchor }}"
            class="{{ uid }}-metric-label"{% if _layout.label_w and _layout.label_w > 0 %} textLength="{{ _layout.label_w | round(1) }}" lengthAdjust="spacingAndGlyphs"{% endif %}>{{ metric.label | upper }}</text>
      <text x="{{ _layout.value_x }}" y="{{ metric_value_y }}"
            text-anchor="{{ _layout.text_anchor }}"
            class="{{ uid }}-metric-value"{% if _layout.value_w and _layout.value_w > 0 %} textLength="{{ _layout.value_w | round(1) }}" lengthAdjust="spacingAndGlyphs"{% endif %}>{{ metric.value }}</text>
    </g>
  {% endfor %}

  {# (9) Status terminus — stateful strips render the status indicator at
     bookend_x (outside this clip group, below). Stateless strips render
     NOTHING here: the "operational status" slot is empty when there's no
     state, so the strip ends at the last metric cell + pad (width reclaimed
     in compute_strip_zones). v0.3.13 retired the decorative bookend square —
     it was redundant with the left identity glyph (two bookending squares). #}
</g>

{# (10) Status indicator — conditional, outside the clip group. Renders at
   bookend_x (not the shared-pipeline status_x) so brutalist stateful strips
   show the status diamond/ring where the decorative bookend would otherwise
   sit. brutalist-status.j2 supplies the rect+inner-bit composition; CSS
   classes paint the state-color based on data-hw-status. #}
{% if show_status_indicator %}
<g data-hw-zone="status" transform="translate({{ strip_zones.core.bookend_x }},{{ strip_zones.core.half_h }})"
   {% if status_shape_rendering != "geometricPrecision" %}shape-rendering="{{ status_shape_rendering }}"{% endif %}>
{% include "frames/strip/brutalist-status.j2" %}
</g>
{% endif %}
