{{--
    Breadcrumb component with schema.org structured data.

    @param  \Illuminate\Support\Collection  $breadcrumbs
            Collection of objects with ->name and ->url properties.
--}}
@php
    $breadcrumbTrail = \App\Support\Seo\BreadcrumbTrail::normalize($breadcrumbs ?? collect());
@endphp
@if($breadcrumbTrail !== [])
<nav class="flex items-center gap-1.5 flex-wrap text-sm text-neutral-400" aria-label="Breadcrumb">
    @foreach($breadcrumbTrail as $crumb)
        @if(!$loop->first)
            <span class="opacity-40" aria-hidden="true">›</span>
        @endif
        @if(!$loop->last)
            <a class="hover:text-white transition-colors" href="{{ $crumb['url'] }}">{{ $crumb['name'] }}</a>
        @else
            <span class="text-white/70" aria-current="page">{{ $crumb['name'] }}</span>
        @endif
    @endforeach
</nav>
@endif
