{% import "macros.html" as m %}
{% if not view.ok %}
  {{ m.absence(view) }}
{% elif view.ready or view.blocked %}
  <p class="lead fw-lede">Most valuable next, with the why. {{ m.derived() }} ranking over reported facts:
  <span class="mono">score = (impact_w × 2) + unblocks − (effort_w − 1)</span>, weights
  <span class="mono">impact {low:1,med:2,high:3}</span> · <span class="mono">effort {XS/S:1,M:2,L:3,XL:4}</span>.
  A <span class="mono">priority</span> floats an item to the top of its readiness class.</p>

  {% if view.ready %}
  <h3 class="fw-nb-h">Ready — do next</h3>
  <div class="fw-cards">
    {% for r in view.ready %}
    <article class="fw-nb">
      <div class="fw-nb__rail">
        <div class="fw-nb__score" title="(impact_w × 2) + unblocks − (effort_w − 1)">
          <span class="fw-nb__score-n">{{ r.score }}</span><span class="fw-nb__score-l">score</span>
        </div>
        {{ m.derived() }}
      </div>
      <div class="fw-nb__body">
        <div class="fw-nb__why mono">{{ r.why }}{% if r.priority %} · <b>priority {{ r.priority }}</b>{% endif %}</div>
        {{ m.task_card(r.task) }}
      </div>
    </article>
    {% endfor %}
  </div>
  {% endif %}

  {% if view.blocked %}
  <h3 class="fw-nb-h fw-nb-h--blocked">Highest-value, but blocked by deps</h3>
  <p class="evidence fw-nb-note">Listed (never dropped), but not “to do next” — each waits on unfinished work. {{ m.derived() }}</p>
  <div class="fw-cards">
    {% for r in view.blocked %}
    <article class="fw-nb fw-nb--blocked">
      <div class="fw-nb__rail">
        <div class="fw-nb__waiting mono">waiting on<br><b>{{ r.blocked_on|join(', ') }}</b></div>
      </div>
      <div class="fw-nb__body">
        <div class="fw-nb__why mono">{{ r.why }}{% if r.priority %} · <b>priority {{ r.priority }}</b>{% endif %}</div>
        {{ m.task_card(r.task) }}
      </div>
    </article>
    {% endfor %}
  </div>
  {% endif %}
{% else %}
  {{ m.empty_inline(view.empty_title, view.empty_reason) }}
{% endif %}
