/* Scripture Codex: questions beside the open Mûsâr Bible.
   Night indigo and lamplight gold come from the Scripture Codex logo. */
.sca-app {
	--sca-night: #111d3b;
	--sca-night-2: #1b2b52;
	--sca-gold: #c8932e;
	--sca-lamp: #f6dd9c;
	--sca-ink: #1d2433;
	--sca-quiet: #5f6879;
	--sca-rule: #dde2ea;
	--sca-wash: #f2f4f8;
	--sca-page: #ffffff;
	--sca-type: "Courier Prime", "American Typewriter", "Courier New", monospace;
	--sca-serif: "Crimson Pro", "Iowan Old Style", Georgia, serif;
	--sca-read: 20px;
	box-sizing: border-box;
	color: var(--sca-ink);
	font-size: 16px;
	line-height: 1.6;
	margin: 2rem auto;
	max-width: 780px;
}
.sca-app *, .sca-app *::before, .sca-app *::after { box-sizing: border-box; }
.sca-app button { font: inherit; cursor: pointer; }
.sca-app :focus-visible { outline: 2px solid var(--sca-gold); outline-offset: 2px; }

/* With the Bible: break out of the theme's narrow column into an open codex. */
.sca-app.sca-has-bible {
	width: min(1640px, calc(100vw - 32px));
	max-width: none;
	position: relative;
	left: 50%;
	transform: translateX(-50%);
	margin-left: 0;
	margin-right: 0;
	display: grid;
	grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
	height: clamp(620px, 92vh, 1180px);
	margin-bottom: 1.5rem;
	border: 1px solid var(--sca-rule);
	border-radius: 14px;
	overflow: hidden;
	background: var(--sca-page);
	box-shadow: 0 20px 50px -30px rgba(17, 29, 59, .45);
}
.sca-tabs { display: none; }

/* ---------- Questions ---------- */
.sca-ask {
	display: flex;
	flex-direction: column;
	min-height: 0;
	background: var(--sca-wash);
	padding: 1.4rem 1.4rem 1rem;
}
.sca-app:not(.sca-has-bible) .sca-ask { border: 1px solid var(--sca-rule); border-radius: 14px; min-height: 420px; }
.sca-head { padding-bottom: .9rem; border-bottom: 1px solid var(--sca-rule); }
.sca-app .sca-title {
	margin: 0;
	font-family: var(--sca-type);
	font-weight: 700;
	font-size: 1.55rem;
	line-height: 1.2;
	letter-spacing: 0;
	color: var(--sca-night);
}
.sca-sub { margin: .3rem 0 0; color: var(--sca-quiet); font-size: .95rem; }
.sca-log {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: .9rem;
	padding: 1rem .2rem 1rem 0;
	overscroll-behavior: contain;
}
.sca-empty { margin: auto 0; color: var(--sca-quiet); }
.sca-empty p { margin: 0 0 .9rem; max-width: 34em; }
.sca-starters { display: flex; flex-wrap: wrap; gap: .5rem; }
.sca-starter {
	border: 1px solid var(--sca-rule);
	background: var(--sca-page);
	color: var(--sca-ink);
	border-radius: 999px;
	padding: .45rem .9rem;
	font-size: .9rem;
	text-align: left;
}
.sca-starter:hover { border-color: var(--sca-gold); }
.sca-msg { border-radius: 12px; overflow-wrap: anywhere; }
.sca-msg p { margin: 0 0 .75em; }
.sca-msg p:last-child { margin-bottom: 0; }
.sca-msg ul, .sca-msg ol { margin: 0 0 .75em 1.25em; padding: 0; }
.sca-user {
	align-self: flex-end;
	max-width: 85%;
	background: var(--sca-night);
	color: #fff;
	padding: .6rem .95rem;
}
.sca-bot {
	background: var(--sca-page);
	border: 1px solid var(--sca-rule);
	padding: 1rem 1.15rem;
}
.sca-answer { font-family: var(--sca-serif); font-size: 1.12rem; line-height: 1.62; }
.sca-error { border-color: #b4412f; }
.sca-ref {
	color: inherit;
	text-decoration: none;
	border-bottom: 2px solid var(--sca-gold);
	background: linear-gradient(transparent 62%, rgba(246, 221, 156, .55) 0);
	white-space: nowrap;
}
.sca-ref:hover { background: rgba(246, 221, 156, .8); }
.sca-sources { margin-top: .9rem; padding-top: .65rem; border-top: 1px solid var(--sca-rule); font-size: .86rem; color: var(--sca-quiet); }
.sca-sources-h { font-weight: 600; color: var(--sca-ink); margin-bottom: .15rem; }
.sca-sources ul { margin: 0 0 0 1.1em; padding: 0; }
.sca-sources li { margin: .1rem 0; }
.sca-form { display: flex; gap: .5rem; padding-top: .8rem; border-top: 1px solid var(--sca-rule); }
.sca-input {
	flex: 1;
	min-width: 0;
	resize: none;
	padding: .65rem .8rem;
	border: 1px solid #c9d0db;
	border-radius: 10px;
	background: var(--sca-page);
	color: var(--sca-ink);
	font: inherit;
}
.sca-send {
	border: 0;
	border-radius: 10px;
	padding: 0 1.3rem;
	background: var(--sca-night);
	color: #fff;
	font-weight: 600;
}
.sca-send:hover { background: var(--sca-night-2); }
.sca-send:disabled { opacity: .55; cursor: wait; }
.sca-note { margin: .7rem 0 0; font-size: 1.02rem; font-weight: 700; color: var(--sca-night); line-height: 1.4; }
.sca-wait { display: flex; gap: 5px; padding: .35rem 0; margin: 0; }
.sca-wait span { width: 7px; height: 7px; border-radius: 50%; background: var(--sca-gold); animation: sca-b 1.2s infinite ease-in-out; }
.sca-wait span:nth-child(2) { animation-delay: .15s; }
.sca-wait span:nth-child(3) { animation-delay: .3s; }
@keyframes sca-b { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* ---------- The Mûsâr Bible ---------- */
.sca-bible { display: flex; flex-direction: column; min-height: 0; background: var(--sca-page); border-left: 6px solid var(--sca-gold); }
.sca-bible-top {
	background: radial-gradient(120% 140% at 85% 120%, rgba(200, 147, 46, .28), transparent 55%), linear-gradient(160deg, var(--sca-night), var(--sca-night-2));
	color: #e9ecf4;
	padding: 1rem 1.4rem 1.1rem;
}
.sca-bfind { display: flex; gap: .4rem; }
.sca-bfind input {
	flex: 1;
	min-width: 0;
	border: 1px solid rgba(255, 255, 255, .22);
	background: rgba(255, 255, 255, .08);
	color: #fff;
	border-radius: 8px;
	padding: .5rem .75rem;
	font: inherit;
	font-size: .95rem;
}
.sca-bfind input::placeholder { color: #aab3c8; }
.sca-bfind button, .sca-bnav button {
	border: 1px solid rgba(255, 255, 255, .22);
	background: transparent;
	color: #fff;
	border-radius: 8px;
	padding: .45rem .8rem;
	font-size: .9rem;
}
.sca-bfind button:hover, .sca-bnav button:hover { background: rgba(255, 255, 255, .1); }
.sca-bnav button:disabled { opacity: .35; cursor: default; }
.sca-bnav { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .6rem; }
.sca-bnav select {
	border: 1px solid rgba(255, 255, 255, .22);
	background: var(--sca-night);
	color: #fff;
	border-radius: 8px;
	padding: .42rem .5rem;
	font: inherit;
	font-size: .9rem;
	max-width: 11rem;
}
.sca-bsize { margin-left: auto; display: flex; gap: .3rem; }
.sca-app .sca-btitle {
	margin: .95rem 0 0;
	font-family: var(--sca-type);
	font-weight: 700;
	font-size: clamp(1.7rem, 2.6vw, 2.3rem);
	line-height: 1.1;
	letter-spacing: 0;
	color: #fff;
}
.sca-bed { margin: .2rem 0 0; font-size: .85rem; color: var(--sca-lamp); }
.sca-bstatus { padding: 0 1.4rem; font-size: .88rem; color: var(--sca-quiet); }
.sca-bstatus:not(:empty) { padding-top: .7rem; }
.sca-btext {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	padding: 1rem 1.6rem 3rem;
	font-family: var(--sca-serif);
	font-size: var(--sca-read);
	line-height: 1.72;
	overscroll-behavior: contain;
}
.sca-btext:focus { outline: none; }
.sca-btext > * { max-width: 36em; }
.sca-bload { color: var(--sca-quiet); font-family: inherit; }
.sca-bh {
	margin: 1.5rem 0 .6rem;
	padding-left: .8rem;
	border-left: 3px solid var(--sca-gold);
	font-family: var(--sca-serif);
	font-style: italic;
	font-size: .82em;
	line-height: 1.5;
	color: #4a5468;
}
.sca-bh:first-child { margin-top: .4rem; }
.sca-v { margin: 0 0 .35rem; padding: .1rem .45rem; margin-left: -.45rem; border-radius: 6px; transition: background-color 1.2s ease; }
.sca-lit { background: rgba(246, 221, 156, .55); box-shadow: inset 3px 0 0 var(--sca-gold); }
.sca-vn {
	display: inline;
	cursor: pointer;
	margin-right: .3em;
	padding: 0 .1rem;
	vertical-align: super;
	font-family: var(--sca-type);
	font-size: .6em;
	font-weight: 700;
	color: var(--sca-gold);
	line-height: 1;
}
.sca-vn:hover { text-decoration: underline; }
.sca-vtools { display: flex; flex-wrap: wrap; gap: .4rem; margin: .1rem 0 .8rem; font-family: system-ui, sans-serif; }
.sca-vtools button {
	border: 1px solid var(--sca-rule);
	background: var(--sca-wash);
	color: var(--sca-ink);
	border-radius: 999px;
	padding: .3rem .8rem;
	font-size: .8rem;
}
.sca-vtools button:first-child { background: var(--sca-night); border-color: var(--sca-night); color: #fff; }
.sca-hit {
	display: block;
	padding: .6rem 0;
	border-bottom: 1px solid var(--sca-rule);
	color: var(--sca-ink);
	text-decoration: none;
	font-size: .92em;
}
.sca-hit strong { display: block; font-family: var(--sca-type); font-size: .78em; color: var(--sca-night); }
.sca-hit:hover strong { color: var(--sca-gold); }
.sca-hit mark { background: rgba(246, 221, 156, .8); color: inherit; padding: 0 .1em; }

/* Verse preview on hover */
.sca-peek {
	position: fixed;
	z-index: 99999;
	max-width: 360px;
	padding: .75rem .9rem;
	border-radius: 10px;
	background: #111d3b;
	color: #eef1f7;
	font-family: "Crimson Pro", Georgia, serif;
	font-size: 1rem;
	line-height: 1.5;
	box-shadow: 0 14px 30px -12px rgba(0, 0, 0, .5);
	pointer-events: none;
	opacity: 0;
	transform: translateY(4px);
	transition: opacity .15s ease, transform .15s ease;
}
.sca-peek.sca-on { opacity: 1; transform: none; }
.sca-peek strong { display: block; font-family: "Courier Prime", "Courier New", monospace; font-size: .85rem; color: #f6dd9c; margin-bottom: .25rem; }
.sca-peek sup { color: #f6dd9c; font-size: .65em; }

/* ---------- Phones and narrow screens: two tabs ---------- */
@media (max-width: 899px) {
	.sca-app.sca-has-bible {
		display: flex;
		flex-direction: column;
		width: calc(100vw - 16px);
		height: min(92vh, 900px);
		height: min(92svh, 900px);
	}
	.sca-tabs { display: flex; background: var(--sca-night); padding: .35rem; gap: .35rem; }
	.sca-tab {
		flex: 1;
		border: 0;
		border-radius: 9px;
		background: transparent;
		color: #c5cbe0;
		padding: .55rem;
		font-weight: 600;
	}
	.sca-tab[aria-selected="true"] { background: #fff; color: var(--sca-night); }
	.sca-has-bible .sca-ask, .sca-has-bible .sca-bible { flex: 1; min-height: 0; }
	.sca-app[data-view="ask"] .sca-bible, .sca-app[data-view="bible"] .sca-ask { display: none; }
	.sca-bible { border-left: 0; }
	.sca-tabs { border-bottom: 4px solid var(--sca-gold); }
	.sca-ask { padding: 1rem 1rem .8rem; }
	.sca-bible-top { padding: .9rem 1rem 1rem; }
	.sca-btext { padding: .8rem 1.1rem 2.5rem; }
	.sca-bnav select { max-width: 9.5rem; }
	.sca-app .sca-btitle { margin-top: .7rem; }
}
@media (max-width: 520px) {
	.sca-bsize { display: none; }
	.sca-bnav { flex-wrap: nowrap; }
	.sca-bnav select:first-of-type { flex: 1; min-width: 0; }
	.sca-form { flex-direction: column; }
	.sca-send { padding: .65rem; }
	.sca-ref { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
	.sca-v, .sca-peek { transition: none; }
	.sca-wait span { animation: none; opacity: .7; }
}

/* A dark site theme can opt in with the class "is-dark-theme" on <body>. */
body.is-dark-theme .sca-app {
	--sca-ink: #e8ebf2;
	--sca-quiet: #a3abbb;
	--sca-rule: #343b4a;
	--sca-wash: #171c27;
	--sca-page: #1f2430;
}

/* Language menu (automatic translation of the Bible pane) */
.sca-blang { display: flex; align-items: center; gap: .5rem; margin-top: .6rem; font-size: .85rem; color: #c5cbe0; }
.sca-blang .gtranslate_wrapper select, .sca-blang select {
	border: 1px solid rgba(255, 255, 255, .22);
	background: var(--sca-night);
	color: #fff;
	border-radius: 8px;
	padding: .35rem .5rem;
	font: inherit;
	font-size: .88rem;
	max-width: 13rem;
}
.sca-tnote { display: none; margin: .35rem 0 0; font-size: .78rem; color: #c5cbe0; line-height: 1.4; }
html.translated-ltr .sca-tnote, html.translated-rtl .sca-tnote { display: block; }

/* Free search results (no AI) */
.sca-found { padding: 1rem 1.15rem; }
.sca-found-h { font-weight: 600; margin: 0 0 .8rem; }
.sca-hitcard { padding: .75rem 0; border-top: 1px solid var(--sca-rule); }
.sca-hitcard:first-of-type { border-top: 0; padding-top: 0; }
.sca-app .sca-hit-src { margin: 0 0 .3rem; font-family: inherit; font-size: .9rem; font-weight: 600; line-height: 1.4; letter-spacing: 0; color: var(--sca-night); }
.sca-excerpt, .sca-full { font-family: var(--sca-serif); font-size: 1.08rem; line-height: 1.6; }
.sca-excerpt { margin: 0 0 .45rem; }
.sca-excerpt mark { background: rgba(246, 221, 156, .75); color: inherit; padding: 0 .1em; border-radius: 2px; }
.sca-full { margin-top: .4rem; padding-left: .8rem; border-left: 3px solid var(--sca-gold); }
.sca-more { border: 1px solid var(--sca-rule); background: var(--sca-wash); color: var(--sca-ink); border-radius: 999px; padding: .25rem .8rem; font-size: .82rem; }
.sca-more:hover { border-color: var(--sca-gold); }

/* Matching, editorially written question examples in both languages. */
.sca-examples-label { font-weight: 600; color: var(--sca-ink); }
.sca-example-languages { display: flex; gap: .5rem; margin-bottom: .75rem; }
.sca-example-languages button { background: var(--sca-page); color: var(--sca-night); border: 1px solid var(--sca-rule); border-radius: 6px; padding: .35rem .9rem; }
.sca-example-languages button[aria-pressed="true"] { background: var(--sca-night); color: #fff; }
.sca-starters[hidden] { display: none !important; }
.sca-starters { display: grid; grid-template-columns: 1fr; }
.sca-starter { border-radius: 8px; line-height: 1.4; }
.sca-starter:hover { background: var(--sca-wash); color: var(--sca-night); }
