@php
    $navPages = $navPages ?? collect();
    $cur = '/' . ltrim(request()->path() === '/' ? '' : request()->path(), '/');
    $opts = (array) ($site->options ?? []);
    $ctaUrl = $opts['cta_url'] ?? '#shop';
@endphp
<header class="st-header" :class="{ 'is-scrolled': scrolled }">
    <div class="st-promo">🐾 Free delivery on orders over $50 — shop today!</div>
    <div class="st-mainbar">
        <div class="vs-container st-mainbar-in">
            <a href="/" class="st-logo">
                @if($site->logoUrl())<img src="{{ $site->logoUrl() }}" alt="{{ $site->name }}">
                @else<span class="st-logo-mark"><i class="fas fa-bone"></i></span>@endif
                <span>{{ $site->name ?: 'Pet Store' }}</span>
            </a>
            <div class="st-search">
                <i class="fas fa-magnifying-glass"></i>
                <input type="text" placeholder="Search for food, toys, accessories…">
            </div>
            <nav class="st-nav">
                @foreach($navPages as $p)
                    @php($href = $p->is_home ? '/' : '/' . $p->slug)
                    <a href="{{ $href }}" class="{{ $cur === $href ? 'is-active' : '' }}">{{ $p->title }}</a>
                @endforeach
            </nav>
            <div class="st-actions">
                <a href="/portal" class="st-icon" aria-label="Account"><i class="fas fa-user"></i></a>
                <a href="{{ $ctaUrl }}" class="st-icon st-cart" aria-label="Cart"><i class="fas fa-cart-shopping"></i><span class="st-cart-count">3</span></a>
            </div>
            <button class="st-burger" @click="menu=true" aria-label="Menu"><i class="fas fa-bars"></i></button>
        </div>
    </div>

    <div class="vs-drawer" :class="{ 'is-open': menu }" x-cloak>
        <div class="vs-drawer-overlay" @click="menu=false"></div>
        <div class="vs-drawer-panel">
            <button class="vs-drawer-close" @click="menu=false"><i class="fas fa-times"></i></button>
            <nav>
                @foreach($navPages as $p)<a href="{{ $p->is_home ? '/' : '/'.$p->slug }}" @click="menu=false">{{ $p->title }}</a>@endforeach
                <a href="/portal" @click="menu=false">My account</a>
                <a href="{{ $ctaUrl }}" @click="menu=false">Cart (3)</a>
            </nav>
        </div>
    </div>
</header>
