<?php
require_once __DIR__ . '/functions.php';
$meta = $meta ?? pageMeta();
$branchesForNav = getBranches();
?>
<!doctype html>
<html lang="tr">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title><?= e($meta['title']) ?></title>
    <meta name="description" content="<?= e($meta['description']) ?>">
    <meta name="keywords" content="<?= e($meta['keywords']) ?>">
    <link rel="canonical" href="<?= e($meta['canonical']) ?>">
    <meta property="og:title" content="<?= e($meta['title']) ?>">
    <meta property="og:description" content="<?= e($meta['description']) ?>">
    <meta property="og:image" content="<?= e($meta['image']) ?>">
    <meta property="og:type" content="website">
    <meta property="og:url" content="<?= e($meta['canonical']) ?>">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@600;700&family=Manrope:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@600;700;800&display=swap" rel="stylesheet">
    <link rel="preload" href="<?= e(url('assets/css/style.css')) ?>" as="style">
    <link rel="stylesheet" href="<?= e(url('assets/css/style.css')) ?>">
    <link rel="stylesheet" href="<?= e(url('assets/css/responsive.css')) ?>">
    <?= localBusinessSchema($schemaBranch ?? null) ?>
</head>
<body>
<header class="site-header" data-header>
    <a class="brand brand-with-logo" href="<?= e(url()) ?>" aria-label="Ataköy Su Sporları ana sayfa">
        <img class="brand-logo" src="<?= e(url('assets/img/atakoy-su-sporlari-logo-cropped.png')) ?>" alt="Ataköy Su Sporları">
    </a>
    <button class="nav-toggle" type="button" aria-label="Menüyü aç" aria-expanded="false"><span></span><span></span><span></span></button>
    <nav class="site-nav" aria-label="Ana menu">
        <a href="<?= e(url()) ?>">Ana Sayfa</a>
        <a href="<?= e(url('subeler')) ?>">Şubeler</a>
        <a href="<?= e(url('hizmetler')) ?>">Hizmetler</a>
        <a href="<?= e(url('blog')) ?>">Blog</a>
        <a href="<?= e(url('iletisim')) ?>">İletişim</a>
        <div class="nav-dropdown">
            <button type="button">Şube Seç</button>
            <div>
                <?php foreach ($branchesForNav as $branch): ?>
                    <a href="<?= e(branchUrl($branch['slug'])) ?>"><?= e($branch['name']) ?></a>
                <?php endforeach; ?>
            </div>
        </div>
    </nav>
    <div class="header-actions">
        <a class="btn btn-ghost" href="<?= e(CONTACT_WHATSAPP) ?>">WhatsApp</a>
        <a class="btn btn-primary" href="tel:<?= e(CONTACT_TEL) ?>">Hemen Ara</a>
    </div>
</header>
<main>
<?php if (!empty($_SESSION['flash'])): ?>
    <div class="flash"><?= e($_SESSION['flash']); unset($_SESSION['flash']); ?></div>
<?php endif; ?>
