/* Hearing God in the Night — a quiet, readable night-time interface. */

:root {
  --ink: #e8e9f4;
  --ink-soft: #a9adc8;
  --ink-faint: #767a95;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-line: rgba(255, 255, 255, 0.09);
  --gold: #d8b56a;
  --gold-soft: rgba(216, 181, 106, 0.16);
  --radius: 14px;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  background-color: #0b0d1c;
  background-image:
    radial-gradient(1100px 620px at 18% -12%, #1b2050 0%, transparent 62%),
    radial-gradient(900px 520px at 88% -4%, #2a1f45 0%, transparent 58%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 56px 22px 80px;
}

/* ---------- masthead ---------- */

.masthead { text-align: center; margin-bottom: 34px; }

.eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
}

.masthead h1 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 38px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.sub {
  margin: 0 auto;
  max-width: 54ch;
  color: var(--ink-soft);
  font-size: 16px;
}

/* ---------- cards ---------- */

.card {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  padding: 24px;
  backdrop-filter: blur(6px);
}

.panel + .panel { margin-top: 16px; }

.panel h2 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 21px;
  color: var(--gold);
}

/* ---------- form ---------- */

.field { display: block; margin-bottom: 18px; }

.label { display: block; font-size: 15px; font-weight: 600; margin-bottom: 3px; }
.label em { font-style: normal; font-weight: 400; color: var(--ink-faint); }

.hint { display: block; font-size: 13.5px; color: var(--ink-faint); margin-bottom: 9px; }

textarea {
  width: 100%;
  padding: 13px 15px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  background: rgba(0, 0, 0, 0.26);
  border: 1px solid var(--panel-line);
  border-radius: 10px;
  resize: vertical;
}

textarea::placeholder { color: #5c608099; }

textarea:focus {
  outline: none;
  border-color: rgba(216, 181, 106, 0.55);
  box-shadow: 0 0 0 3px var(--gold-soft);
}

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

button {
  font-family: var(--sans);
  font-size: 15.5px;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.06s ease;
}

button:active { transform: translateY(1px); }

.primary {
  padding: 12px 22px;
  font-weight: 600;
  color: #241c07;
  background: linear-gradient(180deg, #e6c583, #cfa855);
  border: none;
}

.primary[disabled] { opacity: 0.5; cursor: default; }

.ghost {
  padding: 12px 16px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--panel-line);
}

.pray {
  margin: 18px 0 0;
  font-family: var(--serif);
  font-size: 15px;
  font-style: italic;
  color: var(--ink-faint);
}

.counter {
  display: block;
  margin-top: 5px;
  text-align: right;
  font-size: 12.5px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.counter.near { color: #e0b880; }

/* ---------- banner / status ---------- */

.banner {
  margin-bottom: 18px;
  padding: 13px 16px;
  font-size: 14.5px;
  border-radius: 10px;
  border: 1px solid rgba(232, 160, 120, 0.35);
  background: rgba(232, 160, 120, 0.1);
  color: #f0c8ae;
}

.banner code {
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.35);
  font-size: 13px;
}

.status {
  margin-top: 22px;
  text-align: center;
  color: var(--ink-soft);
  font-style: italic;
}

.dots::after {
  content: '·';
  display: inline-block;
  width: 1.4em;
  text-align: left;
  animation: dots 1.2s steps(1, end) infinite;
}

@keyframes dots {
  0% { content: '·'; }
  33% { content: '··'; }
  66% { content: '···'; }
  100% { content: '·'; }
}

/* ---------- result ---------- */

.result { margin-top: 26px; }

.prose { font-size: 17px; line-height: 1.72; }
.prose p { margin: 0 0 14px; }
.prose p:last-child { margin-bottom: 0; }

.muted-prose { color: var(--ink-soft); font-style: italic; }

.pills { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }

.pills li {
  padding: 6px 12px;
  font-size: 14px;
  color: #f0dcb2;
  background: var(--gold-soft);
  border: 1px solid rgba(216, 181, 106, 0.3);
  border-radius: 999px;
}

.questions { margin: 0; padding-left: 1.2em; color: var(--ink-soft); }
.questions li { margin-bottom: 10px; }
.questions li:last-child { margin-bottom: 0; }

/* ---------- book citations (no scores, by design) ---------- */

.sources { margin-top: 14px; display: flex; flex-direction: column; gap: 9px; }

details.source {
  border: 1px solid var(--panel-line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

details.source summary {
  padding: 12px 15px;
  cursor: pointer;
  list-style: none;
  font-size: 15px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

details.source summary::-webkit-details-marker { display: none; }

details.source summary::before {
  content: '▸';
  color: var(--gold);
  font-size: 12px;
  transition: transform 0.15s ease;
}

details.source[open] summary::before { transform: rotate(90deg); }

.src-chapter { font-weight: 600; }
.src-section { color: var(--ink-faint); font-size: 14px; }

.src-body {
  padding: 0 15px 15px 34px;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.7;
  white-space: pre-wrap;
}

/* ---------- glossary entries ---------- */

.symbols { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }

.symbol {
  padding: 12px 15px;
  border-left: 2px solid rgba(216, 181, 106, 0.5);
  border-radius: 0 8px 8px 0;
  background: rgba(0, 0, 0, 0.2);
}

.symbol h3 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 17px;
  color: #f0dcb2;
}

.symbol p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 15.5px;
  line-height: 1.65;
}

.symbol .part { display: block; margin-top: 6px; font-size: 12.5px; color: var(--ink-faint); }

/* ---------- the four tests ---------- */

.four-tests { margin: 0; padding-left: 1.15em; color: var(--ink-soft); font-size: 15.5px; }
.four-tests li { margin-bottom: 9px; }
.four-tests li:last-child { margin-bottom: 0; }
.four-tests strong { color: var(--ink); }
.four-tests em { color: var(--ink-faint); font-size: 14px; }

/* ---------- footer ---------- */

.foot {
  margin-top: 40px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 13.5px;
}

.foot p { margin: 0 0 6px; }
.tiny { font-size: 12.5px; opacity: 0.75; }

@media (max-width: 560px) {
  .wrap { padding: 28px 14px 48px; }
  .masthead h1 { font-size: 28px; }
  .sub { font-size: 15px; }
  .card { padding: 17px; }

  /* Buttons need to be thumb-sized, and the two of them shouldn't crowd each other. */
  .actions { flex-direction: column; align-items: stretch; }
  .primary, .ghost { width: 100%; padding: 14px 18px; }

  /* iOS zooms the whole page in when it focuses an input smaller than 16px. */
  textarea { font-size: 16px; }
}

/* Embedded in a page.
 *
 * The instinct is to go transparent and let the host page's background show through. That is
 * exactly wrong here: every colour in this app — the text, the gold, the hairline borders — is
 * chosen to sit on a dark ground. Drop that ground on a white blog page and the labels turn
 * near-invisible. So the night stays. On a light page it reads as a deliberate inset panel,
 * which is what it is. */
body.embedded {
  background-color: #0b0d1c;
  background-attachment: scroll; /* fixed attachment misbehaves inside a frame */
  border-radius: 12px;
}

body.embedded .wrap { padding: 26px 20px 34px; }

/* The masthead repeats what the blog page already says above the frame. */
body.embedded .masthead { margin-bottom: 24px; }
body.embedded .masthead .eyebrow { display: none; }
body.embedded .masthead h1 { font-size: 30px; }
