<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{{ story.kids_title }} - Bible Story for Kids - 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: 14pt;
            line-height: 1.8;
            color: #111;
            max-width: 100%;
        }

        h1 {
            font-size: 26pt;
            margin: 0 0 0.15in 0;
            color: #4338ca;
            font-weight: normal;
        }

        .subtitle {
            font-size: 12pt;
            color: #6366f1;
            margin-bottom: 0.25in;
        }

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

        .characters {
            font-size: 11pt;
            color: #3730a3;
            margin-bottom: 0.3in;
        }

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

        .narrative p {
            text-align: left;
            margin: 0 0 0.2in 0;
        }

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

        .themes {
            margin-top: 0.4in;
            padding: 0.25in;
            background: #fef3c7;
            border-radius: 8px;
        }

        .themes h3 {
            font-size: 14pt;
            color: #92400e;
            margin: 0 0 0.15in 0;
        }

        .themes ul {
            margin: 0;
            padding-left: 0.3in;
        }

        .themes li {
            color: #78350f;
            margin-bottom: 0.1in;
        }

        .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.kids_title }}</h1>
    <p class="subtitle">A Bible Story for Kids</p>

    <p class="scripture">
        Find it in the Bible: {% for verse in story.verses %}{{ verse }}{% if not loop.last %}, {% endif %}{% endfor %}
    </p>

    <p class="characters">
        Characters: {{ story.characters | join(', ') }}
    </p>

    <div class="divider">* * *</div>

    <div class="narrative">
        {% for paragraph in story.kids_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>
