Files
kennethreitzandClaude Fable 5 54daa5c75e Card grid for study guides index; widen story narrative column
study_guides.html: the index was bare paragraphs with sidenotes. Now a
card grid matching /topics — elevated guide cards with title,
description, and a bronze key-verse count, categories as gold-tipped
small-caps headings, and the standard KJVNav grid navigation replacing
the bespoke link-walker.

story_detail.html / story_kids.html: tufte's 55% section column made
the narrative uncomfortably narrow; widen to a full-width column capped
at 46rem (~75 characters per line).

All 976 tests pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 00:05:27 -04:00

520 lines
16 KiB
HTML

{% extends "base.html" %}
{% block title %}{{ story.kids_title }} - Bible Stories for Kids - KJV Study{% endblock %}
{% block description %}{{ story.kids_description }}{% endblock %}
{% block og_type %}article{% endblock %}
{% block og_title %}{{ story.kids_title }} - Bible Story for Kids{% endblock %}
{% block og_description %}{{ story.kids_description }}{% endblock %}
{% block head %}
<style>
/* Narrative column — wider than tufte's 55% default */
section > p {
width: 100%;
max-width: 46rem;
}
.kids-header {
position: relative;
background: linear-gradient(135deg, var(--gold-soft) 0%, var(--bg-elevated) 55%, var(--accent-softer) 100%);
border: 1px solid var(--border-color-dark);
padding: 2.5rem;
border-radius: 16px;
margin-bottom: 2rem;
text-align: center;
box-shadow: var(--shadow-soft);
}
.kids-header .category-link {
display: inline-block;
font-size: 0.72rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.18em;
color: var(--bronze) !important;
text-decoration: none;
border: 1px solid var(--border-color-dark);
background: var(--bg-elevated);
padding: 0.3rem 0.9rem;
border-radius: 999px;
margin-bottom: 0.75rem;
}
.kids-header h1 {
color: var(--accent-strong) !important;
margin: 0.5rem 0;
font-size: 2.5rem;
}
.kids-header .subtitle {
color: var(--bronze);
font-style: italic;
font-size: 1.1rem;
margin: 0;
}
.story-actions {
display: flex;
justify-content: center;
gap: 0.75rem;
margin-top: 1rem;
}
.action-btn {
display: inline-flex;
align-items: center;
gap: 0.4rem;
padding: 0.5rem 1.1rem;
font-size: 0.85rem;
border: 1px solid var(--border-color-dark);
border-radius: 999px;
background: var(--bg-elevated);
color: var(--text-secondary);
cursor: pointer;
transition: all 0.2s;
text-decoration: none;
}
.action-btn:hover {
background: var(--accent-softer);
border-color: var(--accent);
color: var(--accent-strong);
}
.action-btn svg {
width: 16px;
height: 16px;
}
.action-btn.playing {
background: var(--accent-fill);
color: var(--on-accent);
border-color: var(--accent-fill);
}
.kids-meta {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 1rem;
margin: 1.5rem 0 2rem;
}
.kids-meta-item {
background: var(--bg-elevated);
border: 1px solid var(--border-color-dark);
border-radius: 12px;
padding: 1rem 1.5rem;
text-align: center;
min-width: 140px;
}
.kids-meta-item .label {
font-size: 0.66rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.16em;
color: var(--bronze);
margin-bottom: 0.25rem;
}
.kids-meta-item .value {
font-size: 0.95rem;
color: var(--text-color);
}
.kids-meta-item .value a {
color: var(--accent-strong);
text-decoration: none;
}
.kids-meta-item .value a:hover {
text-decoration: underline;
}
.characters-row {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 0.5rem;
margin: 1rem 0;
}
.character-badge {
display: inline-flex;
align-items: center;
gap: 0.4rem;
background: var(--gold-soft);
border: 1px solid var(--border-color-dark);
padding: 0.4rem 0.9rem;
border-radius: 999px;
font-size: 0.9rem;
color: var(--bronze);
}
.character-badge::before {
content: "\2605";
font-size: 0.7rem;
color: var(--gold);
}
/* Story divider */
hr.story-divider {
border: 0;
height: 0;
text-align: center;
margin: 2rem 0;
}
hr.story-divider::before {
content: "\2042";
font-size: 1.4rem;
letter-spacing: 0.6em;
color: var(--gold);
}
.themes-section {
background: var(--gold-soft);
border: 1px solid var(--border-color-dark);
border-radius: 16px;
padding: 2rem;
margin: 2.5rem 0;
text-align: center;
}
.themes-section h3 {
color: var(--bronze) !important;
font-style: normal;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.16em;
margin: 0 0 1rem 0;
font-size: 0.85rem;
}
.themes-list {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 0.75rem;
list-style: none;
padding: 0;
margin: 0;
}
.themes-list li {
background: var(--bg-elevated);
border: 1px solid var(--border-color-dark);
padding: 0.5rem 1rem;
border-radius: 999px;
font-size: 0.95rem;
color: var(--text-secondary);
}
.adult-callout {
background: var(--bg-elevated);
border: 2px dashed var(--border-color-darker);
border-radius: 12px;
padding: 1.5rem 2rem;
margin: 2rem 0;
text-align: center;
}
.adult-callout p {
margin: 0;
color: var(--text-secondary);
}
.adult-callout a {
color: var(--accent-strong) !important;
font-weight: 600;
text-decoration: none;
}
.adult-callout a:hover {
text-decoration: underline;
}
.kids-nav {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 3rem;
padding-top: 1.5rem;
border-top: 2px dashed var(--border-color-dark);
gap: 1rem;
}
.kids-nav .nav-prev,
.kids-nav .nav-next {
flex: 1;
max-width: 40%;
}
.kids-nav .nav-prev {
text-align: left;
}
.kids-nav .nav-next {
text-align: right;
}
.kids-nav .nav-center {
text-align: center;
}
.kids-nav .nav-label {
display: block;
font-size: 0.68rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.16em;
color: var(--bronze);
margin-bottom: 0.25rem;
}
.kids-nav .nav-link {
font-size: 0.95rem;
color: var(--accent-strong);
text-decoration: none;
}
.kids-nav .nav-link:hover {
text-decoration: underline;
}
.kids-nav .nav-disabled {
font-size: 0.95rem;
color: var(--text-quaternary);
}
/* Dark mode is handled entirely by the shared design tokens in base.html. */
/* Print styles */
@media print {
.kids-header {
background: none;
padding: 0;
text-align: left;
}
.kids-header .category-link,
.kids-meta,
.characters-row,
.themes-section,
.adult-callout,
.story-actions,
.kids-nav {
display: none;
}
.kids-header h1 {
color: #000 !important;
font-size: 1.8rem;
}
.kids-header .subtitle {
color: #666;
}
hr.story-divider {
display: none;
}
section p {
font-size: 11pt;
line-height: 1.6;
color: #000;
}
}
</style>
{% endblock %}
{% block content %}
<article>
<header class="kids-header">
<a href="/stories#{{ story.category_slug }}" class="category-link">{{ story.category_name }}</a>
<h1>{{ story.kids_title }}</h1>
<p class="subtitle">A Bible Story for Kids</p>
</header>
<div class="kids-meta">
<div class="kids-meta-item">
<div class="label">Find it in the Bible</div>
<div class="value">
{% set verse = story.verses[0] %}
{% set ref_parts = verse.split(' ') %}
{% if ref_parts|length >= 2 %}
{% set chapter_verse = ref_parts[-1] %}
{% set book = ' '.join(ref_parts[:-1]) %}
{% if ':' in chapter_verse %}
{% set chapter = chapter_verse.split(':')[0] %}
{% set verse_part = chapter_verse.split(':')[1] %}
{% if '-' in verse_part %}
{# Verse range like "16:23-31" - use anchor syntax #}
<a href="/book/{{ book }}/chapter/{{ chapter }}#verse-{{ verse_part }}">{{ verse }}</a>
{% else %}
{# Single verse like "3:16" #}
<a href="/book/{{ book }}/chapter/{{ chapter }}#verse-{{ verse_part }}">{{ verse }}</a>
{% endif %}
{% elif '-' in chapter_verse %}
{# Chapter range like "1-2" - link to first chapter #}
{% set chapter = chapter_verse.split('-')[0] %}
<a href="/book/{{ book }}/chapter/{{ chapter }}">{{ verse }}</a>
{% else %}
{# Just a chapter number #}
<a href="/book/{{ book }}/chapter/{{ chapter_verse }}">{{ verse }}</a>
{% endif %}
{% else %}
{{ verse }}
{% endif %}
{% if story.verses|length > 1 %}
<span style="color: var(--text-tertiary);"> +{{ story.verses|length - 1 }} more</span>
{% endif %}
</div>
</div>
</div>
<div class="characters-row">
{% for character in story.characters %}
<span class="character-badge">{{ character }}</span>
{% endfor %}
</div>
<hr class="story-divider">
<section>
{% 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 %}
</section>
<aside class="adult-callout">
<p>Want to read the full story with more details?<br/>
Check out the <a href="/stories/{{ story.slug }}">grown-up version</a> of this story!</p>
</aside>
<div class="story-actions">
<button class="action-btn listen-btn" id="story-listen-btn">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.536 8.464a5 5 0 010 7.072m2.828-9.9a9 9 0 010 12.728M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z" />
</svg>
Listen
</button>
<a href="/stories/{{ story.slug }}/kids/pdf" class="action-btn">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
Download PDF
</a>
</div>
</article>
<nav class="kids-nav">
<div class="nav-prev">
{% if prev_story %}
<span class="nav-label">Previous Story</span>
<a href="/stories/{{ prev_story.slug }}/kids" class="nav-link">← {{ prev_story.kids_title or prev_story.title }}</a>
{% else %}
<span class="nav-label">Previous Story</span>
<span class="nav-disabled">← No previous story</span>
{% endif %}
</div>
<div class="nav-center">
<a href="/stories" class="nav-link">All Stories</a>
</div>
<div class="nav-next">
{% if next_story %}
<span class="nav-label">Next Story</span>
<a href="/stories/{{ next_story.slug }}/kids" class="nav-link">{{ next_story.kids_title or next_story.title }} →</a>
{% else %}
<span class="nav-label">Next Story</span>
<span class="nav-disabled">No next story →</span>
{% endif %}
</div>
</nav>
<script>
(function() {
// Listen button handler
var listenBtn = document.getElementById('story-listen-btn');
var isListening = false;
if (listenBtn) {
listenBtn.addEventListener('click', function() {
if (isListening) {
if (window.KJVSpeech) window.KJVSpeech.stop();
listenBtn.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.536 8.464a5 5 0 010 7.072m2.828-9.9a9 9 0 010 12.728M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z" /></svg> Listen';
isListening = false;
return;
}
var paragraphs = document.querySelectorAll('article section p');
var text = Array.from(paragraphs).map(function(p) {
return p.textContent.trim();
}).join(' ');
if (window.KJVSpeech && text) {
window.KJVSpeech.speak(text);
listenBtn.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 10a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z" /></svg> Stop';
isListening = true;
}
});
}
// Collect paragraphs, adult callout, and action buttons for up/down navigation
var elements = Array.from(document.querySelectorAll('article section p, .adult-callout, .story-actions .action-btn'));
// Find the index of the first paragraph (to start selection there)
var firstParagraphIndex = elements.findIndex(function(el) { return el.tagName === 'P'; });
var selectedIndex = -1;
function selectElement(index) {
// Remove previous selection
if (selectedIndex >= 0 && selectedIndex < elements.length) {
elements[selectedIndex].style.outline = '';
elements[selectedIndex].style.outlineOffset = '';
elements[selectedIndex].classList.remove('selected');
}
selectedIndex = Math.max(0, Math.min(index, elements.length - 1));
// Add selection to new element
elements[selectedIndex].style.outline = '2px solid var(--accent)';
elements[selectedIndex].style.outlineOffset = '8px';
elements[selectedIndex].classList.add('selected');
elements[selectedIndex].scrollIntoView({ behavior: 'auto', block: 'center' });
}
document.addEventListener('keydown', function(e) {
if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA') return;
if (KJVNav.sidebarActive) return;
if (e.key === 'ArrowDown' || e.key === 'j') {
e.preventDefault();
if (KJVNav.isSelectionOffScreen(elements, selectedIndex)) {
selectElement(KJVNav.findFirstVisibleIndex(elements));
} else {
// Start at first paragraph, not metadata
selectElement(selectedIndex < 0 ? firstParagraphIndex : selectedIndex + 1);
}
} else if (e.key === 'ArrowUp' || e.key === 'k') {
e.preventDefault();
if (KJVNav.isSelectionOffScreen(elements, selectedIndex)) {
selectElement(KJVNav.findFirstVisibleIndex(elements));
} else if (selectedIndex <= 0) {
selectElement(0);
} else {
selectElement(selectedIndex - 1);
}
} else if (e.key === 'ArrowLeft' || e.key === 'h') {
e.preventDefault();
history.back();
} else if (e.key === 'ArrowRight' || e.key === 'l') {
e.preventDefault();
var nextLink = document.querySelector('.nav-next .nav-link');
if (nextLink) window.location.href = nextLink.href;
} else if (e.key === '[') {
e.preventDefault();
var prevLink = document.querySelector('.nav-prev .nav-link');
if (prevLink) window.location.href = prevLink.href;
} else if (e.key === ']') {
e.preventDefault();
var nextLink = document.querySelector('.nav-next .nav-link');
if (nextLink) window.location.href = nextLink.href;
} else if (e.key === 'Enter' && selectedIndex >= 0) {
e.preventDefault();
var el = elements[selectedIndex];
// Check if the element itself is a link (like PDF button)
if (el.tagName === 'A' && el.href) {
window.location.href = el.href;
} else {
var link = el.querySelector('a');
if (link) window.location.href = link.href;
}
} else if (e.key === 'Escape') {
e.preventDefault();
if (selectedIndex >= 0 && selectedIndex < elements.length) {
elements[selectedIndex].style.outline = '';
elements[selectedIndex].style.outlineOffset = '';
elements[selectedIndex].classList.remove('selected');
}
selectedIndex = -1;
}
});
})();
</script>
{% endblock %}