@php
    $ratio = ['16:9' => 'aspect-video', '4:3' => 'aspect-[4/3]', '1:1' => 'aspect-square', 'auto' => 'min-h-96'][$block->get('ratio', '16:9')] ?? 'aspect-video';
    $src = website_embed_url($block->get('provider'), $block->get('url'));
@endphp
<div class="max-w-5xl mx-auto px-4 sm:px-6 lg:px-8">
    @if ($block->get('title'))
        <h2 class="ec-heading text-2xl font-bold text-center mb-6">{{ $block->get('title') }}</h2>
    @endif
    @if ($src)
        <div class="{{ $ratio }} w-full overflow-hidden rounded-2xl">
            <iframe src="{{ $src }}" class="w-full h-full border-0" loading="lazy" allowfullscreen
                    title="{{ $block->get('title') ?: $block->get('provider') }}"
                    referrerpolicy="strict-origin-when-cross-origin"></iframe>
        </div>
    @else
        <p class="ec-muted text-center">{{ __('رابط التضمين غير صالح') }}</p>
    @endif
</div>
