{{--
    ContentLayout — minimal hero for tags directory, blog, static pages, legal.
    Used by /tags, /blog/*, /pages/*, /about, /help, /legal/*

    Expected variables:
      $page_title, $page_meta_description, $page_canonical, $page_robots
      $breadcrumbs (collection, optional)
      Content via @yield('page-content')
--}}
@extends('layouts.nova')

@push('head')
    @isset($page_canonical)
        <link rel="canonical" href="{{ $page_canonical }}" />
    @endisset
    <meta name="robots" content="{{ $page_robots ?? 'index,follow' }}">
    <meta property="og:type"        content="website" />
    <meta property="og:url"         content="{{ $page_canonical ?? url()->current() }}" />
    <meta property="og:title"       content="{{ $page_title ?? 'Skinbase' }}" />
    <meta property="og:description" content="{{ $page_meta_description ?? '' }}" />
    <meta property="og:site_name"   content="Skinbase" />

    {{-- Breadcrumb structured data --}}
    @if(isset($breadcrumbs) && $breadcrumbs->isNotEmpty())
    <script type="application/ld+json">
    {!! json_encode([
        '@context' => 'https://schema.org',
        '@type'    => 'BreadcrumbList',
        'itemListElement' => $breadcrumbs->values()->map(fn ($crumb, $i) => [
            '@type'    => 'ListItem',
            'position' => $i + 1,
            'name'     => $crumb->name,
            'item'     => url($crumb->url),
        ])->all(),
    ], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) !!}
    </script>
    @endif
@endpush

@section('content')

{{-- Minimal hero --}}
@if(!empty($center_content))
    <x-centered-content :max="$center_max ?? '3xl'" class="pt-10 pb-6" style="padding-top:2.5rem;padding-bottom:1.5rem;">
        @hasSection('page-hero')
            @yield('page-hero')
        @else
            {{-- Breadcrumbs --}}
            @include('components.breadcrumbs', ['breadcrumbs' => $breadcrumbs ?? collect()])

            <div class="mt-4">
                <h1 class="text-3xl font-bold text-white leading-tight">
                    {{ $hero_title ?? $page_title ?? 'Skinbase' }}
                </h1>
                @isset($hero_description)
                <p class="mt-1 text-sm text-white/50 max-w-xl">{{ $hero_description }}</p>
                @endisset
            </div>
        @endif
    </x-centered-content>

    {{-- Page body (centered) --}}
    <x-centered-content :max="$center_max ?? '3xl'" class="pb-16">
        @yield('page-content')
    </x-centered-content>
@else
    <div class="px-6 pt-10 pb-6 md:px-10">
        @hasSection('page-hero')
            @yield('page-hero')
        @else
            {{-- Breadcrumbs --}}
            @include('components.breadcrumbs', ['breadcrumbs' => $breadcrumbs ?? collect()])

            <div class="mt-4">
                <h1 class="text-3xl font-bold text-white leading-tight">
                    {{ $hero_title ?? $page_title ?? 'Skinbase' }}
                </h1>
                @isset($hero_description)
                <p class="mt-1 text-sm text-white/50 max-w-xl">{{ $hero_description }}</p>
                @endisset
            </div>
        @endif
    </div>

    {{-- Page body --}}
    <div class="px-6 pb-16 md:px-10">
        @yield('page-content')
    </div>
@endif

@endsection
