/* ============================================================
   Thoughts & Prayers — "Serene Editorial" design system (v1)
   Tokens first; light in :root, dark via prefers-color-scheme.
   ============================================================ */

:root {
    color-scheme: light dark;

    /* Core */
    --bg: #FAF6EF;
    --surface: #FFFDF8;
    --text: #2C3843;
    --on-accent: #FCFAF6;
    --accent: #3E6B94;
    --accent-strong: #335A80;
    --accent-dark: #335A80; /* legacy alias of --accent-strong */
    --accent-soft: #DCE8F2;
    --accent-text: #274B6B;
    --warm: #C08A5F;
    --warm-soft: #F0E0CE;
    --warm-text: #8F5432;

    /* Content surfaces */
    --verse-surface: #EAF1F7;
    --answered-soft: #E9F1E4;

    /* Neutrals (slate-tinted) */
    --gray-100: #EDF0F3;
    --gray-200: #DEE4E9;
    --gray-300: #C6CFD7;
    --gray-400: #A2AFBB;
    --gray-500: #7C8B98;
    --gray-600: #5A6B79;
    --gray-700: #43525F;
    --gray-900: #253039;
    --gray-950: #1A242C;
    --border: var(--gray-200);
    --text-muted: var(--gray-600);

    /* Semantic */
    --answered: #4E7A46;
    --answered-border: #B9D2B2; /* Success @ ~30% on light */
    --warning: #9A6B23;
    --warning-soft: #F5EBD7;
    --error: #AE4F49;
    --error-soft: #F7E7E5;

    /* Type */
    --font-ui: system-ui, "Segoe UI", -apple-system, "Helvetica Neue", Arial, sans-serif;
    --font-scripture: Charter, "Iowan Old Style", Georgia, Cambria, "Times New Roman", serif;

    /* Shape */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 999px;

    /* Elevation (borders carry it; shadows are rare and neutral) */
    --shadow-hover: 0 1px 3px rgba(26, 36, 44, 0.07);
    --shadow-header: 0 1px 2px rgba(26, 36, 44, 0.06);
    --shadow-overlay: 0 8px 24px rgba(26, 36, 44, 0.14);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14212C;
        --surface: #1C2C3A;
        --text: #EDE7DC;
        --on-accent: #1A242C;
        --accent: #8FB3D4;
        --accent-strong: #A9C6E0;
        --accent-dark: #A9C6E0;
        --accent-soft: #263D52;
        --accent-text: #C9DCEC;
        --warm: #D9A77C;
        --warm-soft: #3B2F25;
        --warm-text: #E3B88F;

        --verse-surface: #1D3245;
        --answered-soft: #223528;

        --gray-100: #223240;
        --gray-200: #2A3B4A;
        --gray-300: #3A4C5C;
        --gray-400: #55697B;
        --gray-500: #7A8C9C;
        --gray-600: #A3B2BF;
        --gray-700: #C4CFD8;
        --gray-900: #DFE5EA;
        --gray-950: #ECF0F3;

        --answered: #93BE88;
        --answered-border: rgba(147, 190, 136, 0.35);
        --warning: #D9B36A;
        --warning-soft: #3A3222;
        --error: #E08B84;
        --error-soft: #3C2523;

        /* Dark mode: shadows off; borders carry elevation */
        --shadow-hover: none;
        --shadow-header: none;
        --shadow-overlay: none;
    }
}

* {
    box-sizing: border-box;
}

/* ============================================================
   Base type — seven styles, two weights (400/600)
   ============================================================ */

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-ui);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.6;
    background: var(--bg);
    color: var(--text);
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1 {
    /* Display */
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.25;
    color: var(--gray-900);
    margin: 0 0 1rem;
}

h2 {
    /* Title */
    font-size: 1.375rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--gray-900);
    margin: 0;
}

h3 {
    /* Section */
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--gray-900);
    margin: 0;
}

.eyebrow {
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0;
}

/* ============================================================
   Layout
   ============================================================ */

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Header shadow only after scroll (progressive enhancement) */
@supports (animation-timeline: scroll()) {
    .site-header {
        animation: header-shadow linear both;
        animation-timeline: scroll();
        animation-range: 0 24px;
    }

    @keyframes header-shadow {
        from { box-shadow: none; }
        to { box-shadow: var(--shadow-header); }
    }
}

.site-nav {
    max-width: 46rem;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.site-nav .brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
}

.brand-emblem {
    height: 2.25rem;
    width: auto;
    display: block;
}

.brand-name {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text);
}

.nav-links {
    display: flex;
    gap: 0.25rem;
}

.nav-links a {
    color: var(--gray-700);
    text-decoration: none;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-md);
    font-weight: 400;
}

.nav-links a:hover {
    color: var(--accent-text);
    background: var(--accent-soft);
}

.nav-links a.active {
    color: var(--accent-text);
    background: var(--accent-soft);
    font-weight: 600;
}

.site-main {
    flex: 1;
    width: 100%;
    max-width: 46rem;
    margin: 0 auto;
    padding: 1.5rem 1.5rem 3rem;
}

@media (max-width: 640px) {
    .site-nav {
        padding: 0.75rem 1rem;
    }

    .site-main {
        padding: 1rem 1rem 3rem;
    }
}

.site-footer {
    border-top: 1px solid var(--border);
    margin-top: 3rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8125rem;
    line-height: 1.4;
    padding: 1rem;
}

.site-footer p {
    margin: 0.15rem 0;
}

.footer-legal a {
    color: var(--text-muted);
    text-decoration: underline;
}

.footer-legal a:hover {
    color: var(--accent);
}

/* ============================================================
   Loading / errors / empty states
   ============================================================ */

.app-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    color: var(--text-muted);
    font-family: var(--font-ui);
    background: var(--bg);
}

.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 2.5rem 0;
    color: var(--text-muted);
}

.spinner {
    width: 2.25rem;
    height: 2.25rem;
    border: 3px solid var(--gray-200);
    border-top-color: var(--accent);
    border-radius: var(--radius-full);
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.cold-start-note {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--gray-600);
}

.error-note {
    color: var(--error);
    background: var(--error-soft);
    border: 1px solid var(--error);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
}

.empty-state {
    max-width: 36ch;
    margin: 0 auto;
    text-align: center;
    padding: 1.5rem 0;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: var(--gray-600);
    background: transparent;
}

/* ============================================================
   Verse of the day — the centerpiece
   ============================================================ */

.verse-card {
    background: var(--verse-surface);
    border: 1px solid var(--accent-soft);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    color: var(--text);
}

.verse-card-empty {
    background: transparent;
    color: var(--gray-600);
    border: 1px dashed var(--gray-300);
    text-align: center;
}

.verse-card-empty p {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.4;
}

.verse-eyebrow {
    margin: 0 0 0.75rem;
}

.verse-text {
    margin: 0;
    font-family: var(--font-scripture);
    font-style: italic;
    font-size: 1.1875rem;
    font-weight: 400;
    line-height: 1.65;
    color: var(--text);
}

.verse-text::before {
    content: "\201C";
}

.verse-text::after {
    content: "\201D";
}

.verse-rule {
    width: 48px;
    height: 2px;
    background: var(--warm);
    border: none;
    margin: 1rem 0;
}

.verse-footer {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}

.verse-reference {
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--accent);
}

.verse-share {
    background: none;
    border: none;
    padding: 0.25rem 0.5rem;
    margin: 0;
    font-family: var(--font-ui);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--accent);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.verse-share:hover {
    background: var(--accent-soft);
}

.verse-translation {
    font-size: 0.8125rem;
    font-weight: 400;
    line-height: 1.4;
    color: var(--gray-600);
}

.verse-focus {
    margin: 0.75rem 0 0;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: var(--gray-600);
}

/* ============================================================
   Prayer cards
   ============================================================ */

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.prayer-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.prayer-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.prayer-card:hover {
    border-color: var(--gray-300);
    box-shadow: var(--shadow-hover);
    text-decoration: none;
}

.prayer-card-answered {
    border-left: 3px solid var(--answered);
}

.prayer-card-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.prayer-author {
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--gray-900);
}

.prayer-date {
    font-size: 0.8125rem;
    line-height: 1.4;
    color: var(--gray-600);
    white-space: nowrap;
}

.prayer-message {
    margin: 0 0 0.75rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.prayer-card .prayer-message {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.prayer-card-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.prayer-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: var(--gray-600);
}

.category-pill,
.answered-pill {
    padding: 0.15rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.category-pill {
    background: var(--accent-soft);
    color: var(--accent-text);
}

.answered-pill {
    background: var(--answered-soft);
    color: var(--answered);
    font-size: 0.8125rem;
}

.prayer-counts {
    margin-left: auto;
    white-space: nowrap;
    font-size: 0.8125rem;
    color: var(--gray-600);
}

/* ============================================================
   Prayers list toolbar
   ============================================================ */

.prayers-toolbar {
    margin-bottom: 1.5rem;
}

.search-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.search-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-family: var(--font-ui);
    font-size: 1rem;
    background: var(--surface);
    color: var(--text);
}

.search-input::placeholder {
    color: var(--gray-500);
}

.search-input:focus {
    border-color: var(--accent);
    outline: 2px solid var(--accent-soft);
}

.search-button,
.clear-button {
    padding: 0.55rem 1.1rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-ui);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
}

.search-button {
    background: var(--accent);
    color: var(--on-accent);
}

.search-button:hover {
    background: var(--accent-strong);
}

.clear-button {
    background: transparent;
    color: var(--gray-600);
}

.clear-button:hover {
    color: var(--accent);
}

.category-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.chip {
    min-height: 32px;
    padding: 0.25rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--gray-700);
    font-family: var(--font-ui);
    font-size: 0.8125rem;
    font-weight: 400;
    cursor: pointer;
}

.chip:hover {
    border-color: var(--accent);
    color: var(--accent-text);
}

.chip-active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--on-accent);
    font-weight: 600;
}

.chip-active:hover {
    color: var(--on-accent);
}

.load-more-button {
    display: block;
    margin: 1.5rem auto 0;
    padding: 0.55rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--accent);
    font-family: var(--font-ui);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
}

.load-more-button:hover:not(:disabled) {
    color: var(--accent-strong);
    text-decoration: underline;
}

.load-more-button:disabled {
    color: var(--gray-400);
    cursor: default;
}

/* ============================================================
   Prayer detail
   ============================================================ */

.prayer-detail {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.prayer-detail .prayer-message {
    font-size: 1rem;
}

.answered-banner {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--answered-soft);
    border: 1px solid var(--answered-border);
    border-radius: var(--radius-lg);
}

.answered-banner .eyebrow {
    color: var(--answered);
    margin-bottom: 0.25rem;
}

.answered-banner p {
    margin: 0;
}

.answered-date {
    margin-top: 0.25rem !important;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: var(--gray-600);
}

.author-update {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--gray-100);
    border-left: 3px solid var(--warm);
    border-radius: 0 10px 10px 0;
}

.author-update .eyebrow {
    color: var(--warm-text);
    margin-bottom: 0.35rem;
}

.author-update p {
    margin: 0 0 0.35rem;
    font-style: italic;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* ============================================================
   Prayed button — one treatment everywhere
   ============================================================ */

.prayed-action {
    margin-top: 1.5rem;
}

.prayed-button {
    padding: 0.625rem 1.25rem;
    background: transparent;
    border: 1px solid var(--accent);
    border-radius: var(--radius-md);
    color: var(--accent);
    font-family: var(--font-ui);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.prayed-button:hover:not(:disabled) {
    background: var(--accent-soft);
}

.prayed-button:disabled {
    cursor: default;
}

.prayed-button:disabled:not(.prayed-done) {
    border-color: var(--gray-300);
    color: var(--gray-400);
}

.prayed-button.prayed-done {
    background: var(--answered-soft);
    border-color: var(--answered);
    color: var(--answered);
}

.prayed-count {
    margin-left: 0.75rem;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: var(--gray-600);
}

.prayed-own {
    font-size: 0.8125rem;
    line-height: 1.4;
    color: var(--gray-600);
}

.prayed-message {
    margin: 0.5rem 0 0;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: var(--gray-600);
}

/* ============================================================
   Comments
   ============================================================ */

.comments-section h2 {
    margin-bottom: 0.75rem;
}

.comment {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
}

.comment-header {
    display: flex;
    gap: 0.6rem;
    align-items: baseline;
    font-size: 0.8125rem;
    color: var(--gray-600);
    margin-bottom: 0.25rem;
}

.comment-author {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--gray-900);
}

.comment-date {
    font-size: 0.8125rem;
    color: var(--gray-600);
}

.comment-text {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* ============================================================
   Legal pages (Terms / Privacy)
   ============================================================ */

.legal-page {
    max-width: 68ch;
    margin: 0 auto;
    padding: 32px 24px 48px;
    font-family: var(--font-ui);
    color: var(--text);
    background: transparent;
}

@media (max-width: 640px) {
    .legal-page {
        padding: 24px 16px 48px;
    }
}

.legal-page h1 {
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.25;
    margin: 0 0 8px;
}

.legal-page .legal-updated {
    font-size: 0.8125rem;
    color: var(--text-muted, #5A6B79);
    margin: 0 0 32px;
}

.legal-page h2 {
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 32px 0 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.legal-page h3 {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 24px 0 4px;
}

.legal-page p,
.legal-page li {
    font-size: 1rem;
    line-height: 1.6;
    margin: 0 0 12px;
}

.legal-page ul,
.legal-page ol {
    padding-left: 24px;
    margin: 0 0 16px;
}

.legal-page a {
    color: var(--accent);
    text-decoration: underline;
}

.legal-page a:hover {
    color: var(--accent-strong);
}

.legal-page strong {
    font-weight: 600;
}

/* ============================================================
   Blazor error UI
   ============================================================ */

#blazor-error-ui {
    background: var(--error-soft);
    color: var(--error);
    border-top: 1px solid var(--error);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    bottom: 0;
    display: none;
    left: 0;
    padding: 0.6rem 2.5rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .reload {
    color: var(--error);
    text-decoration: underline;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}
