<?php

use MintyPHP\Buffer;

$defaultTitle = appTitle();
$primaryVars  = appPrimaryCssVars();
$theme        = currentTheme();
$pageTitle    = $defaultTitle;
ob_start();
Buffer::get('title');
$bufferTitle = trim((string) ob_get_clean());
if ($bufferTitle !== '') {
  $pageTitle = $bufferTitle . ' - ' . $defaultTitle;
}

?>
<!DOCTYPE html>
<html data-theme="<?php e($theme); ?>" <?php if ($primaryVars !== ''): ?>style="<?php e($primaryVars); ?>"<?php endif; ?>>

<head>
  <base href="<?php e(localeBase()); ?>">
  <title><?php e($pageTitle); ?></title>
  <meta property="og:site_name" content="<?php e($defaultTitle); ?>">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="icon" type="image/png" sizes="32x32" href="<?php e(appFaviconUrl('favicon-32x32.png')); ?>">
  <link rel="icon" type="image/png" sizes="16x16" href="<?php e(appFaviconUrl('favicon-16x16.png')); ?>">
  <link rel="apple-touch-icon" href="<?php e(appFaviconUrl('apple-touch-icon.png')); ?>">
  <link rel="manifest" href="<?php e(asset('favicon/site.webmanifest')); ?>">
  <?php renderTemplateStyles('page'); ?>
  <?php renderPageStyles(); ?>
</head>

<body>
  <div class="page-layout">
    <header class="page-header">
      <a href="<?php e(lurl('')); ?>" class="app-brand">
        <img src="<?php e(appLogoUrl(128)); ?>" alt="<?php e(appTitle()); ?>">
      </a>
      <nav>
        <ul>
          <li><a href="<?php e(lurl('imprint')); ?>"><?php e(t('Imprint')); ?></a></li>
          <li><a href="<?php e(lurl('privacy')); ?>"><?php e(t('Privacy')); ?></a></li>
          <li><a href="<?php e(lurl('terms')); ?>"><?php e(t('Terms of Service')); ?></a></li>
          <li><a href="<?php e(lurl('login')); ?>"><?php e(t('Login')); ?></a></li>
        </ul>
      </nav>
    </header>
    <main>
      <div class="page-content">
        <?php Buffer::get('html'); ?>
      </div>
    </main>
    <?php require __DIR__ . '/partials/app-footer.phtml'; ?>
  </div>
  <?php require __DIR__ . '/partials/app-toast-stack.phtml'; ?>
</body>

</html>
