@php
    $vurl = $d['video_url'] ?? '';
    $embed = '';
    if (preg_match('/youtube\.com\/watch\?v=([a-zA-Z0-9_-]+)/', $vurl, $m)) {
        $embed = 'https://www.youtube.com/embed/'.$m[1];
    } elseif (preg_match('/youtu\.be\/([a-zA-Z0-9_-]+)/', $vurl, $m)) {
        $embed = 'https://www.youtube.com/embed/'.$m[1];
    } elseif (preg_match('/vimeo\.com\/(\d+)/', $vurl, $m)) {
        $embed = 'https://player.vimeo.com/video/'.$m[1];
    }
@endphp
<section class="w-full py-24" style="background-color: {{ trim($d['bg_color'] ?? '') ?: '#0f172a' }}">
    <div class="max-w-4xl mx-auto px-6">
        @if(!empty($d['title']))
            <h2 class="text-2xl md:text-3xl font-bold text-white mb-8 text-center">{{ $d['title'] }}</h2>
        @endif
        @if($embed)
            <div class="aspect-video rounded-2xl overflow-hidden bg-slate-900">
                <iframe src="{{ $embed }}" class="w-full h-full" allowfullscreen></iframe>
            </div>
        @endif
        @if(!empty($d['caption']))
            <div class="text-white/80 text-center mt-4 prose prose-invert prose-sm max-w-none mx-auto">{!! \App\Support\SafeHtml::richText($d['caption']) !!}</div>
        @endif
    </div>
</section>
