:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --text: #2b2620;
  --muted: #6f665b;
  --line: #e7dfd3;
  --accent: #b5561c;
  --accent-soft: #fbeee4;
  --alert-bg: #fdf1ee;
  --alert-line: #e9b7a8;
  --serif: "Source Serif 4", Georgia, serif;
  --deva: "Noto Serif Devanagari", "Source Serif 4", serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1916;
    --surface: #24211d;
    --text: #ece5da;
    --muted: #a99f92;
    --line: #3a352e;
    --accent: #e48a4f;
    --accent-soft: #3a2a1f;
    --alert-bg: #3a2420;
    --alert-line: #7a4335;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 18px/1.6 var(--serif); }
.wrap { max-width: 44rem; margin: 0 auto; padding: 2.5rem 1rem 3rem; }
a { color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.brand .deva { font-family: var(--deva); color: var(--accent); font-size: 1.1rem; margin: 0; }
.brand h1 { font-size: 2.2rem; line-height: 1.15; margin: .1rem 0 .6rem; }
.tagline { color: var(--muted); margin: 0 0 1.5rem; }

.ask textarea {
  width: 100%; padding: .8rem .9rem; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; resize: vertical;
}
.ask textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.hint { color: var(--muted); font-size: .85rem; margin: .4rem 0 0; font-family: var(--deva); }
.hint em { font-family: var(--serif); }
.row { display: flex; align-items: center; gap: 1rem; margin-top: .6rem; }
.ask button[type=submit] {
  font: inherit; font-weight: 600; padding: .5rem 1.4rem; border: 0; border-radius: 999px;
  background: var(--accent); color: #fff; cursor: pointer;
}
.htmx-indicator { display: none; color: var(--muted); }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline; }
.examples { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .9rem; }
.examples button {
  font: 15px var(--serif); padding: .25rem .75rem; border-radius: 999px; cursor: pointer;
  background: var(--accent-soft); color: var(--text); border: 1px solid var(--line);
}

#results { margin-top: 2rem; }
.notice { color: var(--muted); }
.crisis { background: var(--alert-bg); border: 1px solid var(--alert-line); border-radius: 10px; padding: .2rem 1rem; margin-bottom: 1.2rem; }

.answer { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .6rem 1.2rem; margin-bottom: 1.8rem; }
.answer .pending { color: var(--muted); font-style: italic; }
.answer .streaming { white-space: pre-wrap; }
.cite {
  display: inline-block; min-width: 1.3em; padding: 0 .3em; margin: 0 .1em; border-radius: 999px;
  font-size: .75em; text-align: center; text-decoration: none; vertical-align: .15em;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--line);
}

.verses { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.verse { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.2rem; }
.verse:target { outline: 2px solid var(--accent); }
.verse-head { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.num {
  display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-size: .85rem; font-weight: 600;
}
.ref { font-weight: 600; }
.speaker { color: var(--muted); font-size: .9rem; }
.sanskrit { font-family: var(--deva); font-size: 1.15rem; line-height: 1.8; margin: .6rem 0 .2rem; }
.iast { color: var(--muted); font-style: italic; font-size: .95rem; margin: 0 0 .6rem; }
.translation p { margin: .1rem 0 0; }
.translation.alt { margin-top: .6rem; color: var(--muted); font-size: .95rem; }
.translation .label { font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.translation[lang=hi] p { font-family: var(--deva); }
.caution { color: var(--muted); font-size: .88rem; border-left: 3px solid var(--line); padding-left: .7rem; margin: .7rem 0 0; }

.more-verses { margin-top: 1.2rem; }
.more-verses summary { cursor: pointer; color: var(--muted); padding: .3rem 0; }
.more-verses[open] summary { margin-bottom: .8rem; }

footer { margin-top: 3rem; color: var(--muted); font-size: .9rem; border-top: 1px solid var(--line); padding-top: 1rem; }
