{# Border motion: rimrun — counter-rotating rim runners tracing badge/strip SEAMS.
   Specimen: rim-runners.svg (frosted prism glass badge)

   Single-seam (badges): Two separate paths trace the left panel and right panel
   boundaries, meeting at the vertical seam. NOT the outer perimeter.

   Multi-seam (strips): A single zigzag path snakes through ALL vertical dividers,
   creating a maze-like S-path: down seam 1, right along bottom, up seam 2, right
   along top, down seam 3, etc.

   Context: uid, w, h, rx, lp_w, right_x, seam_positions (list of x-coordinates) #}
{% set defs %}
<linearGradient id="{{ uid }}-prism" x1="0%" y1="0%" x2="100%" y2="100%">
  <stop offset="0%" stop-color="var(--dna-signal)"/>
  <stop offset="50%" stop-color="var(--dna-status-failing-core)"/>
  <stop offset="100%" stop-color="var(--dna-signal-dim)"/>
  <animateTransform attributeName="gradientTransform" type="rotate"
                    from="0 .5 .5" to="360 .5 .5"
                    dur="18s" repeatCount="indefinite"/>
</linearGradient>
{% endset %}
{% set overlay %}
{% if seam_positions | length > 1 %}
{# Multi-seam zigzag: snake through all vertical dividers #}
<path d="{{ rimrun_zigzag_path }}"
      fill="none" stroke="url(#{{ uid }}-prism)" stroke-width="1.4"
      pathLength="100" stroke-dasharray="6 94" opacity="0.9">
  <animate attributeName="stroke-dashoffset"
           values="0;-100" dur="4s" repeatCount="indefinite"/>
</path>
{# Secondary runner — reverse direction, slightly offset timing #}
<path d="{{ rimrun_zigzag_path }}"
      fill="none" stroke="url(#{{ uid }}-prism)" stroke-width="1.0"
      pathLength="100" stroke-dasharray="4 96" opacity="0.6">
  <animate attributeName="stroke-dashoffset"
           values="0;100" dur="5.1s" repeatCount="indefinite"/>
</path>
{% else %}
{# Single-seam fallback (badges / single-metric strips) #}
{# Runner 1: LEFT PANEL boundary (clockwise, 2.7s) #}
<path d="{{ rimrun_left_path }}"
      fill="none" stroke="url(#{{ uid }}-prism)" stroke-width="1.4"
      pathLength="100" stroke-dasharray="9 91" opacity="0.9">
  <animate attributeName="stroke-dashoffset"
           values="0;-100" dur="2.7s" repeatCount="indefinite"/>
</path>
{# Runner 2: RIGHT PANEL boundary (counter-clockwise, 3.2s) #}
<path d="{{ rimrun_right_path }}"
      fill="none" stroke="url(#{{ uid }}-prism)" stroke-width="1.2"
      pathLength="100" stroke-dasharray="7 93" opacity="0.8">
  <animate attributeName="stroke-dashoffset"
           values="0;100" dur="3.2s" repeatCount="indefinite"/>
</path>
{% endif %}
{% endset %}
