/* /q/ pages in the chat home's system: same tokens, header, bubbles and composer as bible-llm.com and sda.bible-llm.com */
:root {
  --font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --bg: #ffffff; --fg: #0f0f14; --fg-muted: #52526a; --fg-subtle: #9898b0;
  --glass2: rgba(255,255,255,0.78); --separator: rgba(0,0,0,0.07); --card-border: rgba(0,0,0,0.08);
  --bub-bot: rgba(0,0,0,0.05); --bub-bot-border: rgba(0,0,0,0.07);
  --inp-bg: rgba(255,255,255,0.65); --inp-border: rgba(0,0,0,0.12); --inp-border-focus: rgba(0,0,0,0.25);
  --lang-bg: rgba(0,0,0,0.04); --lang-border: rgba(0,0,0,0.10); --lang-hover: rgba(0,0,0,0.08);
  --quote-bg: rgba(0,0,0,0.035);
  --accent-from: #1a6ed4; --accent-to: #06b6d4; --on-accent: #ffffff; --link: #0a6abf;
  --radius: 18px; --radius-pill: 100px;
}
html[data-site="bible"] { --accent-from: #e8a800; --accent-to: #f3910c; --on-accent: #3a2a00; --link: #a86f00; }
html[data-theme="dark"] {
  --bg: #0c0414; --fg: #f0f0f8; --fg-muted: #aaaac3; --fg-subtle: #606080;
  --glass2: rgba(255,255,255,0.08); --separator: rgba(255,255,255,0.08); --card-border: rgba(255,255,255,0.10);
  --bub-bot: rgba(255,255,255,0.06); --bub-bot-border: rgba(255,255,255,0.09);
  --inp-bg: rgba(255,255,255,0.06); --inp-border: rgba(255,255,255,0.14); --inp-border-focus: rgba(255,255,255,0.30);
  --lang-bg: rgba(255,255,255,0.06); --lang-border: rgba(255,255,255,0.12); --lang-hover: rgba(255,255,255,0.12);
  --quote-bg: rgba(255,255,255,0.05);
  --accent-from: #60a5fa; --accent-to: #22d3ee; --on-accent: #06121f; --link: #7cc4ff;
}
html[data-site="bible"][data-theme="dark"] { --accent-from: #ffd243; --accent-to: #f3910c; --on-accent: #3a2a00; --link: #ffd243; }

*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--accent-from); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* header, as on the chat home */
.hdr { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 86%, transparent); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border-bottom: 1px solid var(--separator); }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; color: inherit; text-decoration: none; }
.who > span { min-width: 0; }
.hav { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 1px solid var(--card-border); flex: none; }
.hname { display: block; font-size: 15px; font-weight: 700; letter-spacing: -0.15px; line-height: 1.2; }
.hsub { display: block; font-size: 11.5px; color: var(--fg-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pills { display: flex; gap: 4px; flex: none; }
.pill { display: inline-flex; align-items: center; justify-content: center; min-height: 30px; min-width: 36px; padding: 0 10px; border-radius: var(--radius-pill);
  background: var(--lang-bg); border: 1px solid var(--lang-border); color: var(--fg-muted); font-size: 12px; font-weight: 600; text-decoration: none; transition: background-color .15s; }
.pill:hover { background: var(--lang-hover); color: var(--fg); }
.pill[aria-current] { background: linear-gradient(135deg, var(--accent-from), var(--accent-to)); color: var(--on-accent); border-color: transparent; }

/* thread */
.thread { max-width: 720px; margin: 0 auto; padding: 16px 14px calc(120px + env(safe-area-inset-bottom)); }
.crumbs { font-size: 12.5px; color: var(--fg-subtle); margin: 0 2px 12px; }
.crumbs a { text-decoration: none; }
.crumbs a { color: var(--fg-muted); }
.m { display: flex; gap: 8px; margin-bottom: 10px; }
.m.u { justify-content: flex-end; }
.m.u .bub { max-width: 88%; padding: 10px 14px; background: linear-gradient(135deg, var(--accent-from), var(--accent-to)); color: var(--on-accent); border-bottom-right-radius: 6px; }
.m.b { display: block; }
.who-b { display: flex; align-items: center; gap: 8px; margin: 0 2px 6px; font-size: 13px; font-weight: 600; color: var(--fg-muted); }
.mav { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex: none; border: 1px solid var(--card-border); }
.bub { padding: 14px 16px; border-radius: var(--radius); min-width: 0; overflow-wrap: break-word; }
.m.b .bub { border-top-left-radius: 6px; background: var(--bub-bot); border: 1px solid var(--bub-bot-border); }
h1 { margin: 0; font-size: clamp(17px, 0.8vw + 14px, 21px); line-height: 1.35; font-weight: 650; letter-spacing: -0.1px; text-wrap: pretty; overflow-wrap: normal; word-break: normal; hyphens: manual; }
.meta { display: flex; justify-content: flex-end; gap: 12px; font-size: 12px; color: var(--fg-subtle); margin: 6px 6px 20px; }

/* the answer */
.answer { font-size: 16px; line-height: 1.65; }
.answer > p:empty, .answer > br:first-child { display: none; }
.answer > p { margin: 0 0 1em; }
.answer > p:last-child { margin-bottom: 0; }
.answer > p.standfirst { font-weight: 500; }
.answer > p.standfirst b, .answer > p.standfirst strong { font-weight: 650; }
.answer h2 { margin: 1.3em 0 0.4em; font-size: 17px; line-height: 1.3; font-weight: 700; letter-spacing: -0.2px; }
.answer h2:first-child { margin-top: 0; }
.answer b, .answer strong { font-weight: 650; }
.answer blockquote { margin: 1em 0; padding: 14px 16px; border-radius: 14px; background: var(--quote-bg); font-style: italic; }
.answer blockquote cite, .answer blockquote cite a { display: block; margin-top: 6px; font-style: normal; font-size: 13px; color: var(--fg-muted); }
.answer ul, .answer ol { padding-left: 1.3em; margin: 0 0 1em; }
.answer li { margin-bottom: 0.35em; }
.note { margin: 10px 0; padding: 12px 16px; border-radius: var(--radius); background: var(--bub-bot); }

/* read next, as suggestion chips under the last answer */
.next { margin-top: 40px; }
.next h2 { font-size: 15px; font-weight: 700; color: var(--fg-muted); margin: 0 0 10px 4px; }
.sugg { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sugg a { display: block; padding: 11px 14px; border-radius: var(--radius); background: var(--inp-bg); border: 1px solid var(--inp-border); color: var(--fg); text-decoration: none; font-size: 14.5px; line-height: 1.4; transition: border-color .15s, background-color .15s; }
.sugg a:hover { border-color: var(--inp-border-focus); background: var(--lang-bg); }
.sugg small { display: block; margin-top: 3px; font-size: 12px; color: var(--fg-subtle); }

/* index */
.search { display: flex; gap: 8px; margin: 4px 0 18px; }
.rows { list-style: none; margin: 0; padding: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--card-border); }
.rows li + li { border-top: 1px solid var(--separator); }
.rows a { display: block; padding: 12px 14px; color: var(--fg); text-decoration: none; font-size: 15px; line-height: 1.4; font-weight: 600; transition: background-color .15s; }
.rows a:hover { background: var(--lang-bg); }
.rows small { display: block; margin-top: 3px; font-size: 12px; font-weight: 400; color: var(--fg-subtle); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 18px 0; font-size: 14px; color: var(--fg-muted); }
.empty { padding: 20px 4px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.answer > p.standfirst i, .answer > p.standfirst em { font-style: normal; color: var(--fg-muted); }


/* ── Motion tokens ── */
:root { --ease-out: cubic-bezier(0.16, 1, 0.3, 1); --dock-shadow: 0 10px 30px -12px rgba(15,15,20,0.22), 0 2px 6px -2px rgba(15,15,20,0.08); }
html[data-theme="dark"] { --dock-shadow: 0 12px 34px -12px rgba(0,0,0,0.7), 0 2px 8px -2px rgba(0,0,0,0.5); }

/* ── Follow-ups: quiet suggestions in the thread, right under the answer ── */
.followups { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0 32px; }
.chip { min-height: 36px; padding: 0 14px; border-radius: var(--radius-pill); border: 1px solid var(--card-border); background: transparent; color: var(--fg-muted);
  font: inherit; font-size: 14px; cursor: pointer; transition: color .2s var(--ease-out), border-color .2s var(--ease-out), background-color .2s var(--ease-out), transform .2s var(--ease-out); }
.chip:hover { color: var(--fg); border-color: var(--inp-border-focus); background: var(--lang-bg); }
.chip:active { transform: scale(0.97); }
.followups.gone { animation: fadeAway .25s var(--ease-out) forwards; }
@keyframes fadeAway { to { opacity: 0; transform: translateY(-4px); visibility: hidden; height: 0; margin: 0; } }

/* ── Composer: a floating dock, not a bar ── */
.composer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; pointer-events: none;
  padding: 28px max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: linear-gradient(to top, var(--bg) 45%, color-mix(in srgb, var(--bg) 0%, transparent)); }
.composer form { pointer-events: auto; max-width: 720px; margin: 0 auto; display: flex; align-items: flex-end; gap: 6px;
  padding: 6px 6px 6px 18px; border-radius: 26px; background: var(--bg); border: 1px solid var(--card-border); box-shadow: var(--dock-shadow);
  transition: border-color .25s var(--ease-out), box-shadow .25s var(--ease-out); }
.composer form:focus-within { border-color: color-mix(in srgb, var(--accent-from) 45%, var(--card-border)); box-shadow: var(--dock-shadow), 0 0 0 4px color-mix(in srgb, var(--accent-from) 12%, transparent); }
.field { flex: 1; min-width: 0; min-height: 38px; max-height: 140px; padding: 9px 0; border: 0; background: none; color: var(--fg); font: inherit; font-size: 16px; line-height: 1.35; resize: none; display: block; }
.field::placeholder { color: var(--fg-subtle); }
.field:focus, .field:focus-visible { outline: none; }
.send { width: 38px; height: 38px; flex: none; border-radius: 50%; border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  background: var(--lang-bg); color: var(--fg-subtle); transition: background-color .25s var(--ease-out), color .25s var(--ease-out), transform .3s var(--ease-out); }
.send svg { width: 18px; height: 18px; transition: transform .3s var(--ease-out); }
form.ready .send, .search .send { background: linear-gradient(135deg, var(--accent-from), var(--accent-to)); color: var(--on-accent); }
form.ready .send svg { transform: translateX(1px); }
.send:active { transform: scale(0.9); }
form.busy .send { opacity: .55; pointer-events: none; }

/* index search keeps its own inline field */
.search { padding: 6px 6px 6px 18px; border-radius: 26px; border: 1px solid var(--card-border); background: var(--bg); transition: border-color .25s var(--ease-out); align-items: center; }
.search:focus-within { border-color: color-mix(in srgb, var(--accent-from) 45%, var(--card-border)); }

/* ── Live chat under an article ── */
.chat { margin-top: 8px; }
.chat .m { scroll-margin-top: 84px; margin-top: 18px; animation: rise .45s var(--ease-out) both; }
.chat .m.u { animation-name: riseRight; }
.chat .m.u .bub { white-space: pre-wrap; font-size: 15.5px; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); filter: blur(3px); } }
@keyframes riseRight { from { opacity: 0; transform: translate(10px, 6px) scale(.97); filter: blur(2px); } }
.typing { display: inline-flex; align-items: center; gap: 10px; color: var(--fg-muted); font-size: 14px; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .35; animation: blink 1.2s infinite var(--ease-out); }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 30% { opacity: 1; transform: translateY(-2px); } }
.typing.err { color: var(--fg); }
.cont { display: inline-flex; align-items: center; gap: 6px; margin: 10px 0 0 32px; padding: 6px 12px; border-radius: var(--radius-pill); font-size: 13.5px; text-decoration: none; color: var(--link); background: var(--lang-bg); transition: background-color .2s var(--ease-out); animation: rise .4s .1s var(--ease-out) both; }
.cont:hover { background: var(--lang-hover); }
.cont svg { width: 14px; height: 14px; }
.answer h3 { margin: 1.1em 0 0.4em; font-size: 16.5px; font-weight: 700; }
.answer .stream-end::after { content: ''; display: inline-block; width: 7px; height: 1em; margin-left: 2px; vertical-align: -2px; border-radius: 2px; background: var(--accent-from); animation: blink 1s infinite; }

@media (min-width: 720px) {
  .thread { padding-top: 28px; }
  .bub { padding: 16px 20px; }
  .composer { padding-bottom: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .chat .m, .cont, .followups.gone { animation: none; }
  .dots i, .answer .stream-end::after { animation: none; opacity: .6; }
}
::selection { background: color-mix(in srgb, var(--accent-from) 25%, transparent); }

.hdr { padding-inline: max(14px, calc((100% - 720px) / 2)); }
/* topics */
.topics { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.topics a { display: inline-flex; align-items: center; min-height: 34px; padding: 0 14px; border-radius: var(--radius-pill); border: 1px solid var(--card-border); color: var(--fg); text-decoration: none; font-size: 14px; transition: border-color .2s var(--ease-out), background-color .2s var(--ease-out); }
.topics a:hover { border-color: var(--inp-border-focus); background: var(--lang-bg); }
.topics a[aria-current] { background: linear-gradient(135deg, var(--accent-from), var(--accent-to)); color: var(--on-accent); border-color: transparent; }
.topics small { margin-left: 6px; color: inherit; opacity: .6; font-size: 12px; }
.intro-bub { margin-bottom: 20px; }
