{{-- Projects listing (PRD ยง10.2): featured first and distinguished; category/tool filters; empty state with Clear filters; Load more. Without JS the query string filters server-side; with JS it filters in place. --}} @php $active = array_filter(['category' => request()->string('category')->value() ?: null, 'tool' => request()->string('tool')->value() ?: null]); $matches = fn ($project): bool => (! isset($active['category']) || $project->categories->contains('slug', $active['category'])) && (! isset($active['tool']) || $project->tools->contains('slug', $active['tool'])); $projects = $vm->resolved('projects', []); $visibleCount = count(array_filter($projects, $matches)); $groups = [ 'category' => ['label' => __('portfolio.ui.filter_category'), 'options' => collect($vm->resolved('categories', []))->pluck('name', 'slug')->all()], 'tool' => ['label' => __('portfolio.ui.filter_tool'), 'options' => collect($vm->resolved('tools', []))->pluck('name', 'slug')->all()], ]; @endphp
@if ($vm->get('show_filters', true) && $projects !== []) @include('partials.listing-filters', ['groups' => $groups, 'active' => $active, 'baseUrl' => route('projects.index')]) @endif

@foreach ($projects as $project) @endforeach
@if ($projects !== []) {{ __('portfolio.ui.clear_filters') }} @endif