* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f5;
    color: #1a1a2e;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    /* No background - gray (body) shows through, framing content to copyright (matches Lectionary) */
}

header {
    text-align: center;
    margin-bottom: 1.25rem;
    padding-top: 20px;
}

.logo-link {
    text-decoration: none;
    color: inherit;
    display: inline-block;
}
.logo-link:hover {
    opacity: 0.85;
}

.logo-link:focus-visible,
.generate-btn:focus-visible,
.action-btn:focus-visible,
.about-toggle:focus-visible {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
}
.logo svg {
    height: 44px;
    margin-bottom: 1rem;
}

header h1 {
    font-size: 2.2em;
    font-weight: bold;
    color: #1a1a1a;
    margin-bottom: 12px;
    margin-top: 0;
}

.subtitle {
    font-size: 1.15em;
    color: #555;
}

.input-section {
    /* No white card - gray flows through (matches Lectionary) */
    padding: 0 0 20px;
    margin-bottom: 0;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.9em;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#topic-input {
    width: 100%;
    padding: 12px 15px;
    font-size: 1em;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    background: #ffffff;
    color: #333;
    transition: border-color 0.3s;
}

#topic-input:focus {
    outline: none;
    border-color: #9333ea;
}

#topic-input:disabled {
    background: #f5f5f5;
    color: #888;
    cursor: not-allowed;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95em;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    text-transform: none;
    letter-spacing: normal;
}

.checkbox-label input {
    width: 18px;
    height: 18px;
}

.form-submit {
    display: flex;
    justify-content: center;
}

.form-submit .generate-btn {
    width: auto;
}

.generate-btn {
    padding: 0.875rem 1.5rem;
    font-size: 0.95rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 500;
    color: white !important;
    background-color: #7c3aed;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.generate-btn:hover {
    background-color: #6d28d9;
}

.generate-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.loading-section {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1.1em;
    min-height: 100px;
}

.loading-section p {
    margin: 0;
    animation: fadeIn 0.5s ease-in, pulse 2s ease-in-out 0.5s infinite;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

.output-section {
    margin-bottom: 40px;
}

/* Artwork section (curated images) */
.artwork-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e5e5e5;
}

.artwork-heading {
    font-size: 1em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #333;
    margin-bottom: 12px;
}

.artwork-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 12px;
}

.artwork-card {
    display: block;
    text-decoration: none;
    color: inherit;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    transition: box-shadow 0.2s;
}

.artwork-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.artwork-thumb {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.artwork-info {
    padding: 8px 10px;
    font-size: 0.85em;
}

.artwork-info strong {
    display: block;
    font-weight: 600;
    color: #1a1a2e;
}

.artwork-artist {
    display: block;
    font-size: 0.8em;
    color: #6b7280;
    margin-top: 2px;
}

.btn-regen {
    padding: 6px 12px;
    font-size: 0.85em;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    color: #555;
}

.btn-regen:hover:not(:disabled) {
    background: #eee;
    color: #333;
}

.btn-regen:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.handout-content {
    background-color: #ffffff;
    padding: 0;
    margin-bottom: 30px;
}

.content-box {
    background-color: #ffffff;
    color: #1a1a1a;
    padding: 0;
    margin-bottom: 30px;
    line-height: 1.5;
}

.content-box h2 {
    font-size: 1.6em;
    margin-bottom: 15px;
    margin-top: 0;
    color: #1a1a1a;
    font-weight: bold;
    text-align: center;
}

.content-box h3 {
    font-size: 1.2em;
    margin-top: 20px;
    margin-bottom: 10px;
    color: #1a1a1a;
    font-weight: bold;
}

/* First section heading should have less top margin */
.content-box h3.section-heading:first-of-type {
    margin-top: 15px;
}

.content-box p {
    margin-bottom: 12px;
    color: #1a1a1a;
    line-height: 1.5;
}

.content-box strong {
    font-weight: bold;
    color: #1a1a1a;
}

.content-box .section-heading {
    font-weight: bold;
    font-size: 1.1em;
    margin-top: 25px;
    margin-bottom: 10px;
    color: #1a1a1a;
}

.content-box .context-note {
    font-style: normal;
    color: #333;
    margin-bottom: 12px;
    line-height: 1.5;
}

.content-box .scripture-text {
    margin-bottom: 18px;
    color: #1a1a1a;
    line-height: 1.5;
    font-size: 1em;
}

/* Passage Reflection with purple bar */
.content-box .question {
    margin-top: 15px;
    margin-bottom: 18px;
    margin-left: 0;
    padding-left: 12px;
    border-left: 3px solid #9333ea;
    color: #1a1a1a;
    font-style: italic;
    line-height: 1.5;
}

.content-box .question strong {
    color: #1a1a1a;
    font-weight: bold;
    font-style: normal;
}

.content-box .reflection-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.content-box .reflection-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

.content-box .reflection-section .question {
    margin-left: 0;
    padding-left: 12px;
    border-left: 3px solid #9333ea;
    font-style: italic;
}

.content-box .closing-line {
    text-align: center;
    font-style: italic;
    margin-top: 25px;
    margin-bottom: 15px;
    color: #666;
    font-size: 0.95em;
}

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    align-items: stretch;
}

.action-btn {
    flex: 1 1 160px;
    min-width: 140px;
    max-width: 220px;
    min-height: 44px;
    padding: 10px 20px;
    font-size: 0.9em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background-color: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.action-btn:hover {
    background-color: #e8e8e8;
}

.action-btn.save-db-btn {
    background-color: #7c3aed;
    color: white;
    border-color: #7c3aed;
}

.action-btn.save-db-btn:hover {
    background-color: #6d28d9;
    border-color: #6d28d9;
}

.action-btn.save-db-btn:disabled {
    background-color: #a78bfa;
    border-color: #a78bfa;
    cursor: not-allowed;
}

/* About Section - gray block for subdued look (matches Lectionary) */
.about-section {
    margin-top: 2rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
    background-color: #f5f5f5;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    border: 1px solid #e5e5e5;
}

.about-toggle {
    background: none;
    border: none;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    padding: 0.5rem 0;
    letter-spacing: 0.03em;
    transition: color 0.2s ease;
}

.about-toggle:hover {
    color: #4a4a68;
}

.about-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease;
    opacity: 0;
}

.about-section.open .about-toggle {
    color: #4a4a68;
}

.about-section.open .about-content {
    max-height: 400px;
    opacity: 1;
}

.about-content p {
    font-size: 0.95rem;
    color: #4a4a68;
    line-height: 1.7;
    margin-bottom: 0.75rem;
}

.about-content p:last-child {
    margin-bottom: 0;
}

.about-content a {
    color: #7c3aed;
    text-decoration: none;
    font-weight: 500;
}

.about-content a:hover {
    text-decoration: underline;
}

/* Attribution / Footer */
footer.attribution,
.attribution {
    text-align: center;
    padding: 3rem 20px 20px;
    color: #6b7280;
    font-size: 0.75rem;
    line-height: 1.6;
}

footer p {
    margin: 0;
}

footer p {
    margin: 0;
}

/* Print styles */
@media print {
    body {
        background: white;
        padding: 0;
    }
    
    .input-section,
    .action-buttons,
    footer {
        display: none;
    }
    
    .content-box {
        background: white;
        color: #1a1a1a;
        padding: 0;
        box-shadow: none;
    }
    
    .content-box h2,
    .content-box h3,
    .content-box strong,
    .content-box .question {
        color: #1a1a1a;
    }
    
    .content-box p,
    .content-box .scripture-text {
        color: #1a1a1a;
    }
    
    .content-box .question {
        border-left: 3px solid #9333ea;
    }
}

@media (max-width: 640px) {
    .action-buttons {
        flex-direction: column;
    }
    .action-btn {
        width: 100%;
        max-width: none;
    }
}

/* Compact layout when embedded in admin modal (?admin=true) */
body.embed {
    min-height: auto;
}
body.embed .container {
    padding: 1rem 1.25rem;
}
body.embed header {
    padding-top: 0;
    margin-bottom: 0.75rem;
}
body.embed .logo svg {
    height: 28px;
    margin-bottom: 0.5rem;
}
body.embed header h1 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}
body.embed .subtitle {
    font-size: 0.875rem;
    margin-bottom: 0;
}
body.embed .input-section {
    padding: 0 0 0.75rem;
}
body.embed .form-group {
    margin-bottom: 12px;
}
body.embed .about-section {
    margin-top: 0.75rem;
}
body.embed footer.attribution {
    margin-top: 1rem;
    padding-top: 1rem;
    font-size: 0.7rem;
}
