<x-layout title="News & Insights"
          description="News, insights, and perspectives from Brokam International on procurement, logistics, and technology infrastructure.">

    <x-page-hero kicker="News & Insights"
                 title="Perspectives from the supply chain."
                 subtitle="Thinking on procurement, logistics, resilience, and integration — and news from across Brokam International."
                 :crumbs="['Home' => route('home'), 'News' => null]">
    </x-page-hero>

    <section class="section">
        <div class="shell">
            @if ($articles->isEmpty())
                <div class="card p-12 text-center"><p class="text-slate-500">No articles published yet. Check back soon.</p></div>
            @else
                {{-- Featured (first page only) --}}
                @if ($featured && $articles->onFirstPage())
                    <a href="{{ route('news.show', $featured) }}" class="card group grid lg:grid-cols-2 overflow-hidden mb-12">
                        <div class="relative aspect-[16/10] lg:aspect-auto bg-navy-900 grid-bg min-h-[260px] grid place-items-center overflow-hidden">
                            <div class="absolute -right-10 -top-10 w-56 h-56 rounded-full blur-3xl" style="background: radial-gradient(circle, rgba(217,118,63,.5), transparent 70%);"></div>
                            <x-icon name="spark" class="relative w-20 h-20 text-white/20 group-hover:scale-110 transition-transform duration-500"/>
                            <span class="absolute top-5 left-5 text-[11px] font-semibold uppercase tracking-wider bg-brand-500 text-white px-3 py-1 rounded-full">Featured · {{ $featured->category }}</span>
                        </div>
                        <div class="p-8 lg:p-12 flex flex-col justify-center">
                            <p class="text-xs text-slate-400">{{ optional($featured->published_at)->format('d M Y') }} · {{ $featured->reading_time }} min read</p>
                            <h2 class="mt-3 text-2xl lg:text-3xl font-semibold text-slate-ink group-hover:text-brand-600 transition-colors leading-tight">{{ $featured->title }}</h2>
                            <p class="mt-4 text-slate-600 leading-relaxed">{{ $featured->excerpt }}</p>
                            <span class="mt-6 inline-flex items-center gap-2 font-semibold text-brand-600">Read article <x-icon name="arrow" class="w-4 h-4 group-hover:translate-x-1 transition-transform"/></span>
                        </div>
                    </a>
                @endif

                <div class="grid md:grid-cols-2 lg:grid-cols-3 gap-6">
                    @foreach ($articles as $article)
                        @if ($featured && $article->is($featured) && $articles->onFirstPage()) @continue @endif
                        <x-article-card :article="$article"/>
                    @endforeach
                </div>

                <div class="mt-12">{{ $articles->links() }}</div>
            @endif
        </div>
    </section>

    <x-cta-band/>
</x-layout>
