@props(['hero'])
{{-- Render Custom HTML if enabled --}}
@if($hero->use_custom_html && $hero->custom_html)
{!! $hero->custom_html !!}
@else
{{-- Render builder-based hero --}}
@php
$isLight = $hero->theme === 'light';
// Use pre-eager-loaded elements to avoid N+1 queries
$elements = $hero->relationLoaded('elements') ? $hero->elements : $hero->elements()->get();
$floatingBadges = $elements->where('type', 'floating_badge');
$featureBullets = $elements->where('type', 'feature_bullet');
$ctaButtons = $elements->where('type', 'cta_button');
$trustIndicators = $elements->where('type', 'trust_indicator');
$imageUrl = $hero->getImageUrl();
$imageFit = $hero->image_fit ?? 'cover';
$imageZoom = $hero->image_zoom ?? 100;
// Dynamic color gradients based on extracted colors
$hasExtractedColors = !empty($hero->extracted_color_primary);
$backgroundStyle = null;
$defaultGradientClass = $isLight
? 'bg-gradient-to-br from-slate-50 via-blue-50 to-indigo-100 dark:from-zinc-900 dark:via-zinc-800 dark:to-zinc-900'
: 'bg-gradient-to-br from-zinc-900 via-zinc-800 to-zinc-900 dark:from-black dark:via-zinc-900 dark:to-black';
if ($hasExtractedColors) {
$colorService = app(\App\Services\ColorExtractionService::class);
$lightGradient = $colorService->generateLightGradient(
$hero->extracted_color_primary,
$hero->extracted_color_secondary
);
$darkGradient = $colorService->generateDarkGradient(
$hero->extracted_color_primary,
$hero->extracted_color_secondary
);
// For light theme heroes, use light gradient in light mode, dark gradient in dark mode
// For dark theme heroes, always use dark gradient
if ($isLight) {
$backgroundStyle = "--hero-light-start: {$lightGradient['start']}; --hero-light-mid: {$lightGradient['mid']}; --hero-light-end: {$lightGradient['end']}; --hero-dark-start: {$darkGradient['start']}; --hero-dark-mid: {$darkGradient['mid']}; --hero-dark-end: {$darkGradient['end']}";
} else {
$backgroundStyle = "--hero-dark-start: {$darkGradient['start']}; --hero-dark-mid: {$darkGradient['mid']}; --hero-dark-end: {$darkGradient['end']}";
}
}
@endphp
{{-- Dynamic Hero Section --}}
@if($isLight)
@endif
@endif {{-- End custom HTML check --}}