/* Set like a printed Bible: paper and ink, red rubrics, hairline rules.
   Source Serif for reading, Source Sans for controls and labels. */

:root {
  --paper: #f5f0e6;
  --ink: #1f1c18;
  --ink-soft: #4f483f;
  --rule: #d9d0bf;
  --red: #9e2a20;
  --red-ink: #7f1f17;
  --field: #fbf8f1;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #17150f;
    --ink: #ece4d4;
    --ink-soft: #bcb2a1;
    --rule: #3a352b;
    --red: #e07a63;
    --red-ink: #ee9a86;
    --field: #1e1b15;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.125rem/1.6 "Source Serif 4", Georgia, "Times New Roman", serif;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--red); color: var(--paper); }

.page {
  max-width: 38rem;
  margin: 0 auto;
  padding: 0 max(20px, env(safe-area-inset-right)) max(48px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}

/* Controls and labels use the sans. */
.rubric,
.section-title,
.tab,
.wordmark,
.primary,
.link,
.chip,
cite,
.item-ref,
.item-date,
.translation,
.colophon,
.note,
.empty,
.intro,
.why,
.saved-note,
.item-note::before {
  font-family: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
}
.rubric { color: var(--red); font-weight: 600; font-size: 0.95rem; }

/* ---------- Masthead ---------- */

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: max(28px, env(safe-area-inset-top)) 0 12px;
  border-bottom: 1px solid var(--ink);
  margin-bottom: 40px;
}
.wordmark {
  color: var(--red);
  text-decoration: none;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.16em;
}
.tabs { display: flex; gap: 20px; }
.tab {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 500;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--red); }
.count { margin-left: 5px; color: var(--red); font-weight: 600; }
.count:empty { display: none; }

/* ---------- Writing ---------- */

.question {
  display: block;
  margin-bottom: 14px;
  font-size: 1.85rem;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.01em;
}

textarea {
  display: block;
  width: 100%;
  resize: vertical;
  min-height: 8.5rem;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: 0;
  background: var(--field);
  color: var(--ink);
  font: inherit;
  font-size: 1.15rem;
  line-height: 1.55;
}
textarea::placeholder { color: var(--ink-soft); opacity: 0.75; }
textarea:focus { outline: none; border-color: var(--ink); }

.starters { margin: 14px 0 24px; color: var(--ink-soft); line-height: 1.8; }
.starters .rubric { margin-right: 6px; }
.nowrap { white-space: nowrap; }
.chip {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 1.05rem;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 3px;
}
.chip:hover { color: var(--red); text-decoration-color: var(--red); }

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

.primary {
  display: inline-block;
  padding: 10px 22px 12px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  color: var(--paper);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.primary:hover { background: var(--red-ink); border-color: var(--red-ink); }
.primary:disabled { opacity: 0.6; cursor: progress; }
.primary.small { padding: 6px 16px 8px; font-size: 1rem; }

.link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border-bottom: 1px solid var(--rule);
}
.link:hover { color: var(--red); border-bottom-color: var(--red); }
.link.danger:hover { color: var(--red); }

.bookmark { width: 0.6em; height: 0.8em; fill: none; stroke: currentColor; stroke-width: 1.3; }
#favorite[aria-pressed="true"] { color: var(--red); }
#favorite[aria-pressed="true"] .bookmark { fill: currentColor; }

:is(button, a, summary):focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; }

/* ---------- Result ---------- */

.result {
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--ink);
}
.intro { margin: 0 0 22px; color: var(--ink-soft); font-size: 1.05rem; }

.scripture { margin: 0 0 18px; }
.verse {
  margin: 0 0 10px;
  font-size: 1.5rem;
  line-height: 1.45;
  hanging-punctuation: first;
  text-wrap: pretty;
}
.result .verse::first-letter {
  float: left;
  margin: 0.06em 0.08em 0 0;
  color: var(--red);
  font-size: 3.1em;
  line-height: 0.82;
  font-weight: 600;
}
.result .verse::after { content: ""; display: block; clear: both; }
cite { color: var(--red); font-style: normal; font-weight: 600; font-size: 1rem; letter-spacing: 0.02em; }
.translation { margin-left: 10px; color: var(--ink-soft); font-size: 0.85rem; letter-spacing: 0.06em; }

.why { margin: 0 0 16px; color: var(--ink-soft); font-size: 1.05rem; }
.message { margin: 0 0 22px; }

.prayer {
  margin: 0 0 28px;
  padding: 2px 0 2px 18px;
  border-left: 2px solid var(--red);
}
.prayer summary { cursor: pointer; list-style: none; }
.prayer summary::-webkit-details-marker { display: none; }
.prayer summary::after { content: " +"; color: var(--red); }
.prayer[open] summary::after { content: " −"; }
.prayer p { margin: 6px 0 4px; font-style: italic; }

.journal-form { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--rule); }
.journal-form label { display: block; margin-bottom: 6px; }
.journal-form textarea { min-height: 5.2rem; margin-bottom: 14px; font-size: 1.1rem; }
.saved-note { margin: 18px 0 0; color: var(--red); font-weight: 500; }

/* ---------- Crisis ---------- */

.crisis {
  margin-top: 40px;
  padding: 4px 0 4px 18px;
  border-left: 3px solid var(--red);
}
.crisis p { margin: 0 0 6px; }
.crisis a { color: var(--red); font-weight: 600; }

/* ---------- Saved & Journal ---------- */

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.section-title { margin: 0 0 6px; font-size: 1.5rem; font-weight: 600; color: var(--red); }
.note { margin: 0 0 8px; color: var(--ink-soft); font-size: 0.95rem; }

.entry { padding: 24px 0; border-bottom: 1px solid var(--rule); }
.entry:first-child { border-top: 1px solid var(--ink); }
.item-ref { margin: 0 0 6px; color: var(--red); font-weight: 600; font-size: 1rem; }
.entry .scripture .item-ref { margin: 0; }
.verse.small { font-size: 1.25rem; margin-bottom: 12px; }
.item-date { margin: 0 0 8px; color: var(--ink-soft); font-size: 0.9rem; }
.item-entry { margin: 0 0 16px; }
.entry .scripture { padding-left: 18px; border-left: 1px solid var(--rule); }
.item-note { margin: 0 0 16px; }
.item-note::before { content: "Reflection: "; color: var(--red); font-weight: 600; font-size: 0.95rem; }
.empty { margin: 24px 0; color: var(--ink-soft); }

/* ---------- Install ---------- */

.install {
  margin-top: 56px;
  padding: 4px 0 4px 18px;
  border-left: 3px solid var(--ink);
}
.install p { margin: 0 0 10px; }
.share-icon { width: 0.8em; height: 1em; vertical-align: -0.12em; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Colophon ---------- */

.colophon {
  margin-top: 64px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  color: var(--ink-soft);
  font-size: 0.9rem;
}
.colophon p { margin: 0 0 4px; }
.colophon .meaning { margin-bottom: 10px; color: var(--ink); }
.colophon .meaning .rubric { margin-right: 8px; letter-spacing: 0.12em; }

/* ---------- Motion ---------- */

.reveal { animation: reveal 0.5s ease-out; }
@keyframes reveal { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .reveal { animation: none; } }

/* ---------- Small screens ---------- */

@media (max-width: 480px) {
  body { font-size: 1.0625rem; }
  .masthead { flex-direction: column; align-items: flex-start; gap: 6px; padding-top: 22px; margin-bottom: 32px; }
  .question { font-size: 1.6rem; }
  .verse { font-size: 1.35rem; }
  .primary { width: 100%; }
  .primary.small { width: auto; }
}

/* ---------- Testiminis: account screens ---------- */

.t-status { margin: 12px 0 0; padding: 8px 12px; border-left: 3px solid var(--ink); }
.t-status.error { border-left-color: var(--red); color: var(--red-ink); }
.t-panel { margin-top: 24px; }
.t-form { display: grid; gap: 12px; max-width: 26rem; }
.t-form .primary.small { justify-self: start; }
.t-form input[type="email"],
.t-form input:not([type]),
.t-form input[inputmode] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: 0;
  background: var(--field);
  color: var(--ink);
  font: inherit;
}
.t-form input:focus { outline: none; border-color: var(--ink); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 1rem; }
.check input { margin-top: 0.3em; accent-color: var(--red); width: 1.05em; height: 1.05em; }
.guidelines { padding: 8px 0 4px 16px; border-left: 2px solid var(--rule); }
.guidelines summary { cursor: pointer; }
.guidelines ul { margin: 8px 0; padding-left: 1.1em; }
.guidelines li { margin-bottom: 4px; }
.guidelines p { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }

.t-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.t-sub { margin: 40px 0 0; }
.t-account { margin-top: 40px; color: var(--ink-soft); font-size: 0.95rem; }
.t-account .link { font-size: 0.95rem; }

.t-compose { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--ink); display: grid; gap: 12px; }
.t-compose .rubric, .t-compose .note { margin: 0; }
.t-capture { position: relative; }
.t-capture video { display: block; width: 100%; max-height: 60vh; background: #000; object-fit: contain; }
.t-rec-time {
  position: absolute; top: 10px; left: 10px; margin: 0; padding: 2px 8px;
  background: var(--red); color: #fff; font-family: "Source Sans 3", system-ui, sans-serif; font-size: 0.95rem;
}
.t-file-label { cursor: pointer; }

.t-item { display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: start; }
.t-item video { width: 96px; aspect-ratio: 9 / 16; object-fit: cover; background: #000; }
.t-item p { margin: 0 0 6px; }
.t-item-who { font-weight: 600; }
.t-item-status { color: var(--ink-soft); font-family: "Source Sans 3", system-ui, sans-serif; font-size: 0.95rem; }

/* ---------- Testiminis: full-screen feed ---------- */

body.feed-open { overflow: hidden; }

.feed {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #000;
  color: #fff;
  font-family: "Source Sans 3", system-ui, sans-serif;
}
.feed-top {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(10px, env(safe-area-inset-top)) 12px 10px;
  background: linear-gradient(rgb(0 0 0 / 0.55), transparent);
}
.feed-btn, .feed-spacer { width: 40px; height: 40px; }
.feed-btn { border: 0; background: none; color: #fff; font-size: 2rem; line-height: 1; cursor: pointer; }
.feed-tabs { display: flex; gap: 18px; }
.feed-tab {
  padding: 4px 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: rgb(255 255 255 / 0.7);
  font: 600 1.05rem/1.2 "Source Sans 3", system-ui, sans-serif;
  cursor: pointer;
}
.feed-tab.active { color: #fff; border-bottom-color: #fff; }

.feed-list {
  height: 100%;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.feed-list::-webkit-scrollbar { display: none; }
.feed-empty {
  position: absolute; inset: 40% 24px auto; margin: 0; text-align: center; color: rgb(255 255 255 / 0.85); font-size: 1.1rem;
}

.clip {
  position: relative;
  height: 100%;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
}
.clip video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.clip-sound {
  position: absolute; top: 64px; right: 12px; z-index: 1;
  padding: 6px 12px; border: 0; border-radius: 999px;
  background: rgb(0 0 0 / 0.55); color: #fff; font: 500 0.9rem "Source Sans 3", system-ui, sans-serif; cursor: pointer;
}
.clip-info {
  position: absolute;
  left: 0; right: 84px; bottom: 0;
  padding: 48px 16px max(20px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgb(0 0 0 / 0.7));
  text-shadow: 0 1px 2px rgb(0 0 0 / 0.6);
}
.clip-info p { margin: 0 0 6px; }
.clip-who { display: flex; align-items: center; gap: 10px; }
.clip-name { font-weight: 600; font-size: 1.05rem; }
.clip-follow {
  padding: 2px 12px; border: 1px solid #fff; border-radius: 999px;
  background: none; color: #fff; font: 600 0.85rem "Source Sans 3", system-ui, sans-serif; cursor: pointer;
}
.clip-follow.on { background: #fff; color: #000; }
.clip-caption { font: 1.02rem/1.4 "Source Serif 4", Georgia, serif; }
.clip-crisis { padding: 8px 10px; background: rgb(158 42 32 / 0.85); font-size: 0.95rem; text-shadow: none; }
.clip-crisis a { color: #fff; font-weight: 600; }
.clip-actions {
  position: absolute;
  right: 10px; bottom: max(24px, env(safe-area-inset-bottom));
  display: grid; gap: 18px; justify-items: center;
}
.clip-react, .clip-more {
  display: grid; justify-items: center; gap: 2px;
  min-width: 64px; padding: 8px 6px;
  border: 0; border-radius: 12px;
  background: rgb(0 0 0 / 0.4); color: #fff;
  font: 600 0.85rem "Source Sans 3", system-ui, sans-serif; cursor: pointer;
}
.clip-react[aria-pressed="true"] { background: var(--red); }
.clip-count { font-size: 1rem; }
.clip-more { font-size: 1.2rem; letter-spacing: 0.1em; }

/* ---------- Report sheet ---------- */

.sheet {
  width: min(28rem, calc(100% - 32px));
  padding: 20px;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
}
.sheet::backdrop { background: rgb(0 0 0 / 0.5); }
.sheet fieldset { margin: 12px 0 16px; padding: 0; border: 0; display: grid; gap: 8px; }
.sheet .rubric, .sheet .note { margin: 0 0 6px; }

/* ---------- Testiminis: profiles ---------- */

.handle-input { display: flex; align-items: stretch; border: 1px solid var(--rule); background: var(--field); }
.handle-input span { padding: 10px 0 10px 12px; color: var(--ink-soft); }
.handle-input input { flex: 1; min-width: 0; padding: 10px 12px 10px 2px; border: 0; background: none; color: var(--ink); font: inherit; }
.handle-input input:focus { outline: none; }
.handle-input:focus-within { border-color: var(--ink); }
.hint { margin: -4px 0 0; color: var(--ink-soft); font-family: "Source Sans 3", system-ui, sans-serif; font-size: 0.9rem; }

.profile-head { margin: 8px 0 20px; }
.handle { margin: 0 0 8px; font-size: 1.6rem; font-weight: 600; letter-spacing: -0.01em; }
.stats { display: flex; flex-wrap: wrap; gap: 6px 22px; font-family: "Source Sans 3", system-ui, sans-serif; color: var(--ink-soft); }
.stat { padding: 0; border: 0; background: none; color: inherit; font: inherit; }
button.stat { cursor: pointer; border-bottom: 1px solid var(--rule); }
button.stat:hover { color: var(--red); border-bottom-color: var(--red); }
.stat strong { color: var(--ink); font-weight: 600; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 12px; }
.tile { position: relative; aspect-ratio: 9 / 16; padding: 0; border: 0; background: #000; cursor: pointer; overflow: hidden; }
.tile video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.tile-badge {
  position: absolute; left: 6px; bottom: 6px; padding: 1px 8px;
  background: var(--red); color: #fff; font: 600 0.75rem "Source Sans 3", system-ui, sans-serif;
}

.settings { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--rule); }
.settings summary { cursor: pointer; }
.settings .t-form { margin-top: 16px; }

.people { display: grid; }
.person-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--rule);
}
.pill {
  padding: 4px 14px; border: 1px solid var(--ink); border-radius: 999px;
  background: none; color: var(--ink); font: 600 0.9rem "Source Sans 3", system-ui, sans-serif; cursor: pointer;
}
.pill.on { background: var(--ink); color: var(--paper); }
#person-follow.on { background: none; color: var(--ink); }

.person {
  position: fixed; inset: 0; z-index: 60;
  overflow-y: auto; background: var(--paper);
}
.person-page { max-width: 38rem; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 20px 48px; }
.person-page .profile-head { margin-top: 20px; }

.clip-sheet { width: min(24rem, calc(100% - 32px)); padding: 0 0 16px; }
.clip-sheet video { display: block; width: 100%; max-height: 70vh; background: #000; }
.clip-sheet-caption, .clip-sheet .t-item-status, .clip-sheet .actions { margin: 12px 16px 0; }
.clip-name { padding: 0; border: 0; background: none; color: #fff; font: 600 1.05rem "Source Sans 3", system-ui, sans-serif; cursor: pointer; text-shadow: inherit; }
