<?php

declare(strict_types=1);

/** @var bool $blogCanManage */
/** @var bool $compose */
/** @var bool $editMode */

require_once dirname(__DIR__, 3) . '/includes/fate_rich_editor.php';

$blogNeedEditor = !empty($blogCanManage) && (!empty($compose) || !empty($editMode));
if ($blogNeedEditor) {
    fate_rich_editor_use();
}

$blogCssFs = dirname(__DIR__, 3) . '/static/fate-blog.css';
$blogCssVer = is_file($blogCssFs) ? (string) filemtime($blogCssFs) : '1';

if ($blogNeedEditor) {
    fate_rich_editor_head_assets();
}
?>
<link rel="stylesheet" href="./static/fate-blog.css?v=<?= htmlspecialchars($blogCssVer, ENT_QUOTES, 'UTF-8') ?>">
<style>
    /* BLOG 頁：確保與 navbar / footer 間距（主欄間距由 .layout padding-top 提供） */
    body.fate-body--blog > .layout-shell.layout-shell--blog {
        margin-top: 0.75rem !important;
        margin-bottom: 2rem !important;
        padding-top: 0 !important;
        padding-bottom: 0.75rem !important;
    }
    body.fate-body--blog .fate-site-footer {
        margin-top: 1rem !important;
        padding-top: 1.15rem !important;
    }
    html.fate-theme-minimal body.fate-body--blog .minimal-page--blog {
        padding-top: 0.85rem !important;
    }
    html.fate-theme-dci body.fate-body--blog > .layout-shell.layout-shell--blog,
    body.fate-theme-dci.fate-body--blog > .layout-shell.layout-shell--blog {
        margin-top: 0.65rem !important;
        margin-bottom: 1.5rem !important;
        padding-top: 0 !important;
    }
</style>
