@php
    $newsItems = collect(is_array($items ?? null) ? $items : [])->filter()->take(6)->values();
@endphp

@if ($newsItems->isNotEmpty())
    <section class="mt-14 px-4 sm:px-6 lg:px-8">
        <div class="mb-5 flex items-center justify-between gap-4">
            <h2 class="text-xl font-bold text-white">News &amp; Updates</h2>
            <a href="/news" class="text-sm text-nova-300 transition hover:text-white">All news</a>
        </div>

        <div class="divide-y divide-nova-800 overflow-hidden rounded-[24px] border border-white/10 bg-panel">
            @foreach ($newsItems as $item)
                <a href="{{ $item['url'] ?? '#' }}" class="grid gap-3 px-5 py-4 transition hover:bg-nova-800 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start">
                    <div class="min-w-0">
                        @if (!empty($item['eyebrow']))
                            <div class="text-[11px] font-semibold uppercase tracking-[0.16em] text-nova-300">{{ $item['eyebrow'] }}</div>
                        @endif
                        <div class="mt-1 line-clamp-2 text-sm font-medium text-white">{{ $item['title'] ?? 'News item' }}</div>
                        @if (!empty($item['excerpt']))
                            <p class="mt-2 line-clamp-2 text-sm leading-6 text-soft">{{ $item['excerpt'] }}</p>
                        @endif
                    </div>
                    @if (!empty($item['date']))
                        <span class="shrink-0 text-xs text-soft">{{ $item['date'] }}</span>
                    @endif
                </a>
            @endforeach
        </div>
    </section>
@endif