<?php
// public/partials/layout_start.php

// Erwartet (vor require):
// - $lang (de|en|it|fr) – bereits validiert
// - $pageTitle (string)
// - $pageDescription (string, optional)
// - $userInitials (optional, kann null sein)

// Fallbacks:
if (!isset($lang) || !in_array($lang, ['de', 'en', 'it', 'fr'], true)) {
    $lang = 'en';
}

if (!isset($pageTitle) || !is_string($pageTitle) || $pageTitle === '') {
    $pageTitle = 'usbcheck.it';
}

if (!isset($pageDescription) || !is_string($pageDescription)) {
    $pageDescription = '';
}

// Kann später genutzt werden, falls du host-spezifische Sachen brauchst
$host = $_SERVER['HTTP_HOST'] ?? '';
?>
<!DOCTYPE html>
<html lang="<?= htmlspecialchars($lang) ?>">
<head>
    <meta charset="UTF-8">
    <title><?= htmlspecialchars($pageTitle) ?></title>
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <?php if ($pageDescription !== ''): ?>
        <meta name="description" content="<?= htmlspecialchars($pageDescription) ?>">
    <?php endif; ?>

    <!-- Fonts -->
    <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=Inter:wght@300;400;500;600&family=Montserrat:wght@600;700;800&display=swap" rel="stylesheet">

    <!-- Tailwind (Dev) -->
    <script src="https://cdn.tailwindcss.com"></script>

    <!-- Eigenes CSS -->
    <link rel="stylesheet" href="/assets/css/main.css">
</head>

<body class="bg-brand-bg text-brand-text font-sans antialiased scroll-smooth">
<div class="min-h-screen flex flex-col">

    <!-- HEADER -->
    <?php include __DIR__ . '/header.php'; ?>

    <!-- MAIN CONTENT -->
    <main class="flex-1">
