{% extends "base.html" %}

{% block title %}Site Statistics - KJV Study{% endblock %}
{% block description %}Comprehensive statistics about KJV Study - Bible data, commentary, cross-references, and study resources{% endblock %}

{% block content %}
<article>
    <h1>KJV Study Statistics</h1>
    <p class="subtitle">Comprehensive metrics about this Bible study resource</p>

    <section>
        <h2>Bible Text</h2>
        <table>
            <tr>
                <td><strong>Total Verses</strong></td>
                <td>{{ "{:,}".format(stats.bible.total_verses) }}</td>
            </tr>
            <tr>
                <td><strong>Total Books</strong></td>
                <td>{{ stats.bible.total_books }} ({{ stats.bible.ot_books }} OT + {{ stats.bible.nt_books }} NT)</td>
            </tr>
            <tr>
                <td><strong>Total Chapters</strong></td>
                <td>{{ "{:,}".format(stats.bible.total_chapters) }}</td>
            </tr>
            <tr>
                <td><strong>Total Words</strong></td>
                <td>{{ "{:,}".format(stats.bible.total_words) }}</td>
            </tr>
            <tr>
                <td><strong>Average Words per Verse</strong></td>
                <td>{{ stats.bible.avg_words_per_verse }}</td>
            </tr>
            <tr>
                <td><strong>Average Verses per Chapter</strong></td>
                <td>{{ stats.bible.avg_verses_per_chapter }}</td>
            </tr>
        </table>
    </section>

    <section>
        <h2>Verse Commentary</h2>
        <p>In-depth theological analysis with Greek/Hebrew word studies
            <br><a href="/about/commentary">→ Browse Commentary Index</a>
        </p>
        <table>
            <tr>
                <td><strong>Commentary Files</strong></td>
                <td>{{ stats.commentary.files }} books</td>
            </tr>
            <tr>
                <td><strong>Verses with Commentary</strong></td>
                <td>{{ "{:,}".format(stats.commentary.verses_covered) }}</td>
            </tr>
            <tr>
                <td><strong>Coverage</strong></td>
                <td>{{ stats.commentary.coverage_percent }}% of Bible</td>
            </tr>
            <tr>
                <td><strong>Total Commentary Words</strong></td>
                <td>{{ "{:,}".format(stats.commentary.total_words) }}</td>
            </tr>
            <tr>
                <td><strong>Average Words per Verse</strong></td>
                <td>{{ "{:,}".format(stats.commentary.avg_words_per_verse|int) }}</td>
            </tr>
        </table>
    </section>

    <section>
        <h2>Cross-References</h2>
        <p>Based on Treasury of Scripture Knowledge (CC-BY)
            <br><a href="/about/cross-references">→ Browse Cross-References Index</a>
        </p>
        <table>
            <tr>
                <td><strong>Files</strong></td>
                <td>{{ stats.cross_references.files }} books</td>
            </tr>
            <tr>
                <td><strong>Verses with Cross-References</strong></td>
                <td>{{ "{:,}".format(stats.cross_references.verses_with_refs) }}</td>
            </tr>
            <tr>
                <td><strong>Coverage</strong></td>
                <td>{{ stats.cross_references.coverage_percent }}% of Bible</td>
            </tr>
            <tr>
                <td><strong>Total Cross-References</strong></td>
                <td>{{ "{:,}".format(stats.cross_references.total_references) }}</td>
            </tr>
            <tr>
                <td><strong>Average per Verse</strong></td>
                <td>{{ stats.cross_references.avg_refs_per_verse }}</td>
            </tr>
        </table>
    </section>

    <section>
        <h2>Red Letter Edition</h2>
        <p>Words of Jesus Christ</p>
        <table>
            <tr>
                <td><strong>Verses</strong></td>
                <td>{{ "{:,}".format(stats.red_letter.total_verses) }}</td>
            </tr>
            <tr>
                <td><strong>Percentage of Bible</strong></td>
                <td>{{ stats.red_letter.percent_of_bible }}%</td>
            </tr>
        </table>
    </section>

    <section>
        <h2>Bible Stories</h2>
        <p>Narrative retellings of Scripture for all ages
            <br><a href="/stories">→ Browse Bible Stories</a>
        </p>
        <table>
            <tr>
                <td><strong>Story Categories</strong></td>
                <td>{{ stats.bible_stories.categories }}</td>
            </tr>
            <tr>
                <td><strong>Total Stories</strong></td>
                <td>{{ stats.bible_stories.total_stories }}</td>
            </tr>
            <tr>
                <td><strong>Kids Versions</strong></td>
                <td>{{ stats.bible_stories.stories_with_kids }}</td>
            </tr>
            <tr>
                <td><strong>Total Words (Adult)</strong></td>
                <td>{{ "{:,}".format(stats.bible_stories.total_words) }}</td>
            </tr>
            <tr>
                <td><strong>Total Words (Kids)</strong></td>
                <td>{{ "{:,}".format(stats.bible_stories.kids_words) }}</td>
            </tr>
            <tr>
                <td><strong>Biblical Characters</strong></td>
                <td>{{ stats.bible_stories.unique_characters }}</td>
            </tr>
            <tr>
                <td><strong>Unique Themes</strong></td>
                <td>{{ stats.bible_stories.unique_themes }}</td>
            </tr>
        </table>
    </section>

    <section>
        <h2>Language Tools</h2>
        <p>Hebrew, Greek, and interlinear resources
            <br><a href="/strongs">→ Browse Strong's Concordance</a>
        </p>
        <table>
            <tr>
                <td><strong>Hebrew Strong's Entries</strong></td>
                <td>{{ "{:,}".format(stats.language_tools.hebrew_entries) }}</td>
            </tr>
            <tr>
                <td><strong>Greek Strong's Entries</strong></td>
                <td>{{ "{:,}".format(stats.language_tools.greek_entries) }}</td>
            </tr>
            <tr>
                <td><strong>Total Strong's Concordance</strong></td>
                <td>{{ "{:,}".format(stats.language_tools.total_strongs) }}</td>
            </tr>
            <tr>
                <td><strong>Interlinear Data Size</strong></td>
                <td>{{ stats.language_tools.interlinear_size_mb }} MB (compressed)</td>
            </tr>
        </table>
    </section>

    <section>
        <h2>Study Resources</h2>
        <p>Topical studies, reading plans, and biblical resources</p>
        <table>
            <tr>
                <td><strong>Study Guides</strong></td>
                <td>{{ stats.study_resources.study_guides }}</td>
            </tr>
            <tr>
                <td><strong>Topics</strong></td>
                <td>{{ stats.study_resources.topics }}</td>
            </tr>
            <tr>
                <td><strong>Resources</strong></td>
                <td>{{ stats.study_resources.resources }}</td>
            </tr>
            <tr>
                <td><strong>Bible Stories</strong></td>
                <td>{{ stats.study_resources.stories }}</td>
            </tr>
            <tr>
                <td><strong>Biographies</strong></td>
                <td>{{ stats.study_resources.biographies }} biblical figures</td>
            </tr>
            <tr>
                <td><strong>Reading Plans</strong></td>
                <td>{{ stats.study_resources.reading_plans }}</td>
            </tr>
        </table>
    </section>

    <section>
        <h2>Technical Data</h2>
        <p>Data files and infrastructure</p>
        <table>
            <tr>
                <td><strong>Total JSON Files</strong></td>
                <td>{{ "{:,}".format(stats.data.total_json_files) }}</td>
            </tr>
            <tr>
                <td><strong>Total Data Size</strong></td>
                <td>{{ stats.data.total_size_mb }} MB</td>
            </tr>
            <tr>
                <td><strong>Book Abbreviations</strong></td>
                <td>{{ stats.data.book_abbreviations }}</td>
            </tr>
        </table>
    </section>

    <section>
        <h2>Summary</h2>
        <p>KJV Study contains:</p>
        <ul>
            <li>{{ "{:,}".format(stats.bible.total_verses) }} verses from the 1769 Cambridge KJV</li>
            <li>{{ "{:,}".format(stats.commentary.verses_covered) }} verses with in-depth commentary ({{ stats.commentary.coverage_percent }}% coverage)</li>
            <li>{{ "{:,}".format(stats.commentary.total_words) }} words of theological analysis</li>
            <li>{{ "{:,}".format(stats.cross_references.total_references) }} cross-references linking related passages</li>
            <li>{{ "{:,}".format(stats.language_tools.total_strongs) }} Strong's Concordance entries for word studies</li>
            <li>{{ stats.bible_stories.total_stories }} Bible stories across {{ stats.bible_stories.categories }} categories</li>
            <li>{{ stats.study_resources.biographies }} biblical biographies</li>
            <li>{{ stats.study_resources.study_guides }} topical study guides</li>
            <li>{{ stats.study_resources.reading_plans }} reading plans</li>
        </ul>
    </section>

</article>

<style>
    .subtitle {
        font-size: 1.2rem;
        color: #666;
        margin-top: -1rem;
        margin-bottom: 2rem;
    }

    table {
        width: 100%;
        border-collapse: collapse;
        margin: 1.5rem 0;
    }

    tr {
        border-bottom: 1px solid var(--border-color);
    }

    td {
        padding: 0.75rem 1rem;
    }

    td:first-child {
        width: 60%;
    }

    td:last-child {
        text-align: right;
        font-family: 'Consolas', 'Monaco', monospace;
        color: var(--text-secondary);
    }

    section {
        margin: 3rem 0;
    }

    section p {
        color: var(--text-secondary);
        font-style: italic;
        margin-bottom: 0.5rem;
    }

    code {
        background: var(--code-bg);
        padding: 0.2rem 0.4rem;
        border-radius: 3px;
        font-size: 0.9em;
    }
</style>
{% endblock %}
