{{--
    Blog Post Not Found — Contextual 404
    Shown at /blog/:slug when post doesn't exist or is unpublished.

    Variables:
    $latestPosts  Collection  (max 6)
--}}
@extends('errors._layout', [
    'error_code'    => 404,
    'error_title'   => 'Article Not Found',
    'error_message' => 'This article is no longer available or the link has changed.',
])

@section('badge', 'Article Not Found')

@section('primary-cta')
<a href="/blog"
   class="inline-flex items-center gap-2 rounded-xl bg-sky-500 hover:bg-sky-400 text-white font-semibold px-6 py-3 text-sm shadow-lg shadow-sky-900/30 transition-colors">
    <i class="fas fa-newspaper" aria-hidden="true"></i>
    Visit Blog
</a>
@endsection

@section('secondary-ctas')
<a href="/" class="rounded-xl border border-white/10 hover:border-white/25 text-white/70 hover:text-white px-4 py-2 text-sm transition-colors">
    Home
</a>
@endsection

@section('recovery')

@if(isset($latestPosts) && $latestPosts->count())
<div>
    <h2 class="text-sm font-semibold text-white/40 uppercase tracking-widest mb-4">Latest Articles</h2>
    <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
        @foreach($latestPosts->take(6) as $post)
        <a href="{{ $post['url'] }}"
           class="flex flex-col gap-2 rounded-xl p-4 bg-white/3 hover:bg-white/7 border border-white/5 hover:border-sky-500/20 transition-all">
            <p class="text-sm font-semibold text-white leading-snug">{{ $post['title'] }}</p>
            @if(!empty($post['excerpt']))
            <p class="text-xs text-white/50 leading-relaxed flex-1">{{ $post['excerpt'] }}</p>
            @endif
            @if(!empty($post['published_at']))
            <p class="text-xs text-white/30 mt-auto">{{ $post['published_at'] }}</p>
            @endif
        </a>
        @endforeach
    </div>
</div>
@endif

@endsection
