@extends('front.layouts.app')
@section('content')
    <main class="container-lg mt-3">

        @include('front.partials.breadcrumbs')

        <div class="row g-4">
            <div class="col-md-8">
                <h1 class="pb-2 h2 font-family-roboto-condensed">

                    @if ($page_type == 'search')
                        @if (isset($title))
                            {{ $title }}
                        @endif
                    @else
                        @if (isset($category) && !is_null($category))
                            {{ $category->name }} News from FutureWalker
                        @else
                            AI &amp; Tech News from FutureWalker
                        @endif
                    @endif
                </h1>
                @if ($posts->count() > 0)
                    @foreach ($posts as $post)
                        @include('front.partials.post_detail', ['post' => $post])
                    @endforeach
                    @if ($posts instanceof \Illuminate\Pagination\CursorPaginator)
                        <div class="flex justify-center">
                            {{ $posts->links('pagination::simple-bootstrap-5-rounded') }}
                        </div>
                    @endif
                @else
                    <div class="py-3 text-center">
                        <div class="mb-2">No posts found yet.</div>
                        <div><a href="{{ route('front.home') }}">Back to Home</a></div>
                    </div>
                @endif
            </div>

            <div class="col-md-4">
                <div class="position-sticky" style="top: 2rem;">
                    @include('front.partials.sidebar')
                </div>
            </div>
        </div>
    </main>
@endsection

@push('top_head')
    {!! $breadcrumb_context !!}
@endpush
