<?php

function page_top(
    string $title,
    string $active = ''
): void {
?>

    <!doctype html>

    <html lang="en">

    <head>

        <meta charset="utf-8">

        <meta
            name="viewport"
            content="width=device-width,initial-scale=1">

        <title>
            <?= e($title) ?> · <?= APP_NAME ?>
        </title>

        <link
            rel="stylesheet"
            href="assets/style.css">

    </head>

    <body>

        <header class="nav">

            <a
                class="brand"
                href="index.php">

                <span class="brand-mark">CN</span>

                <span>
                    CAOSCE<span class="brand-light"> Network</span>
                </span>

            </a>

            <nav>

                <a
                    class="<?= $active === 'home' ? 'active' : '' ?>"
                    href="index.php">
                    Home
                </a>

                <a
                    class="<?= $active === 'videos' ? 'active' : '' ?>"
                    href="videos.php">
                    AI Procedures
                </a>

                <a href="school_register.php">
                    For Schools
                </a>

                <a href="student_register.php">
                    Students
                </a>

                <a
                    class="nav-admin"
                    href="admin.php">
                    Admin
                </a>

            </nav>

        </header>

        <main>

            <?php

            if ($message = flash()):

            ?>

                <div class="flash">

                    <?= e($message) ?>

                </div>

            <?php endif; ?>

        <?php
    }

    function page_bottom(): void
    {
        ?>

        </main>

        <footer>

            <div>

                <strong>CAOSCE Network</strong>

                <span>
                    Professional CAOSCE examination & learning platform
                </span>

            </div>

            <div>
                © <?= date('Y') ?> CAOSCE Network
            </div>

        </footer>

    </body>

    </html>

<?php
    }
?>