<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{{ story.title }} - KJV Study</title>
    <style>
        @page {
            size: letter;
            margin: 1in;
            @bottom-center {
                content: counter(page);
                font-family: "et-book", Georgia, serif;
                font-size: 10pt;
                color: #666;
            }
        }

        body {
            font-family: "et-book", Georgia, "Times New Roman", serif;
            font-size: 12pt;
            line-height: 1.6;
            color: #111;
            max-width: 100%;
        }

        h1 {
            font-size: 24pt;
            margin: 0 0 0.25in 0;
            color: #111;
            font-weight: normal;
        }

        .subtitle {
            font-style: italic;
            font-size: 11pt;
            color: #555;
            margin-bottom: 0.3in;
        }

        .scripture {
            font-size: 10pt;
            color: #666;
            margin-bottom: 0.15in;
        }

        .meta {
            font-size: 10pt;
            color: #666;
            margin-bottom: 0.4in;
            border-bottom: 1px solid #ddd;
            padding-bottom: 0.2in;
        }

        .meta-label {
            font-variant: small-caps;
            letter-spacing: 0.05em;
        }

        .divider {
            text-align: center;
            margin: 0.3in 0;
            color: #888;
            letter-spacing: 0.3em;
        }

        .narrative p {
            text-align: justify;
            text-indent: 0.25in;
            margin: 0 0 0.15in 0;
        }

        .narrative p:first-of-type {
            text-indent: 0;
        }

        .newthought {
            font-variant: small-caps;
            font-size: 1.1em;
            letter-spacing: 0.05em;
        }

        .footer {
            margin-top: 0.5in;
            padding-top: 0.2in;
            border-top: 1px solid #ddd;
            font-size: 9pt;
            color: #888;
            text-align: center;
        }

        /* Style sidenotes as inline notes for PDF */
        .margin-toggle,
        .sidenote-number,
        input[type="checkbox"] {
            display: none !important;
        }

        .sidenote,
        .marginnote {
            display: block;
            float: none;
            width: 100%;
            margin: 0.15in 0;
            padding: 0.1in 0.15in;
            font-size: 9pt;
            font-style: italic;
            color: #555;
            background: #f9f9f9;
            border-left: 2px solid #ccc;
        }

        .sidenote::before {
            content: "Note: ";
            font-weight: 600;
            font-style: normal;
        }
    </style>
</head>
<body>
    <h1>{{ story.title }}</h1>
    <p class="subtitle">{{ story.description }}</p>

    <p class="scripture">
        {% for verse in story.verses %}{{ verse }}{% if not loop.last %} &bull; {% endif %}{% endfor %}
    </p>

    <p class="meta">
        <span class="meta-label">Characters:</span> {{ story.characters | join(', ') }}<br>
        <span class="meta-label">Themes:</span> {{ story.themes | join(', ') }}
    </p>

    <div class="narrative">
        {% for paragraph in story.narrative.split('\n\n') %}
        {% if loop.first %}
        <p><span class="newthought">{{ paragraph.split(' ')[:3] | join(' ') }}</span> {{ paragraph.split(' ')[3:] | join(' ') }}</p>
        {% else %}
        <p>{{ paragraph }}</p>
        {% endif %}
        {% endfor %}
    </div>

    <div class="footer">
        From KJV Study &bull; kjvstudy.org
    </div>
</body>
</html>
