@foreach ($group['items'] as $m)
@php
$n = count($m['snapshots']);
$growthState = $n <= 1 ? 'baseline' : ($n === 2 ? 'before_after' : 'full_arc');
$hitTarget = $m['target'] > 0 && $m['current'] >= $m['target'];
$peak = max($m['target'], $m['current'], 1);
foreach ($m['snapshots'] as $s) $peak = max($peak, (float) $s['value']);
$barH = fn ($v) => max(4, min(50, (int) round(($v / $peak) * 50)));
$labelHasTarget = $labelContainsTarget($m['label'], $m['target'], $m['unit']);
@endphp
@if ($m['meaning'] !== '')
{{-- Meaning leads. The metric is evidence.
"as measured by {label}" reads as the receipt
underneath — same rule as Page 2's verdict + read
pattern, one level down. --}}
{{ $m['meaning'] }}
{{ __('stakeholder.ij.as_measured_by') }} {{ $m['label'] }}
@if ($m['measuredBy'] !== '')
— {{ $m['measuredBy'] }}
@endif
@else
{{-- No authored meaning yet: today's behavior — the
authored label leads, optional methodology below.
No regression. --}}
{{ $m['label'] }}
@if (! $labelHasTarget && $m['target'] > 0)
{{ __('stakeholder.ij.target_lbl') }} {{ $fmt($m['target'], $m['unit']) }}
@endif
@if ($m['measuredBy'] !== '')
{{ __('stakeholder.ij.as_measured_by') }} {{ $m['measuredBy'] }}
@endif
@endif
{{-- ONE persistent bar per metric. Track = the target
(always visible, same shape all lenses). Fill = current
progress, animates on lens change via CSS transition.
Vision → fill 0%. Progress → fill current/target. Impact
→ fill 100%. The morph IS the story. --}}
@php
// Cap the visual fill % — over-target still reads as full,
// "we did this" carries the over-delivery in the value label.
$progressPct = $m['target'] > 0
? min(100, ($m['current'] / $m['target']) * 100)
: 0;
// Fill values per lens — the JS uses these dataset attrs
// to swap width + label text on lens change.
$visionFill = 0;
$progressFill = $progressPct;
$impactFill = 100;
$visionLabel = __('stakeholder.ij.fill_lbl_vision');
$progressLabel = sprintf(__('stakeholder.ij.fill_lbl_progress'), $fmt($m['current'], $m['unit']));
$impactLabel = sprintf(__('stakeholder.ij.fill_lbl_impact'), $fmt(max($m['current'], $m['target']), $m['unit']));
@endphp
{{
$defaultLens === 'vision' ? $visionLabel
: ($defaultLens === 'impact' ? $impactLabel : $progressLabel)
}}
{{ __('stakeholder.ij.target_lbl') }} {{ $fmt($m['target'], $m['unit']) }}
{{-- ─── VERDICTS — tense-aware, encouragement via structure ── --}}
{{-- Vision: future tense. --}}
{{ __('stakeholder.ij.v_will_be_measured') }}
{{-- Progress: present-becoming tense. One framing for both
units — "N% of the way" reads truthfully for counts and
percents alike, and stays consistent down the column
regardless of metric type. --}}
{{-- One progress color for every in-progress row: the text is
uniformly "N% of the way", and the percentage itself conveys
how far along. A silent amber↔blue flip at a hidden 75%
threshold made identically-worded rows look different for no
visible reason, so the dot stays consistent down the column. --}}
@if ($n === 0)
{{ __('stakeholder.ij.v_no_snapshots_yet') }}
@elseif ($hitTarget)
{{ __('stakeholder.ij.v_hit_target_progress') }}
@elseif ($m['target'] > 0)
{{ sprintf(__('stakeholder.ij.v_pct_of_way'), (int) round(($m['current'] / $m['target']) * 100)) }}
@else
{{ __('stakeholder.ij.v_trending') }}
@endif
{{-- Impact: past tense. Only truthful for hit-target rows. --}}
@if ($hitTarget)
{{ __('stakeholder.ij.v_we_did_this') }}
@else
{{ __('stakeholder.ij.v_not_yet_impact') }}
@endif