:root {
  --bg:#f4f6f9; --panel:#fff; --ink:#1c2430; --muted:#5c6773; --line:#e2e6ec;
  --accent:#1B365D; --accent-deep:#12233d; --accent2:#487A7B; --warn:#B83A4B;
  --sans: "Nunito Sans", "Source Sans 3", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--sans); color: var(--ink); background: var(--bg); }
/* .landing and .app both declare their own `display` below, which — at equal specificity —
   overrides the browser's default `[hidden] { display: none }` UA rule (author CSS always beats
   UA CSS for normal-weight declarations, regardless of source order). Without this, toggling the
   `hidden` attribute in site.js did nothing and both sections rendered stacked at once. */
[hidden] { display: none !important; }
.brand-logo { width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0; }
.brand-logo-sm { width: 22px; height: 22px; border-radius: 6px; margin-right: .4rem; }

/* Landing */
.landing { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.landing-shell { display: grid; grid-template-columns: 1.1fr 1fr; gap: 2.5rem; max-width: 880px; width: 100%; align-items: center; }
@media (max-width: 720px) { .landing-shell { grid-template-columns: 1fr; } }
.landing-brand { display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; }
.brand-crest { width: 220px; height: auto; margin-bottom: .2rem; }
.landing-lead { font-size: 1.15rem; line-height: 1.5; color: var(--ink); }
.landing-points { list-style: none; padding: 0; margin: 1.2rem 0; display: flex; flex-direction: column; gap: .6rem; }
.landing-points li { display: flex; gap: .6rem; align-items: baseline; }
/* Ported byte-for-byte (colors/padding/hover) from faithbot.tools' .support-button, so the
   donation CTA reads as the same button across both properties. */
.landing-support { margin-top: .4rem; }
.support-button {
  display: inline-block;
  background: #1B365D;
  color: white;
  padding: 16px 40px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 18px;
  transition: all 0.2s;
}
.support-button:hover { background: #142742; transform: translateY(-2px); box-shadow: 0 8px 20px rgba(27, 54, 93, 0.3); }
.support-button:focus { outline: 3px solid #1B365D; outline-offset: 3px; }
.support-button:active { transform: translateY(0); }
.landing-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 1.8rem; }
.landing-panel h2 { margin-top: 0; color: var(--accent-deep); }
.landing-note-sm { color: var(--muted); font-size: .9rem; }
.landing-actions { margin-top: 1rem; }

.btn { font: inherit; font-weight: 700; font-size: .95rem; cursor: pointer; border-radius: 10px; padding: .65rem 1.1rem; border: 1px solid var(--line); background: #fff; color: var(--accent-deep); text-decoration: none; display: inline-block; }
.btn.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.btn-ghost { background: transparent; }
.btn.sm { padding: .35rem .7rem; font-size: .85rem; }
.btn-text { font: inherit; font-size: .9rem; color: var(--muted); background: none; border: none; cursor: pointer; text-decoration: underline; padding: .4rem .2rem; }
.btn-text:hover { color: var(--ink); }

/* Support modal — opened from the sidebar card, not a direct link, so there's room to explain
   the ask before sending someone to IMB's giving page. */
.modal-backdrop { position: fixed; inset: 0; background: rgba(18, 24, 33, .55); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 40; }
.modal-card { position: relative; background: var(--panel); border-radius: 16px; padding: 1.8rem; max-width: 460px; width: 100%; max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(18, 24, 33, .35); }
.modal-card h2 { margin: 0 0 .8rem; color: var(--accent-deep); font-size: 1.3rem; line-height: 1.3; }
.modal-card p { margin: 0 0 .8rem; color: var(--ink); line-height: 1.5; font-size: .95rem; }
.modal-close { position: absolute; top: .7rem; right: .7rem; width: 2rem; height: 2rem; border-radius: 50%; border: none; background: transparent; color: var(--muted); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.modal-close:hover { background: var(--bg); color: var(--ink); }
.modal-actions { display: flex; align-items: center; gap: 1rem; margin-top: .4rem; flex-wrap: wrap; }
.modal-note { margin: .8rem 0 0; color: var(--muted); font-size: .8rem; }

/* App shell — sidebar (past conversations) + main chat, same shape as FaithBot's layout. */
.app { display: flex; height: 100vh; }

.sidebar { width: 260px; flex: none; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.side-top { padding: .9rem .9rem .6rem; border-bottom: 1px solid var(--line); }
.side-top .brand { font-weight: 800; color: var(--accent-deep); display: flex; align-items: center; margin-bottom: .7rem; }
.side-new { width: 100%; text-align: left; }
.side-history { flex: 1; overflow-y: auto; padding: .5rem; }
.side-item { display: block; width: 100%; text-align: left; background: none; border: none; border-radius: 8px; padding: .55rem .6rem; margin-bottom: .15rem; font: inherit; font-size: .88rem; color: var(--ink); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-item:hover { background: var(--bg); }
.side-item.active { background: var(--accent); color: #fff; }
.side-empty { color: var(--muted); font-size: .85rem; padding: .6rem; }
/* Sits just above the account footer, outside the scrollable history list, so it stays visible
   no matter how many past chats there are rather than scrolling away with them. A soft tinted
   card, not another flat ghost button, reads as a different kind of action from New chat/My
   Images above (an invitation, not a nav item) without shouting on every visit. Gradient/border
   use the app's own accent + accent2, so it's clearly BiblePics' own ask, not a bolted-on widget. */
.side-bottom { padding: .6rem .9rem; border-top: 1px solid var(--line); }
.side-support-card {
  display: flex; align-items: center; gap: .55rem; width: 100%; padding: .55rem .7rem;
  border-radius: 12px; text-decoration: none; font-weight: 700; font-size: .88rem;
  color: var(--accent-deep);
  background: linear-gradient(135deg, rgba(72, 122, 123, .12), rgba(27, 54, 93, .05));
  border: 1px solid rgba(72, 122, 123, .28);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.side-support-card:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(27, 54, 93, .14); border-color: var(--accent2); }
.side-support-icon { display: inline-flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem; flex: none; border-radius: 50%; background: var(--accent2); color: #fff; font-size: .78rem; }
.side-foot { padding: .7rem .9rem; border-top: 1px solid var(--line); font-size: .82rem; color: var(--muted); display: flex; align-items: center; justify-content: space-between; gap: .4rem; flex-wrap: wrap; }
.side-foot .email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chat { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-head { display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); background: var(--panel); font-weight: 700; color: var(--accent-deep); }
.chat-head .icon { display: none; background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--accent-deep); }
.transcript { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .7rem; max-width: 760px; width: 100%; margin: 0 auto; }
.gallery { flex: 1; overflow-y: auto; padding: 1rem; max-width: 960px; width: 100%; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .8rem; align-content: start; }
.gallery-empty { grid-column: 1/-1; text-align: center; color: var(--muted); padding: 3rem 1rem; }
.gallery-item { display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--panel); text-decoration: none; color: inherit; transition: transform .1s ease; }
.gallery-item:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,.08); }
.gallery-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.gallery-item .cap { padding: .4rem .5rem; font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Mobile: sidebar becomes an overlay drawer, toggled by the header's ☰ button. */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 15; }
@media (max-width: 760px) {
  .chat-head .icon { display: inline-block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
}
.msg { padding: .65rem .85rem; border-radius: 12px; max-width: 82%; line-height: 1.5; font-size: .95rem; }
.msg.user { background: var(--accent); color: #fff; margin-left: auto; }
.msg.assistant { background: var(--panel); border: 1px solid var(--line); }
.msg img { max-width: 100%; border-radius: 10px; margin-top: .5rem; display: block; }
.msg.error { background: #fdeceb; color: var(--warn); border: 1px solid #f3c7c3; }
.composer { display: flex; gap: .5rem; padding: .8rem 1rem; border-top: 1px solid var(--line); background: var(--panel); max-width: 760px; width: 100%; margin: 0 auto; }
.composer .input { flex: 1; font: inherit; font-size: .95rem; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 10px; resize: none; }
.composer .send { background: var(--accent); color: #fff; border: none; border-radius: 10px; width: 42px; font-size: 1.1rem; cursor: pointer; }
.composer-note { text-align: center; color: var(--muted); font-size: .78rem; margin: 0 0 .7rem; }
.typing { display: flex; align-items: center; gap: .55rem; color: var(--muted); font-style: italic; font-size: .88rem; }
.typing-dots { display: inline-flex; gap: .2rem; }
.typing-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: typing-pulse 1.1s infinite ease-in-out; }
.typing-dots span:nth-child(2) { animation-delay: .18s; }
.typing-dots span:nth-child(3) { animation-delay: .36s; }
@keyframes typing-pulse { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }
