/* Hitherto Prayer Quilt. Warm paper, a quilt on a linen stage. One column, quilt first. */
:root {
  --bg: #F7F2E8; --surface: #FFFDF8; --ink: #242019; --muted: #6B6255;
  --accent: #6B2F3A; --on-accent: #FFFDF8; --gold: #8A6718; --gold-thread: #8A6718; --binding: #6B2F3A;
  --line: rgba(36,32,25,.13); --wash: rgba(36,32,25,.05); --stage: #E7E3DA;
  --muslin: #EDE5D3; --seam: #FBF7EE;
  --display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #151310; --surface: #211E19; --ink: #F3EDE2; --muted: #BDB2A3;
  --accent: #D89AA6; --on-accent: #151310; --gold: #D6B25E; --gold-thread: #D6B25E; --binding: #8A3E4C;
  --line: rgba(243,237,226,.14); --wash: rgba(243,237,226,.06); --stage: #1D1A16;
  --muslin: #3A342B; --seam: #2A261F; color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #151310; --surface: #211E19; --ink: #F3EDE2; --muted: #BDB2A3;
  --accent: #D89AA6; --on-accent: #151310; --gold: #D6B25E; --gold-thread: #D6B25E; --binding: #8A3E4C;
  --line: rgba(243,237,226,.14); --wash: rgba(243,237,226,.06); --stage: #1D1A16;
  --muslin: #3A342B; --seam: #2A261F; color-scheme: dark }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.6 var(--body); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: .18em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 1000px; margin: 0 auto; padding-inline: 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.qtop { border-bottom: 1px solid var(--line); }
.qtop .wrap { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-block: 14px; flex-wrap: wrap; }
.qmark { text-decoration: none; color: var(--ink); display: grid; }
.qmark b { font: 600 22px/1.1 var(--display); }
.qmark span { font: 600 10.5px/1.4 var(--body); letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.qnav { display: flex; gap: 14px; font-size: 14px; }
.qnav a { color: var(--muted); }

main { padding-block: 22px 40px; display: grid; gap: 20px; }
h1 { font: 600 clamp(36px, 7vw, 56px)/1.04 var(--display); margin: 0; letter-spacing: -.005em; text-wrap: balance; }
.date { font: 500 italic clamp(20px, 3.4vw, 26px)/1.3 var(--display); color: var(--gold); margin: 4px 0 0; }
.sub { color: var(--muted); margin: 10px 0 0; max-width: 64ch; }
.stats { display: flex; flex-wrap: wrap; gap: 4px 18px; color: var(--muted); font-size: 14px; margin-top: 10px; font-variant-numeric: tabular-nums; }
.stats b { color: var(--ink); font-weight: 600; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search { flex: 1 1 220px; min-width: 0; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 15px var(--body); padding: 0 12px; }
.chip, .tools button { font: 500 14px var(--body); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; min-height: 40px; padding: 0 12px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.link { background: none; border: 0; padding: 0; font: 500 14px var(--body); color: var(--accent); text-decoration: underline; text-underline-offset: .18em; cursor: pointer; }

.stage { position: relative; border-radius: 14px; overflow: hidden; background: var(--stage); border: 1px solid var(--line);
  height: clamp(380px, min(72vh, calc(100vw + 40px)), 660px); touch-action: none; }
canvas#quilt { display: block; width: 100%; height: 100%; cursor: grab; }
canvas#quilt.dragging { cursor: grabbing; }
.tools { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; }
.tools button { min-width: 40px; padding: 0 10px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.hint, .state { position: absolute; left: 12px; bottom: 10px; font-size: 12.5px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 4px 9px; pointer-events: none; }
.state { left: 50%; top: 50%; bottom: auto; transform: translate(-50%, 120%); font-size: 14px; padding: 8px 12px; text-align: center; max-width: 80%; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: grid; gap: 10px; position: relative; }
.eyebrow { font: 600 11px/1.3 var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.prayer { font: 500 clamp(24px, 4vw, 30px)/1.22 var(--display); margin: 0; text-wrap: pretty; overflow-wrap: anywhere; }
.meta, .code { color: var(--muted); font-size: 14px; }
.code { font-size: 12px; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn { font: 600 15px var(--body); border: 0; border-radius: 999px; padding: 11px 20px; cursor: pointer; background: var(--accent); color: var(--on-accent); }
.btn.quiet { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn.small { padding: 8px 14px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: default; }
.note { font-size: 14px; color: var(--muted); margin: 0; }
.flash { font-size: 15px; border-left: 3px solid var(--gold); padding: 8px 12px; background: var(--wash); border-radius: 6px; margin: 0; }
.reportbox { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 6px; }
.reportbox fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.reportbox legend { font-weight: 600; margin-bottom: 4px; }
.reportbox label { display: flex; gap: 8px; align-items: center; }
.knot-anim { position: absolute; right: 18px; top: 16px; width: 34px; height: 34px; opacity: 0; pointer-events: none; color: var(--gold); }
.knot-anim.go { animation: knot 1.4s ease forwards; }
.knot-anim path { stroke-dasharray: 90; stroke-dashoffset: 90; }
.knot-anim.go path { animation: thread 1.1s ease forwards; }
@keyframes knot { 0% { opacity: 0; } 15% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes thread { to { stroke-dashoffset: 0; } }

.grid2 { display: grid; gap: 28px; }
@media (min-width: 840px) { .grid2 { grid-template-columns: 1.1fr .9fr; } }
h2 { font: 600 30px/1.1 var(--display); margin: 0 0 10px; }
form { display: grid; gap: 10px; }
label.f { font-size: 14px; font-weight: 600; }
textarea, input[type=text] { width: 100%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; font: 16px/1.5 var(--body); padding: 10px 12px; }
textarea { min-height: 104px; resize: vertical; }
.counter { font-size: 12px; color: var(--muted); text-align: right; margin-top: -6px; font-variant-numeric: tabular-nums; }
.fabrics { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; margin: 0; }
.fabrics legend { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.swatch { position: relative; cursor: pointer; }
.swatch canvas { width: 40px; height: 40px; border-radius: 50%; display: block; border: 2px solid var(--line); }
.swatch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.swatch input:checked + .sr + *, .swatch:has(input:checked) canvas { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.swatch:has(input:focus-visible) canvas { outline: 2px solid var(--accent); outline-offset: 2px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--muted); }
.check input { margin-top: 4px; accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
.crisis { border: 1px solid var(--gold); border-left-width: 4px; border-radius: 10px; padding: 12px 14px; background: var(--surface); font-size: 15px; margin: 0; }
.namecheck { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--surface); display: grid; gap: 8px; }
.guidelines { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px 16px; font-size: 14.5px; }

.days { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 12px; }
.day { display: grid; gap: 4px; text-decoration: none; color: var(--ink); font-size: 12.5px; }
.day canvas { width: 100%; aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--line); background: var(--stage); }
.day[aria-current="page"] canvas { outline: 2px solid var(--accent); outline-offset: 2px; }
.day span { color: var(--muted); }

.sqlist, .results, .rlist { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.sqlist li, .rlist li { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 6px; }
.lt { font: 500 22px/1.25 var(--display); margin: 0; overflow-wrap: anywhere; }
.lm { margin: 0; font-size: 13px; color: var(--muted); }
.results li a { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.results .rd { color: var(--gold); font-size: 13px; font-weight: 600; margin-right: 6px; }
.results .ri { color: var(--muted); font-size: 13px; }

.funnel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.funnel p { margin: 0; }
.funnel p + p { margin-top: 6px; color: var(--muted); font-size: 14px; }
.qfoot { border-top: 1px solid var(--line); padding-block: 22px 40px; color: var(--muted); font-size: 14px; }
.qfoot .wrap { display: grid; gap: 14px; }
.qfoot nav { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.qfoot nav a { color: var(--muted); }
.verse { font: 500 italic 18px/1.4 var(--display); color: var(--muted); margin: 0; }

.doc { max-width: 42rem; }
.doc h1 { font-size: clamp(34px, 6vw, 48px); margin-bottom: 10px; }
.doc p, .doc li { font-size: 16px; }
.doc ol { padding-left: 1.3em; display: grid; gap: 8px; }

/* review page */
.rv-section { display: grid; gap: 10px; }
.rv-totals { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
input[type=date] { height: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); padding: 0 10px; font: 15px var(--body); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* Example squares on an empty day (clearly labelled, never stored, never counted) */
.examples { margin: 14px 0 4px; padding: 14px 16px; border: 1px dashed var(--line); border-radius: 12px; background: var(--surface); }
.ex-lead { margin: 0 0 10px; font-size: 15px; }
.ex-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.ex-list li { position: relative; padding: 26px 12px 12px; border-radius: 8px; background: var(--muslin); opacity: .72; border: 1px dashed var(--gold-thread); }
.ex-list p { margin: 0; font-family: "Cormorant Garamond", Georgia, serif; font-size: 18px; line-height: 1.3; }
.ex-tag { position: absolute; top: 7px; left: 10px; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ex-by { display: block; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.ex-note { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }
.ex-recent { margin: 8px 0 0; font-size: 14px; }
.ex-finished { margin: 14px 0 0; display: flex; gap: 16px; align-items: center; }
.ex-finished canvas { width: 180px; height: 180px; flex: none; border-radius: 4px; opacity: .9; }
.ex-finished figcaption { font-size: 14px; color: var(--muted); }
.ex-finished figcaption b { color: var(--ink); font-weight: 600; }
.ex-tag.static { position: static; display: inline-block; margin-right: 4px; }
#ex-squares + .ex-finished { padding-top: 14px; border-top: 1px dashed var(--line); }
@media (max-width: 520px) { .ex-finished { flex-direction: column; align-items: flex-start; } .ex-finished canvas { width: 100%; max-width: 300px; height: auto; } }
