/* Oquium parish card. One stylesheet for every card; each card sets --accent and
   --accent-soft from its church's own site. */
@font-face { font-family: "Fraunces"; font-style: normal; font-display: swap; font-weight: 100 900; src: url("/fonts/fraunces-latin-v5.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900; src: url("/fonts/inter-latin-v5.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-display: swap; font-weight: 100 900; src: url("/fonts/jetbrains-mono-latin-v5.woff2") format("woff2"); }

:root {
  --paper: #f8f5ef; --card: #fffefb; --ink: #1f2430; --muted: #6b6a6f; --rule: #e3ddd1;
  --gold: #9a7a36; --pencil-soft: #f3ecdc;
  --accent: #2d4f86; --accent-soft: #e2e8f2;
  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --text: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.5 var(--text); }
a { color: var(--accent); }

.top { max-width: 36rem; margin: 0 auto; padding: 1rem 1rem 0; display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; }
.wordmark { font: 600 1.1rem/1 var(--display); color: var(--ink); text-decoration: none; display: inline-flex; gap: 0.35rem; align-items: center; }
.wordmark .mark { color: var(--gold); font-size: 0.85em; }
.top a.all { color: var(--muted); text-decoration: none; }

.card { max-width: 36rem; margin: 0.75rem auto 2rem; background: var(--card); border: 1px solid var(--rule); border-radius: 1.25rem; overflow: hidden; }
.hero img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover;
  -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.credit { margin: -1.4rem 0 0; padding: 0 1.25rem; position: relative; font-size: 0.68rem; color: var(--muted); }
.credit a { color: inherit; }
.body { padding: 0.6rem 1.25rem 1.5rem; }
.eyebrow { margin: 0.4rem 0 0.35rem; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
h1 { margin: 0; font: 600 clamp(1.7rem, 6.5vw, 2.3rem)/1.08 var(--display); letter-spacing: -0.015em; text-wrap: balance; }
.original { margin: 0.3rem 0 0; font: italic 400 1rem/1.3 var(--display); color: var(--muted); }

.badge { margin: 0.85rem 0 0; display: inline-block; }
.badge summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.65rem; border-radius: 99px;
  background: var(--pencil-soft); color: var(--gold); font-size: 0.78rem; font-weight: 600; }
.badge summary::-webkit-details-marker { display: none; }
.badge svg { width: 0.9rem; height: 0.9rem; }
.badge p { margin: 0.5rem 0 0; font-size: 0.82rem; color: var(--muted); max-width: 30rem; }
.tz { margin: 0.8rem 0 0; font-size: 0.82rem; color: var(--muted); }

/* Section headings on the front only, so the plaque heading on the back stays plain. */
.body > h2 { margin: 1.5rem -1.25rem 0; padding: 0.55rem 1.25rem 0.5rem 2.75rem; border-bottom: 1px solid var(--rule);
  font: 500 1.2rem/1.1 var(--display);
  background: linear-gradient(var(--accent), var(--accent)) 1.25rem 55% / 1rem 2px no-repeat; }
ul.items { list-style: none; margin: 0; padding: 0; }
.items li { padding: 0.7rem 0; border-bottom: 1px solid color-mix(in srgb, var(--rule) 70%, transparent); }
.row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.15rem 1rem; align-items: baseline; }
.day { font: 500 1rem/1.25 var(--display); }
.times { font-size: 0.92rem; font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; }
.times.long { flex-basis: 100%; text-align: left; }
.note { margin: 0.2rem 0 0; font-size: 0.82rem; color: var(--muted); }
.call .times { color: var(--muted); font-weight: 400; font-style: italic; }
.call a { font-style: normal; font-weight: 500; }

details.src { margin-top: 0.3rem; font-size: 0.75rem; color: var(--muted); }
details.src summary { cursor: pointer; width: fit-content; }
details.src blockquote { margin: 0.35rem 0 0.25rem; padding: 0.4rem 0.6rem; border-left: 2px solid var(--accent); background: var(--accent-soft); color: var(--ink); font-size: 0.8rem; border-radius: 0 0.4rem 0.4rem 0; }

.about { margin-top: 1.4rem; font-size: 0.86rem; color: var(--muted); }
.about p { margin: 0 0 0.45rem; }
.facts { margin: 1rem 0 0; display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 0.9rem; font-size: 0.85rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.foot { max-width: 36rem; margin: 0 auto 2.5rem; padding: 0 1rem; font-size: 0.78rem; color: var(--muted); }
.foot code { font-family: var(--mono); font-size: 0.74rem; }

/* index of cards */
.index { max-width: 60rem; margin: 0 auto; padding: 1rem 1rem 2.5rem; }
.index h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); margin: 1rem 0 0.4rem; }
.index .lede { margin: 0 0 1.4rem; color: var(--muted); max-width: 40rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 1rem; list-style: none; margin: 0; padding: 0; }
.grid a { display: block; text-decoration: none; color: var(--ink); background: var(--card); border: 1px solid var(--rule); border-radius: 1rem; overflow: hidden; }
.grid img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.grid .t { padding: 0.7rem 0.9rem 0.9rem; border-top: 4px solid var(--a, var(--accent)); }
.grid .n { font: 600 1.1rem/1.2 var(--display); }
.grid .p { font-size: 0.8rem; color: var(--muted); }

/* Today's readings fold: closed by default, styled with the card's accent. */
.readings { margin: 1rem 0 0; border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--rule)); border-radius: 0.9rem; background: linear-gradient(180deg, var(--accent-soft), color-mix(in srgb, var(--accent-soft) 35%, var(--card))); overflow: hidden; }
.readings > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 0.9rem; }
.readings > summary::-webkit-details-marker { display: none; }
.readings > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 0.9rem; }
.r-icon { flex: none; width: 1.6rem; height: 1.6rem; padding: 0.3rem; border-radius: 50%; background: var(--card); color: var(--accent); box-sizing: content-box; }
.r-label { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.r-kicker { font-size: 0.66rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.r-title { font: 500 1rem/1.25 var(--display); color: var(--ink); }
.r-chev { flex: none; width: 1.1rem; height: 1.1rem; color: var(--accent); transition: transform 0.2s ease; }
.readings[open] .r-chev { transform: rotate(180deg); }
.readings.is-off > summary { cursor: default; }
.readings.is-off .r-chev { display: none; }
.readings.is-off .r-title { color: var(--muted); font-size: 0.92rem; }
.r-body { padding: 0 0.9rem 0.9rem; }
.r-tabs { display: flex; gap: 0.25rem; padding: 0.2rem; margin-bottom: 0.6rem; border-radius: 99px; background: color-mix(in srgb, var(--card) 70%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 15%, var(--rule)); }
.r-tab { flex: 1; border: 0; background: none; padding: 0.4rem 0.6rem; border-radius: 99px; font: 500 0.8rem/1.2 var(--text); color: var(--muted); cursor: pointer; }
.r-tab[aria-selected="true"] { background: var(--accent); color: #fff; }
.r-pane { max-height: 22rem; overflow: auto; padding: 0.1rem 0.15rem 0.2rem; }
.r-cite { margin: 0 0 0.5rem; font: italic 500 0.9rem/1.3 var(--display); color: var(--accent); }
.r-text { margin: 0 0 0.7rem; font: 400 0.98rem/1.6 var(--display); }
.r-refrain { font-weight: 600; color: var(--accent); }
.r-note { margin: 0.7rem 0 0; padding-top: 0.6rem; border-top: 1px solid color-mix(in srgb, var(--accent) 15%, var(--rule)); font-size: 0.74rem; color: var(--muted); }
.r-copy { margin: 0.35rem 0 0; font-size: 0.62rem; line-height: 1.4; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .r-chev { transition: none; } }

/* Weather chip: quiet, top right of the photo. Hidden until it has real data. */
.hero { position: relative; }
.wx { position: absolute; top: 0.75rem; right: 0.75rem; display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.3rem 0.6rem 0.3rem 0.45rem; border: 0; border-radius: 99px;
  background: rgba(255, 254, 251, 0.82); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); color: var(--ink);
  font: 500 0.8rem/1 var(--text); font-variant-numeric: tabular-nums; cursor: pointer; box-shadow: 0 1px 2px rgba(25, 35, 60, 0.12); }
.wx[hidden] { display: none; }
.wx-icon { width: 1.05rem; height: 1.05rem; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.wx-cond { display: none; color: var(--muted); font-weight: 400; }
.wx:hover .wx-cond, .wx.open .wx-cond, .wx:focus-visible .wx-cond { display: inline; }
.wx:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wx-credit { font-size: 0.7rem; }

/* Card flip: the front is the card as it always was; the back is a plaque for the
   card's Keepers (docs/plans/keepers.md). Without JS the back simply follows the
   front, unturned, and the footer link "Keepers of this card" jumps to it. */
.card-scene { max-width: 36rem; margin: 0.75rem auto 2rem; }
.card-scene .card { margin: 0; max-width: none; }
.card-scene .card-back { margin-top: 1rem; }
.flip-btn { display: none; }

.card-scene.js-ready {
  margin-bottom: 0; padding: 0 0 2.65rem; position: relative; perspective: 1800px;
  /* Overflow lives here, not on .card-flip, so preserve-3d is not flattened. It
     clips the taller inactive face so it does not extend the page. */
  overflow: hidden;
}
.js-ready .card-flip { position: relative; transform-style: preserve-3d; transition: height 0.7s ease; }
/* Mid-turn (keepers.js draws the page turn): a soft shadow deepens, then fades as it lands. */
.js-ready.is-turning .card { box-shadow: 0 calc(var(--lift, 0) * 16px) calc(var(--lift, 0) * 40px) rgba(25, 35, 60, calc(var(--lift, 0) * 0.24)); }
.js-ready.is-flipped .card-flip { transform: rotateY(180deg); }
.js-ready .card { position: absolute; top: 0; left: 0; right: 0; width: 100%; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.js-ready .card-back { margin-top: 0; transform: rotateY(180deg); }
.js-ready .flip-btn { display: inline-flex; }
.js-ready .keepers-fallback a { cursor: pointer; }

/* Settled on the back: no 3D at all, so taps reach Stripe's wallet iframe in Safari. */
.js-ready.is-flipped.is-settled { perspective: none; }
.js-ready.is-flipped.is-settled .card-flip { transform: none; transform-style: flat; }
.js-ready.is-settled .card-back { transform: none; -webkit-backface-visibility: visible; backface-visibility: visible; }
.js-ready.is-flipped.is-settled .card-front { visibility: hidden; -webkit-backface-visibility: visible; backface-visibility: visible; }
.js-ready.is-flipped .card-front { pointer-events: none; }
.js-ready.no-anim .card-flip, .js-ready.no-anim .card { transition: none !important; }

/* The turn button sits on the scene under the card's corner, so it never turns. */
.flip-btn { position: absolute; right: 0.7rem; bottom: 0.3rem; width: 2.75rem; height: 2.75rem; padding: 0; align-items: center; justify-content: center;
  border: 1px solid var(--rule); border-radius: 50%; background: var(--card); color: var(--gold); cursor: pointer; box-shadow: 0 1px 2px rgba(25, 35, 60, 0.08); }
.flip-btn svg { width: 1.2rem; height: 1.2rem; display: block; }
.flip-btn:hover { color: var(--ink); border-color: color-mix(in srgb, var(--gold) 45%, var(--rule)); }
.flip-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The plaque, in the spirit of benefactor stones in old churches. */
.plaque { margin: 0.7rem; padding: 2.5rem 1.6rem 2.2rem; border-radius: 0.85rem; text-align: center;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gold) 28%, var(--rule)); }
.plaque-mark { margin: 0 0 0.9rem; color: var(--gold); font-size: 1.05rem; line-height: 1; }
.plaque-title { all: unset; display: block; }
.plaque-church { display: block; font: 600 1.55rem/1.15 var(--display); letter-spacing: -0.015em; text-wrap: balance; color: var(--ink); }
.plaque-kicker { display: block; margin: 0.6rem 0 0; font: 600 0.68rem/1 var(--text); letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); }
.plaque-rule { display: block; width: 2.75rem; height: 1px; margin: 1.3rem auto; border: 0; background: color-mix(in srgb, var(--gold) 65%, var(--rule)); }
.keepers-empty { margin: 0 auto; max-width: 20rem; font: italic 400 1.05rem/1.45 var(--display); color: var(--muted); }
@media (max-width: 28rem) {
  .plaque { padding: 2.1rem 1.15rem 1.9rem; }
  .plaque-church { font-size: 1.4rem; }
}

/* Reduced motion: crossfade the faces instead of turning the card. */
@media (prefers-reduced-motion: reduce) {
  .js-ready .card-flip { transition: height 0.35s ease; }
  .js-ready.is-flipped .card-flip, .js-ready .card-back { transform: none; }
  .js-ready .card { transition: opacity 0.35s ease, visibility 0.35s ease; }
  .js-ready .card-back, .js-ready.is-flipped .card-front { opacity: 0; visibility: hidden; pointer-events: none; }
  .js-ready.is-flipped .card-back { opacity: 1; visibility: visible; pointer-events: auto; }
}

/* No-JS path only: the footer link to the plaque. */
html.js-ready .keepers-fallback { display: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* Keepers list (filled by keepers.js from /api/keepers). */
.keepers { list-style: none; margin: 0 auto; padding: 0; max-width: 24rem; font: 400 1.12rem/1.5 var(--display); color: var(--ink); }
.keepers li { margin: 0; padding: 0.48rem 0.25rem; text-wrap: pretty; }
.keepers li[data-kind="anonymous"] { font-style: italic; }
.keepers li.is-pending { color: var(--gold); font-style: italic; }

/* Give in place (docs/plans/keep-this-card.md): typography, not a checkout page. */
.keep-link { display: inline-block; margin-top: 1.2rem; padding: 0.6rem 0.4rem; min-height: 2.75rem; border: 0; background: none; cursor: pointer;
  color: var(--gold); font: 500 1.02rem/1.3 var(--display); text-decoration: none; }
.keepers-empty + .keep-link { margin-top: 0.6rem; }
.keep-link:hover, .keep-link:focus-visible { text-decoration: underline; }
.keep-link:focus-visible, .give-more:focus-visible, .other-ways:focus-visible, .keep-submit:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.keep-link[hidden], .keep-form[hidden], .keepers-empty[hidden], .keep-thanks[hidden], .give-more-panel[hidden], .name-wrap[hidden],
.express-checkout[hidden], .payment-element[hidden], .other-ways[hidden], .keep-submit[hidden], .keep-error[hidden] { display: none; }

.keep-form { margin: 0 auto; max-width: 22rem; text-align: center; }
.keep-kinds { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 0 1.15rem; }
.keep-kinds label { cursor: pointer; display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 0.1rem; font: 500 0.92rem/1.3 var(--display); color: var(--muted); }
.keep-kinds input { position: absolute; opacity: 0; pointer-events: none; }
.keep-kinds label:has(input:checked) { color: var(--gold); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.3em; }
.keep-kinds label:hover { color: var(--ink); }
.keep-kinds label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.name-wrap { margin: 0.9rem auto 0; max-width: 14rem; }
.name-wrap input { width: 100%; min-height: 2.75rem; border: 0; border-bottom: 1px solid color-mix(in srgb, var(--gold) 55%, var(--rule)); border-radius: 0;
  background: transparent; padding: 0.35rem 0.2rem 0.4rem; font: 400 1.12rem/1.4 var(--display); color: var(--ink); text-align: center; }
.name-wrap input::placeholder { color: color-mix(in srgb, var(--muted) 70%, var(--rule)); font-style: italic; }
.name-wrap input:focus { outline: none; border-bottom-color: var(--accent); }

.keep-preview { margin: 1.45rem 0 0; min-height: 1.6em; font: 400 1.18rem/1.5 var(--display); color: var(--gold); text-wrap: balance; }
.keep-preview.is-anonymous { font-style: italic; }
.keep-preview.is-blank { visibility: hidden; }

.express-checkout { width: 100%; max-width: 16.5rem; margin: 1.5rem auto 0; }
.payment-element { margin: 1.2rem 0 0; text-align: left; }

.give-more, .other-ways { display: inline-block; margin-top: 0.85rem; min-height: 2.75rem; padding: 0 0.4rem; border: 0; background: none; cursor: pointer;
  color: var(--muted); font: 400 0.82rem/1.3 var(--text); }
.give-more:hover, .give-more:focus-visible, .other-ways:hover, .other-ways:focus-visible { color: var(--ink); text-decoration: underline; }
.give-more + .other-ways { margin-left: 0.6rem; }
.give-more-panel { margin: 0.2rem auto 0; }
.give-amount { display: inline-flex; align-items: baseline; justify-content: center; gap: 0.15rem; font: 500 1.35rem/1 var(--display); color: var(--ink); }
.give-amount .cur { color: var(--gold); font-weight: 500; }
.give-amount input { width: 4.5rem; min-height: 2.75rem; border: 0; border-bottom: 1px solid color-mix(in srgb, var(--gold) 55%, var(--rule)); border-radius: 0;
  background: transparent; padding: 0.15rem 0; font: inherit; color: inherit; text-align: center; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.give-amount input::-webkit-outer-spin-button, .give-amount input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.give-amount input:focus { outline: none; border-bottom-color: var(--accent); }
.give-more-note { margin: 0.45rem 0 0; font-size: 0.75rem; color: var(--muted); }

.keep-submit { display: block; width: 100%; max-width: 16.5rem; min-height: 2.75rem; margin: 1rem auto 0; border: 0; border-radius: 6px; cursor: pointer;
  background: var(--ink); color: var(--card); font: 500 1rem/1 var(--text); }
.keep-submit:disabled { opacity: 0.6; cursor: progress; }
.keep-error { margin: 0.9rem auto 0; max-width: 20rem; font-size: 0.82rem; line-height: 1.4; color: var(--muted); }

.keep-thanks { margin: 0 auto; max-width: 22rem; font: italic 400 1.02rem/1.5 var(--display); color: var(--muted); }
.keep-thanks strong { display: block; margin-bottom: 0.7rem; font-weight: 400; font-style: italic; color: var(--gold); font-size: 1.12rem; }
@media (max-width: 28rem) {
  .keepers, .keep-preview, .name-wrap input { font-size: 1.05rem; }
}

/* Owner's approve/decline page (api/keepers/approve). */
.review { max-width: 28rem; margin: 3rem auto; padding: 2.5rem 1.5rem; text-align: center; background: var(--card); border: 1px solid var(--rule); border-radius: 1.25rem; }
.review-church { margin: 0; font: 600 1.4rem/1.2 var(--display); }
.review-line { margin: 1.2rem 0 1.4rem; font: 400 1.2rem/1.5 var(--display); color: var(--gold); }
.review-btn { min-height: 2.75rem; padding: 0 1.4rem; border: 0; border-radius: 6px; background: var(--ink); color: var(--card); font: 500 1rem/1 var(--text); cursor: pointer; }
.review-btn.is-decline { background: #8a2b2b; }
.review-note, .review-done { margin: 1rem 0 0; font-size: 0.86rem; color: var(--muted); }
.review-done { font-size: 1rem; color: var(--ink); }

/* Test mode only: a small log of wallet events, to see where a tap stops. */
.wallet-log { margin: 1rem auto 0; padding: 0.5rem 0.6rem; max-width: 20rem; text-align: left; font: 400 0.7rem/1.4 var(--mono); color: var(--muted);
  background: color-mix(in srgb, var(--pencil-soft) 60%, transparent); border-radius: 0.4rem; white-space: pre-wrap; }
