<?php
declare(strict_types=1);
require_once __DIR__ . '/includes/bootstrap.php';

$pageTitle = $pageTitle ?? SITE_NAME;
$activeNav = $activeNav ?? basename($_SERVER['SCRIPT_NAME']);
$menu = [
    'index.php' => 'Головна',
    'services.php' => 'Послуги',
    'projects.php' => 'Проєкти',
    'process.php' => 'Процес',
    'pricing.php' => 'Ціни',
    'about-us.php' => 'Про нас',
    'contacts.php' => 'Контакти',
];

echo '<!doctype html>';
echo '<html lang="uk"><head>';
echo '<meta charset="UTF-8">';
echo '<meta name="viewport" content="width=device-width, initial-scale=1.0">';
echo '<title>' . e($pageTitle) . '</title>';
echo '<meta name="description" content="Nestor Web Studio — преміальні сайти для фотографів, експертів і малого бізнесу.">';
echo '<link rel="preconnect" href="https://fonts.googleapis.com">';
echo '<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>';
echo '<link href="https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;1,400&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap" rel="stylesheet">';
echo '<link rel="stylesheet" href="' . e(nestor_asset_url('assets/css/style.css')) . '">';
echo '</head><body class="site-body">';
echo '<a class="skip-link" href="#main-content">До основного вмісту</a>';

echo '<header class="site-header" id="site-header">';
echo '<div class="site-header__inner">';
echo '<a class="logo" href="' . e(nestor_url('index.php')) . '" aria-label="' . e(SITE_NAME) . ' — головна">';
echo '<span class="logo__main">NESTOR</span>';
echo '<span class="logo__sub">web studio</span>';
echo '</a>';
echo '<div class="site-header__actions">';
echo '<a class="header-cta" href="https://t.me/nestor_webstudio" target="_blank" rel="noopener noreferrer">Написати</a>';
echo '<button type="button" class="burger" id="menu-toggle" aria-expanded="false" aria-controls="fullscreen-nav" aria-label="Відкрити меню">';
echo '<span class="burger__line"></span><span class="burger__line"></span><span class="burger__line"></span>';
echo '</button>';
echo '</div>';
echo '</div>';
echo '</header>';

echo '<div class="nav-overlay" id="fullscreen-nav" aria-hidden="true">';
echo '<div class="nav-overlay__panel">';
echo '<div class="nav-overlay__top">';
echo '<button type="button" class="nav-overlay__close" id="menu-close" aria-label="Закрити меню"><span class="nav-overlay__close-icon" aria-hidden="true"></span></button>';
echo '</div>';
echo '<nav class="nav-overlay__nav" aria-label="Головне меню">';
$i = 0;
foreach ($menu as $file => $label) {
    $isActive = ($activeNav === $file);
    $cls = 'nav-overlay__link' . ($isActive ? ' is-active' : '');
    echo '<a class="' . e($cls) . '" href="' . e(nestor_url($file)) . '" style="--i:' . $i . '" data-nav-link>' . e($label) . '</a>';
    $i++;
}
echo '</nav>';
echo '<div class="nav-overlay__bottom">';
echo '<div class="nav-overlay__social">';
echo '<a href="https://t.me/nestor_webstudio" target="_blank" rel="noopener noreferrer">Telegram</a>';
echo '<a href="https://instagram.com/nestor.webstudio" target="_blank" rel="noopener noreferrer">Instagram</a>';
echo '<a href="mailto:nestor.webstudio@gmail.com">Gmail</a>';
echo '</div>';
echo '<p class="nav-overlay__tagline"><span>Nestor Web Studio</span><span>Сучасні сайти для бізнесу</span></p>';
echo '</div>';
echo '</div>';
echo '</div>';
