<?php
declare(strict_types=1);

function amp_start(array $seo): void
{
    $defaults = site_default_settings();
    $seo['title'] = trim((string) ($seo['title'] ?? '')) ?: (string) setting('site_title', $defaults['site_title']);
    $seo['description'] = trim((string) ($seo['description'] ?? '')) ?: (string) setting('meta_description', $defaults['meta_description']);
    $seo['image'] = trim((string) ($seo['image'] ?? '')) ?: url((string) setting('og_image', $defaults['og_image']));
    $schema = json_encode(seo_graph($seo), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP);
    $primary = (string) setting('primary_color', '#17352f');
    $surface = (string) setting('surface_color', '#f3efe7');
    $brand = (string) setting('brand_name', 'Nekrut Wellness & Spa');
    $logo = url((string) setting('logo_light', '/assets/img/logo-light.svg'));

    echo '<!doctype html><html amp lang="tr"><head><meta charset="utf-8"><script async src="https://cdn.ampproject.org/v0.js"></script><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"><title>' . e($seo['title']) . '</title><meta name="description" content="' . e($seo['description']) . '"><meta name="robots" content="' . e($seo['robots']) . '"><link rel="canonical" href="' . e($seo['canonical']) . '"><meta property="og:title" content="' . e($seo['title']) . '"><meta property="og:description" content="' . e($seo['description']) . '"><meta property="og:image" content="' . e($seo['image']) . '"><style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript><style amp-custom>*{box-sizing:border-box}body{margin:0;color:' . e($primary) . ';font:16px/1.65 system-ui;background:#fff}a{text-decoration:none;color:inherit}.c{width:min(1120px,calc(100% - 32px));margin:auto}header{background:' . e($primary) . ';color:#fff;padding:18px 0}header .c{display:flex;align-items:center;justify-content:space-between}header a{font-weight:700}header amp-img{width:210px;height:50px}.hero{padding:90px 0;background:' . e($surface) . '}.hero h1{font:500 clamp(3rem,8vw,6rem)/1.05 Georgia;margin:0 0 20px}.hero p{max-width:760px;font-size:1.15rem}.section{padding:70px 0}.grid{display:grid;grid-template-columns:repeat(3,1fr);gap:20px}.card{border:1px solid #d9dedb;background:#fff}.card .pad{padding:22px}.card h2,.card h3{font:500 1.7rem Georgia;margin:0 0 10px}.card p{color:#61716c}.btn{display:inline-flex;padding:13px 20px;background:' . e($primary) . ';color:#fff;border-radius:999px;font-weight:800}.prose{max-width:800px}.prose h2{font:500 2.1rem Georgia;margin-top:42px}.prose img{max-width:100%}footer{padding:45px 0;background:#102c27;color:#fff;margin-top:60px}footer p{color:#ffffffa8}.meta{color:#8b744e;font-weight:700}.booking{margin-top:35px;padding:25px;background:' . e($surface) . '}@media(max-width:760px){.grid{grid-template-columns:1fr}.hero{padding:60px 0}header .c{gap:15px}header amp-img{width:160px}}</style><script type="application/ld+json">' . $schema . '</script></head><body><header><div class="c"><a href="' . url('/') . '" aria-label="' . e($brand) . '"><amp-img src="' . e($logo) . '" width="210" height="50" layout="fixed" alt="' . e($brand) . '"></amp-img></a><a href="' . url('/rezervasyon') . '">Rezervasyon</a></div></header><main>';
}

function amp_end(): void
{
    echo '</main><footer><div class="c"><strong>' . e((string) setting('brand_name', 'Nekrut Wellness & Spa')) . '</strong><p>' . e((string) setting('footer_text', site_default_settings()['footer_text'])) . '</p></div></footer></body></html>';
}
