<!DOCTYPE html>
<html>
<meta charset="UTF-8">

<head>
    <title>Analysis Narrative</title>

    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/4.6.2/css/bootstrap.min.css" integrity="sha512-rt/SrQ4UNIaGfDyEXZtNcyWvQeOq0QLygHluFQcSjaGB04IxWhal71tKuzP6K8eYXYB6vJV4pHkXcmFGGQ1/0w==" crossorigin="anonymous" referrerpolicy="no-referrer" />

    <style>
        body {
            max-width: 800px;
            margin: 40px auto;
            padding: 20px;
            font-family: 'Georgia', serif;
            line-height: 1.6;
        }
        h1 {
            border-bottom: 2px solid #333;
            padding-bottom: 10px;
            margin-bottom: 30px;
        }
        .narrative-content {
            font-size: 1.1rem;
        }
        .meta-info {
            color: #666;
            font-size: 0.9rem;
            margin-bottom: 30px;
            padding: 15px;
            background-color: #f8f9fa;
            border-left: 4px solid #007bff;
        }
    </style>
</head>

<body>
    <div class="container">
        <h1>Analysis Narrative</h1>

        <div class="meta-info">
            <strong>Pipeline:</strong> {{ pipeline.name }}<br>
            {% if pipeline.default_context.persona %}
            <strong>Persona:</strong> {{ pipeline.default_context.persona }}<br>
            {% endif %}
            {% if pipeline.default_context.research_question and pipeline.default_context.research_question != "None" %}
            <strong>Research Question:</strong> {{ pipeline.default_context.research_question }}<br>
            {% endif %}
        </div>

        <div class="narrative-content">
{% markdown %}
{{ result.narrative }}
{% endmarkdown %}
        </div>
    </div>
</body>
</html>