/* The Church — finance and membership system
   A single stylesheet, no build step. Colours are defined once as custom
   properties so the whole system can be retinted from one block. */

:root {
    --ink:            #1a1d23;
    --ink-soft:       #4a515e;
    --ink-faint:      #7b8395;
    --line:           #e2e5ea;
    --line-strong:    #cbd1da;
    --surface:        #ffffff;
    --surface-sunk:   #f6f7f9;
    --surface-raised: #ffffff;

    --brand:          #3d5a80;
    --brand-dark:     #2c4363;
    --brand-tint:     #eef2f7;

    /* Money semantics: money in, money out, and a problem that needs attention. */
    --credit:         #1b7f5a;
    --credit-tint:    #e8f5ef;
    --debit:          #a8383f;
    --debit-tint:     #fbecec;
    --warn:           #8a6100;
    --warn-tint:      #fdf4e0;

    --radius:         8px;
    --radius-sm:      5px;
    --shadow:         0 1px 2px rgba(26, 29, 35, .06), 0 4px 12px rgba(26, 29, 35, .04);

    --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    /* No webfont anywhere in this file, on the public site included: a church
       page fetches nothing from a third party, so it renders the same on a bad
       connection and reports its visitors to nobody. */
    --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;

    /* The one colour a church chooses for its own site. Overridden per church by
       a single declaration the public layout emits, which is why every public
       rule below reaches for this rather than for --brand. */
    --site-accent: #3d5a80;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--surface-sunk);
    -webkit-font-smoothing: antialiased;
}

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

/* ---------- Top bar ---------- */

.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 24px;
    height: 58px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 50;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 650;
    font-size: 15px;
    color: var(--ink);
    text-decoration: none;
    white-space: nowrap;
}

.brand-mark { font-size: 18px; color: var(--brand); }

.nav {
    display: flex;
    gap: 2px;
    flex: 1;
    overflow-x: auto;
}

.nav-link {
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.nav-link:hover { background: var(--surface-sunk); color: var(--ink); }
.nav-link.is-active { background: var(--brand-tint); color: var(--brand-dark); font-weight: 600; }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--ink-soft);
    white-space: nowrap;
}

.user-name { font-weight: 550; color: var(--ink); }
.inline-form { display: inline; margin: 0; }

/* ---------- Layout ---------- */

.content {
    flex: 1;
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 24px;
}

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.page-title { font-size: 22px; font-weight: 650; margin: 0; letter-spacing: -.01em; }
.page-subtitle { color: var(--ink-faint); font-size: 14px; margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.footer {
    padding: 20px 24px;
    color: var(--ink-faint);
    font-size: 12px;
    text-align: center;
    border-top: 1px solid var(--line);
    background: var(--surface);
}

/* ---------- Cards ---------- */

.card {
    background: var(--surface-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.card-title { font-size: 15px; font-weight: 620; margin: 0; }
.card-body { padding: 18px; }
.card-body.is-flush { padding: 0; }

/* ---------- Stat tiles ---------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.stat {
    background: var(--surface-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 15px 17px;
    box-shadow: var(--shadow);
}

.stat-label {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ink-faint);
    font-weight: 620;
    margin-bottom: 7px;
}

.stat-value {
    font-size: 23px;
    font-weight: 660;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.02em;
    line-height: 1.15;
}

.stat-note { font-size: 12.5px; color: var(--ink-faint); margin-top: 5px; }

.stat.is-credit .stat-value { color: var(--credit); }
.stat.is-debit  .stat-value { color: var(--debit); }
.stat.is-warn   .stat-value { color: var(--warn); }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table.data th {
    text-align: left;
    padding: 9px 14px;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .045em;
    color: var(--ink-faint);
    font-weight: 640;
    background: var(--surface-sunk);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

/* A header that re-sorts its table. It keeps the header's own look, so a
   sortable column reads as a column first and a link on hover. */
table.data th a.sort-link {
    color: inherit;
    text-decoration: none;
}
table.data th a.sort-link:hover { color: var(--ink); }
table.data th[aria-sort="ascending"],
table.data th[aria-sort="descending"] { color: var(--ink); }

table.data td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

table.data tbody tr:last-child td { border-bottom: none; }
/* A row that will not be written: an import preview lists what it is leaving
   alone as well as what it is creating, and the two must not read alike.
   (Used by both import previews; the class was in the markup with no rule
   behind it, so those rows looked identical to the ones being imported.) */
table.data tbody tr.is-muted td { color: var(--ink-faint); }
table.data tbody tr:hover { background: var(--surface-sunk); }

table.data tfoot td {
    padding: 11px 14px;
    font-weight: 640;
    background: var(--surface-sunk);
    border-top: 2px solid var(--line-strong);
}

/* Money and any other figure that should line up vertically. */
.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-family: var(--mono);
    font-size: 13.5px;
    white-space: nowrap;
}

.num.is-credit { color: var(--credit); }
.num.is-debit  { color: var(--debit); }
.num.is-strong { font-weight: 650; }
.muted { color: var(--ink-faint); }
.nowrap { white-space: nowrap; }

.empty {
    padding: 42px 20px;
    text-align: center;
    color: var(--ink-faint);
}

.empty-title { font-weight: 600; color: var(--ink-soft); margin-bottom: 5px; }

/* ---------- Badges ---------- */

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 11.5px;
    font-weight: 620;
    letter-spacing: .01em;
    white-space: nowrap;
    background: var(--surface-sunk);
    color: var(--ink-soft);
    border: 1px solid var(--line);
}

.badge-role { text-transform: capitalize; }
.badge-open      { background: var(--warn-tint);   color: var(--warn);   border-color: transparent; }
.badge-deposited { background: var(--credit-tint); color: var(--credit); border-color: transparent; }
.badge-restricted{ background: var(--brand-tint);  color: var(--brand-dark); border-color: transparent; }
.badge-cleared   { background: var(--credit-tint); color: var(--credit); border-color: transparent; }
.badge-void      { background: var(--debit-tint);  color: var(--debit);  border-color: transparent; }
.badge-locked    { background: var(--surface-sunk); color: var(--ink-faint); }

/* Follow-up urgency: missed, and due before the week is out. */
.badge-overdue   { background: var(--debit-tint);  color: var(--debit);  border-color: transparent; }
.badge-due-week  { background: var(--credit-tint); color: var(--credit); border-color: transparent; }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink);
    font-family: inherit;
    font-size: 14px;
    font-weight: 550;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover { background: var(--surface-sunk); }

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }

.btn-danger { color: var(--debit); border-color: var(--line-strong); }
.btn-danger:hover { background: var(--debit-tint); border-color: var(--debit); }

.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--surface-sunk); color: var(--ink); }

.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Forms ---------- */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px 16px;
}

.field { display: flex; flex-direction: column; gap: 5px; }
.field.is-wide { grid-column: 1 / -1; }

.field label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-soft);
}

.field input,
.field select,
.field textarea {
    padding: 8px 10px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    color: var(--ink);
    background: var(--surface);
    width: 100%;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: 2px solid var(--brand);
    outline-offset: -1px;
    border-color: var(--brand);
}

.field input[type="number"], .field .money-input { font-family: var(--mono); text-align: right; }
.field textarea { resize: vertical; min-height: 62px; }
.field-hint { font-size: 12px; color: var(--ink-faint); }

.check-row { display: flex; align-items: center; gap: 8px; }
.check-row input { width: auto; }
.check-row label { font-size: 13.5px; font-weight: 500; color: var(--ink); }

.form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.filter-bar {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-bar .field { min-width: 140px; }

/* ---------- Alerts ---------- */

.alert {
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.alert-error   { background: var(--debit-tint);  color: var(--debit);  border-color: #f0cdcd; }
.alert-success { background: var(--credit-tint); color: var(--credit); border-color: #c5e6d8; }
.alert-warn    { background: var(--warn-tint);   color: var(--warn);   border-color: #f0e0b8; }
.alert-info    { background: var(--brand-tint);  color: var(--brand-dark); border-color: #d3dfec; }

/* ---------- Login ---------- */

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--surface-sunk);
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px;
}

.login-head { text-align: center; margin-bottom: 22px; }
.login-mark { font-size: 32px; color: var(--brand); }
.login-title { font-size: 19px; font-weight: 650; margin: 8px 0 3px; }
.login-sub { color: var(--ink-faint); font-size: 13.5px; margin: 0; }
.login-card .field { margin-bottom: 13px; }
.login-card .btn { width: 100%; }

/* ---------- Reconciliation ---------- */

.recon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    margin-bottom: 20px;
}

.recon-cell {
    padding: 14px 16px;
    border-right: 1px solid var(--line);
}

.recon-cell:last-child { border-right: none; }
.recon-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .045em; color: var(--ink-faint); font-weight: 620; }
.recon-value { font-size: 19px; font-weight: 650; font-family: var(--mono); font-variant-numeric: tabular-nums; margin-top: 5px; }

.recon-cell.is-difference { background: var(--debit-tint); }
.recon-cell.is-difference .recon-value { color: var(--debit); }
.recon-cell.is-balanced { background: var(--credit-tint); }
.recon-cell.is-balanced .recon-value { color: var(--credit); }

.recon-formula {
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--ink-faint);
    padding: 11px 16px;
    background: var(--surface-sunk);
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    line-height: 1.7;
}

/* Rows that have been ticked off against the statement. */
tr.is-cleared { background: var(--credit-tint) !important; }
tr.is-cleared:hover { background: #ddefe6 !important; }
tr.is-void td { opacity: .55; text-decoration: line-through; }
tr.is-void .badge { text-decoration: none; opacity: 1; }

/* Follow-up urgency in the care team's schedule: red for a date already
   missed, green for one falling inside the current week. Scoped to table.data
   rather than bare `tr` so these outrank the generic row hover without
   resorting to !important — and each keeps its own hover tint, so hovering
   doesn't wash the colour away on the row you are reading. */
table.data tbody tr.is-overdue        { background: var(--debit-tint); }
table.data tbody tr.is-overdue:hover  { background: #f6dfe0; }
table.data tbody tr.is-due-week       { background: var(--credit-tint); }
table.data tbody tr.is-due-week:hover { background: #ddefe6; }

/* A bar on the leading edge, so the two states are still distinguishable
   without relying on colour alone. */
table.data tbody tr.is-overdue  td:first-child { box-shadow: inset 3px 0 0 var(--debit); }
table.data tbody tr.is-due-week td:first-child { box-shadow: inset 3px 0 0 var(--credit); }

/* Key for the tinted rows, sat in the card head above them. */
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-faint); }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { width: 9px; height: 9px; border-radius: 100px; }
.legend-dot.is-overdue  { background: var(--debit); }
.legend-dot.is-due-week { background: var(--credit); }

.clear-check { width: 17px; height: 17px; cursor: pointer; accent-color: var(--credit); }

/* ---------- Progress ---------- */

.progress {
    height: 7px;
    background: var(--line);
    border-radius: 100px;
    overflow: hidden;
    min-width: 90px;
}

.progress-bar { height: 100%; background: var(--brand); border-radius: 100px; }
.progress-bar.is-complete { background: var(--credit); }

/* ---------- Statement (print) ---------- */

.statement {
    background: #fff;
    padding: 44px;
    max-width: 800px;
    margin: 0 auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.statement-head { text-align: center; border-bottom: 2px solid var(--ink); padding-bottom: 18px; margin-bottom: 24px; }
.statement-church { font-size: 21px; font-weight: 680; }
.statement-doctype { font-size: 14px; color: var(--ink-soft); margin-top: 5px; letter-spacing: .02em; }
.statement-donor { margin-bottom: 24px; line-height: 1.65; }
.statement-donor-name { font-weight: 640; font-size: 15.5px; }
.statement-address { color: var(--ink-soft); white-space: pre-line; font-size: 14px; }

.statement-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 15px 18px;
    background: var(--surface-sunk);
    border-radius: var(--radius-sm);
    margin: 22px 0;
}

.statement-total-label { font-weight: 620; }
.statement-total-value { font-size: 24px; font-weight: 680; font-family: var(--mono); }

.statement-notice {
    border: 1px solid var(--line-strong);
    border-left: 3px solid var(--brand);
    padding: 13px 16px;
    font-size: 13.5px;
    color: var(--ink-soft);
    border-radius: var(--radius-sm);
    margin-top: 22px;
    line-height: 1.6;
}

.print-only { display: none; }

@media print {
    .topbar, .footer, .page-actions, .no-print { display: none !important; }
    .print-only { display: block; }
    body { background: #fff; font-size: 12pt; }
    .content { max-width: none; padding: 0; }
    .statement { border: none; padding: 0; max-width: none; }
    .card { border: none; box-shadow: none; }
    table.data th { background: #fff !important; }
    a { text-decoration: none; color: inherit; }
}

/* ---------- Misc ---------- */

.link { color: var(--brand); text-decoration: none; font-weight: 550; }
.link:hover { text-decoration: underline; }

.section-divider {
    margin: 26px 0 14px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ink-faint);
    font-weight: 650;
}

.two-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    align-items: start;
}

.htmx-request { opacity: .6; transition: opacity .1s; }

@media (max-width: 780px) {
    .topbar { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 10px; }
    .nav { order: 3; width: 100%; }
    .content { padding: 16px; }
}

/* Sign-in / sign-up cross-link */
.login-alt { margin: 18px 0 0; text-align: center; font-size: 13.5px; color: var(--ink-faint); }

/* ---------- Picture library ---------- */

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.image-card { margin: 0; }

/* A fixed thumbnail box on a chequerboard: a logo with a transparent
   background is invisible against white, and the church needs to see that it
   uploaded the transparent one. */
.image-card-thumb {
    display: block;
    width: 100%;
    height: 170px;
    object-fit: contain;
    background-color: var(--surface-sunk);
    background-image:
        linear-gradient(45deg, #eceef1 25%, transparent 25%, transparent 75%, #eceef1 75%),
        linear-gradient(45deg, #eceef1 25%, transparent 25%, transparent 75%, #eceef1 75%);
    background-size: 16px 16px;
    background-position: 0 0, 8px 8px;
    border-bottom: 1px solid var(--line);
    border-radius: var(--radius) var(--radius) 0 0;
}

.image-card-name {
    margin: 0;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-card-meta { margin: 2px 0 12px; font-size: 12.5px; }

.form-actions.is-tight { margin-top: 8px; }

/* The paste-me-into-a-page line. Monospace and selectable in one click. */
.code-input {
    font-family: var(--mono);
    font-size: 12.5px;
}

.color-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.color-row input[type="color"] {
    width: 44px;
    height: 38px;
    padding: 2px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
}
.color-row input[type="text"] { flex: 1; font-family: var(--mono); }

/* ---------- Invitation ---------- */

/* The join instructions on the users page, set apart so an administrator can
   see at a glance that this — and only this — is the part to send someone. */
.invite-card {
    background: var(--brand-tint);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin: 0 0 14px;
}

.invite-message {
    margin: 0;
    font-size: 15.5px;
    /* The message is rendered from the same plain text that gets copied, so the
       line break before the URL has to survive into the page. */
    white-space: pre-line;
    /* Long enough on a narrow screen that the URL has to be allowed to break
       rather than push the card sideways. */
    overflow-wrap: anywhere;
}

.invite-message a { color: var(--brand-dark); }

/* The typed code, kept for the person whose link does not survive the trip.
   Folded away behind a disclosure because reaching for it should feel like the
   exception it now is. */
.invite-fallback {
    margin: 0 0 14px;
    font-size: 14px;
}

.invite-fallback summary {
    cursor: pointer;
    color: var(--ink-soft);
    padding: 4px 0;
}

.invite-fallback summary:hover { color: var(--ink); }

.invite-code {
    margin: 4px 0 0;
    font-family: var(--mono);
    font-size: 21px;
    font-weight: 650;
    letter-spacing: .09em;
    color: var(--ink);
    white-space: nowrap;
    padding: 2px 0;
    /* So a tap-and-hold offers "Copy" rather than the page's own gestures. */
    -webkit-user-select: all;
    user-select: all;
}

.invite-actions {
    flex-wrap: wrap;
}

.invite-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

/* ==================================================================
   The public website

   A church's own site, served on its subdomain to people who have not
   signed in to anything. It shares this stylesheet and its custom
   properties — one file, no build step, same as the rest — but not its
   chrome: the admin app is a dense working screen, and this is a page a
   stranger reads on a phone before deciding whether to visit. Wider
   measure, larger type, more air.
   ================================================================== */

.site-body {
    background: var(--surface);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: var(--site-body-font, var(--sans));

    /* Shades of the church's accent. Declared as the admin palette first so a
       browser without `color-mix` gets a coherent site rather than an unstyled
       one, then recomputed from the accent where it is supported. */
    --site-accent-dark: var(--brand-dark);
    --site-accent-tint: var(--brand-tint);
}

@supports (color: color-mix(in srgb, red, blue)) {
    .site-body {
        --site-accent-dark: color-mix(in srgb, var(--site-accent) 78%, #000);
        --site-accent-tint: color-mix(in srgb, var(--site-accent) 9%, #fff);
    }
}

/* ---------- Lettering ----------
   Three choices, set on <body> from the church's settings. Each names a body
   face and a display face; every heading on the public site uses the display
   one, so a church that picks serif headings gets them everywhere at once. */

.site-body.is-font-plain       { --site-body-font: var(--sans);  --site-display-font: var(--sans); }
.site-body.is-font-traditional { --site-body-font: var(--serif); --site-display-font: var(--serif); }
.site-body.is-font-mixed       { --site-body-font: var(--sans);  --site-display-font: var(--serif); }

.site-brand-name,
.site-hero-title,
.site-page-title,
.site-band-value,
.site-prose h2,
.site-prose h3,
.site-foot-title {
    font-family: var(--site-display-font, var(--sans));
}

/* ---------- Preview bar ---------- */

/* Only ever seen by signed-in staff. Loud on purpose: the whole risk of a
   preview is mistaking it for the live site. */
.site-preview-bar {
    background: var(--warn-tint);
    color: var(--warn);
    border-bottom: 1px solid #f0e0b8;
    padding: 9px 20px;
    font-size: 13.5px;
    text-align: center;
}
.site-preview-bar a { color: inherit; margin-left: 10px; }

/* ---------- Header ---------- */

.site-head {
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.site-head-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--ink);
}

.site-brand-mark { font-size: 26px; color: var(--site-accent); line-height: 1; }

/* A church's own mark, when it has uploaded one. Fixed box so a logo that is
   tall, wide, or square all sit on the same baseline as the name beside them. */
.site-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    display: block;
}
.site-brand-name { display: block; font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
.site-brand-sub  { display: block; font-size: 13px; color: var(--ink-faint); margin-top: 2px; }

.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 18px;
}

.site-nav-link {
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 15px;
    padding: 4px 0;
    border-bottom: 2px solid transparent;
}
.site-nav-link:hover { color: var(--ink); }
.site-nav-link.is-active { color: var(--site-accent-dark); border-bottom-color: var(--site-accent); font-weight: 600; }

/* ---------- Hero ----------
   A photograph with the page's own title and summary laid over it. Only pages
   that have been given a picture get one; the rest open on `.site-page-head`,
   which is a plain heading and not a degraded hero. */

.site-hero {
    position: relative;
    /* Tall enough to read as a photograph, short enough that the first
       paragraph is still on screen on a laptop. */
    min-height: clamp(300px, 44vh, 520px);
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    background: var(--site-accent-dark);
}

.site-hero-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Text over a photograph is only legible if the photograph is darkened under
   it, and a church uploads whatever it has — bright sky, white siding, a snowy
   car park. The gradient is heaviest exactly where the words are. */
.site-hero-veil {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, .72) 0%, rgba(0, 0, 0, .38) 45%, rgba(0, 0, 0, .12) 100%);
}

.site-hero-text {
    position: relative;
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    padding: 40px 20px 44px;
    color: #fff;
}

.site-hero-title {
    margin: 0;
    font-size: clamp(30px, 5vw, 48px);
    line-height: 1.12;
    font-weight: 680;
    letter-spacing: -.02em;
    text-shadow: 0 1px 24px rgba(0, 0, 0, .35);
}

.site-hero-summary {
    margin: 14px 0 0;
    max-width: 34em;
    font-size: clamp(17px, 2vw, 20px);
    line-height: 1.5;
    color: rgba(255, 255, 255, .92);
}

.site-hero-cta {
    display: inline-block;
    margin-top: 22px;
    padding: 12px 22px;
    border-radius: var(--radius);
    background: #fff;
    color: var(--site-accent-dark);
    font-weight: 640;
    text-decoration: none;
}
.site-hero-cta:hover { background: rgba(255, 255, 255, .88); }

.site-draft-flag.is-on-hero { color: #ffd98a; }

/* ---------- Facts band ----------
   Service times, address, phone — the three things a visitor came to find,
   directly under the landing page's hero instead of only in the footer. */

.site-band {
    background: var(--site-accent-tint);
    border-bottom: 1px solid var(--line);
}

.site-band-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 22px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px 28px;
}

.site-band-label {
    margin: 0 0 4px;
    font-size: 11.5px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--site-accent-dark);
}

.site-band-value {
    margin: 0;
    font-size: 17px;
    line-height: 1.45;
    color: var(--ink);
}
.site-band-value a { color: var(--ink); text-decoration: none; }
.site-band-value a:hover { text-decoration: underline; }

/* ---------- Page ---------- */

.site-main { flex: 1; }

.site-page {
    max-width: 760px;
    margin: 0 auto;
    padding: 48px 20px 64px;
}
.site-page-narrow { max-width: 560px; }

.site-page-head { margin-bottom: 28px; }

.site-page-title {
    margin: 0;
    font-size: 34px;
    line-height: 1.2;
    font-weight: 650;
    letter-spacing: -.02em;
}

.site-page-summary {
    margin: 12px 0 0;
    font-size: 18px;
    line-height: 1.55;
    color: var(--ink-soft);
}

.site-draft-flag {
    margin: 0 0 12px;
    font-size: 12px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--warn);
}

/* ---------- Prose ----------
   Styles whatever ContentRenderer emits, and only that: paragraphs,
   two heading levels, unordered lists, bold, italic, links. If a rule
   here has no matching case in that renderer, one of the two has
   drifted. */

.site-prose {
    font-size: 17px;
    line-height: 1.7;
    color: var(--ink);
}

.site-prose p  { margin: 0 0 1.15em; }
.site-prose h2 {
    margin: 1.9em 0 .55em;
    font-size: 22px;
    font-weight: 650;
    letter-spacing: -.01em;
}
.site-prose h3 {
    margin: 1.6em 0 .45em;
    font-size: 18px;
    font-weight: 650;
}
.site-prose ul { margin: 0 0 1.15em; padding-left: 1.3em; }
.site-prose li { margin-bottom: .4em; }
.site-prose a  { color: var(--site-accent-dark); text-decoration: underline; text-underline-offset: 2px; }
.site-prose a:hover { color: var(--site-accent); }
.site-prose strong { font-weight: 650; }

/* A picture the renderer emitted. `site-figure` is a picture on its own line,
   set a little wider than the measure so it reads as a photograph rather than
   an illustration inside the text; `site-image` alone is one inside a sentence. */
.site-figure {
    margin: 1.9em 0;
}

.site-image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius);
}

/* Inside a paragraph, a picture stays inline and modest. */
.site-prose p .site-image {
    display: inline-block;
    width: auto;
    max-width: 100%;
    vertical-align: middle;
}

@media (min-width: 900px) {
    /* Pull a standalone figure out past the text column on a wide screen. The
       measure is 760px; this gives the photograph the full 860. */
    .site-figure {
        width: calc(100% + 100px);
        margin-left: -50px;
    }
}

.site-back { color: var(--brand-dark); }

/* ---------- Footer ---------- */

.site-foot {
    border-top: 1px solid var(--line);
    background: var(--surface-sunk);
    margin-top: auto;
}

.site-foot-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 36px 20px 28px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 28px;
}

.site-foot-title {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ink-faint);
}

.site-foot-lines {
    margin: 0 0 8px;
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--ink-soft);
}
.site-foot-lines a { color: var(--ink-soft); text-decoration: none; }
.site-foot-lines a:hover { color: var(--brand-dark); text-decoration: underline; }

.site-foot-rule {
    max-width: 960px;
    margin: 0 auto;
    padding: 14px 20px 28px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    gap: 16px;
    font-size: 13px;
    color: var(--ink-faint);
}
.site-foot-rule a { color: var(--ink-faint); text-decoration: none; }
.site-foot-rule a:hover { text-decoration: underline; }

@media (max-width: 780px) {
    .site-head-inner { padding: 16px; gap: 12px; }
    .site-page { padding: 32px 16px 48px; }
    .site-page-title { font-size: 28px; }
    .site-page-summary { font-size: 16.5px; }
    .site-prose { font-size: 16px; }
    .site-hero { min-height: 260px; }
    .site-hero-text { padding: 28px 16px 32px; }
    .site-band-inner { padding: 18px 16px; }
}


/* ==================================================================
   Adding a person from the care log

   The care team meets people before the office enters them, so a contact
   can create a roster entry. The duplicate check below is the price of
   that: two records for one person split their care history in half.
   ================================================================== */

.new-person {
    margin: 4px 0 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 14px;
    background: var(--surface-sunk);
}

.new-person summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--ink-soft);
    padding: 2px 0;
}

.new-person[open] summary { color: var(--ink); }

.new-person .form-grid { margin-top: 10px; }

.new-person-lead {
    margin: 6px 0 0;
    font-size: 13.5px;
}

/* The no-roster case: this is the form, not an aside folded under one. */
.new-person.is-open { background: var(--brand-tint); }

.new-person-title {
    margin: 0;
    font-weight: 600;
}

.match-prompt {
    border: 1px solid var(--warn);
    border-radius: var(--radius);
    background: var(--warn-tint);
    padding: 14px 16px;
}

.match-question {
    margin: 0;
    font-size: 16px;
}

.match-why {
    margin: 4px 0 12px;
    font-size: 13.5px;
}

/* Each candidate is a whole row of hit area, not a 13px radio button —
   this gets answered on a phone in a hospital corridor. */
.match-option {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.match-option:hover { border-color: var(--line-strong); }

.match-option input { margin-top: 3px; }

.match-option.is-strong { border-color: var(--warn); }

/* Visually last and visually different: the safe answer is to link an
   existing person, and "add a new one" should not be the thing the eye
   lands on first. */
.match-option-new {
    margin-bottom: 0;
    background: transparent;
    border-style: dashed;
}

.match-body {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.match-name { font-weight: 600; }

.match-meta {
    font-size: 13px;
    color: var(--ink-soft);
}

.match-reason {
    font-size: 12.5px;
    color: var(--ink-faint);
}


/* ==================================================================
   Person search on the contact form

   A dropdown was fine for a church of six and unusable at a hundred and
   thirty-eight. The list is absolutely positioned so opening it does not
   push the rest of the form down the page mid-keystroke.
   ================================================================== */

.person-search { position: relative; }

.person-search input[type="text"] { width: 100%; }

.person-results {
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    margin: 4px 0 0;
    padding: 4px;
    list-style: none;
    max-height: 280px;
    overflow-y: auto;
    background: var(--surface-raised);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.person-result {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.person-result:hover,
.person-result.is-active {
    background: var(--brand-tint);
}

.person-result-name { font-weight: 600; }

.person-result-detail {
    font-size: 12.5px;
    color: var(--ink-faint);
}

/* Last in the list and visibly not a person: this is the escape hatch, not
   one of the answers. */
.person-result-add {
    margin-top: 2px;
    border-top: 1px solid var(--line);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    color: var(--brand-dark);
    font-size: 13.5px;
}

.person-chosen {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--credit);
}
