/* Server-rendered pages: /books, /john, /john/3, /john/3/16, /app,
   /privacy, /terms.
 *
 * These are documents, not the reader. They load style.css first for the
 * colour tokens and the light/dark rules, and layout() in app/pages.py
 * carries the same inline theme script the reader has, so a reader who
 * chose Light and follows a link out of the app is not handed a dark
 * page. Then this file lays out prose.
 *
 * Nothing here is shared with the app's own chrome on purpose: the reader
 * is a tool with a toolbar, and a page is a page. */

/* style.css is loaded first, for the colour tokens and for the reader's
 * stored light/dark choice. It also styles BARE elements -- `main`,
 * `header`, `footer`, `nav`, `h1` -- because in the reader those elements
 * ARE the chrome. Here they are the document, so each one is taken back
 * explicitly rather than by hoping the two never collide.
 *
 * The expensive one is `main`: in the reader it is a grid that splits into
 * passage and commentary at 900px, and left alone it cut this page in half
 * down the middle, with the heading in one column and the text in the
 * other. It looked like a broken stylesheet and it was a borrowed one. */
body.page main.page-main {
  display: block;
}

body.page header.page-head {
  position: static;
  background: transparent;
}

body.page nav.verse-nav {
  display: block;
}

body.page {
  background: var(--bg);
  color: var(--text);
  margin: 0;
  font: 16px/1.65 Georgia, "Times New Roman", serif;
}

/* -------------------------------------------------------------- chrome */

.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  max-width: 44rem;
  margin: 0 auto;
  padding: 1.1rem 1rem 0.9rem;
  border-bottom: 1px solid var(--border);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.page-brand {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--text);
  text-decoration: none;
}

.page-open {
  font-size: 0.88rem;
  color: var(--accent);
  text-decoration: none;
}

.page-open:hover,
.page-brand:hover {
  text-decoration: underline;
}

.page-main {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1.4rem 1rem 3rem;
}

.page-foot {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1.2rem 1rem 2.4rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 0.86rem;
}

.page-foot a {
  color: var(--accent);
}

/* ---------------------------------------------------------------- prose */

.page-main h1 {
  font-size: 1.7rem;
  line-height: 1.25;
  margin: 0.2rem 0 0.5rem;
}

.page-main h2 {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  /* More space above than below: a heading belongs to what follows it --
     the same rule the dictionary headings follow in both clients. */
  margin: 2rem 0 0.5rem;
}

.page-main h3 {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 0.98rem;
  margin: 0 0 0.3rem;
}

.page-main p {
  margin: 0 0 0.85rem;
}

.page-main a {
  color: var(--accent);
}

.lede {
  font-size: 1.1rem;
  color: var(--muted);
  margin-bottom: 1.2rem;
}

.updated,
.note {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 0.86rem;
  color: var(--muted);
}

.note {
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 0.8rem 0.9rem;
  margin: 0 0 1.6rem;
}

/* Dark mode makes --accent-soft a pale cream that white text cannot sit on
   and dark text looks pasted onto; keep the note legible by tinting the
   surface instead of the brand colour. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .note {
    background: var(--surface);
    border: 1px solid var(--border);
  }
}

:root[data-theme="dark"] .note {
  background: var(--surface);
  border: 1px solid var(--border);
}

/* ------------------------------------------------------- lists and grids */

.book-grid {
  list-style: none;
  padding: 0;
  margin: 0 0 1.4rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.15rem 1rem;
}

.book-grid li {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
}

.book-grid span {
  color: var(--muted);
  font-size: 0.82rem;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  white-space: nowrap;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.5rem;
}

.chip {
  display: inline-block;
  min-width: 2.1rem;
  text-align: center;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--accent);
  text-decoration: none;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 0.9rem;
}

.chip:hover {
  border-color: var(--accent);
}

.features {
  list-style: none;
  padding: 0;
  margin: 1.6rem 0;
}

.features li {
  padding: 0.9rem 0;
  border-top: 1px solid var(--border);
}

.features p {
  margin: 0;
  color: var(--muted);
}

.promises {
  margin: 0 0 1rem;
  padding-left: 1.1rem;
}

.promises li {
  margin-bottom: 0.3rem;
}

/* --------------------------------------------------------- store buttons */

.stores {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.2rem 0 1.8rem;
}

.store {
  display: inline-block;
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--bg);
  text-decoration: none;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
}

.store:hover {
  opacity: 0.9;
}

/* ------------------------------------------------- the rendered passage */

/* A chapter: the verse number is a link to the verse's own page, which is
   how a crawler reaches all 31,102 of them. */
.chapter {
  list-style: none;
  padding: 0;
  margin: 1.2rem 0 1.6rem;
}

.chapter li {
  margin: 0 0 0.7rem;
  font-size: 1.05rem;
}

.chapter li > a {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 0.72em;
  vertical-align: super;
  text-decoration: none;
  padding-right: 0.15em;
}

/* One verse, on its own page: the thing the page is about, so it is set
   larger than the prose around it rather than quoted inside it. */
blockquote.verse {
  margin: 1rem 0 1.4rem;
  padding: 0 0 0 1rem;
  border-left: 3px solid var(--accent);
  font-size: 1.22rem;
  line-height: 1.55;
}

blockquote.verse cite {
  display: block;
  margin-top: 0.6rem;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 0.82rem;
  font-style: normal;
  color: var(--muted);
}

.verse-nav {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 0.9rem;
  margin-bottom: 1.4rem;
}

/* ------------------------------------------------------------ commentary */

.entry {
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}

.entry h3 {
  color: var(--accent);
  margin-bottom: 0.15rem;
}

.by {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0 0 0.6rem;
}

/* The commentary arrives as plain text with its own paragraph breaks, and
   it is escaped rather than parsed -- Matthew Henry spells things with `<`.
   So the line breaks have to be honoured by CSS instead of by markup. */
.entry .body {
  white-space: pre-wrap;
}

.more {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 0.86rem;
  margin-top: 0.6rem;
}

/* The two wrappers carry no look of their own -- their h2 is already the
   rule that separates them -- only the space that keeps a long page from
   reading as one slab. */
.commentary,
.interlinear {
  margin-top: 2rem;
}

/* ----------------------------------------------------------- interlinear */

.iw-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0;
  margin: 0 0 1rem;
}

.iw-list li {
  min-width: 4.2rem;
  max-width: 9rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

/* Four lines, and all four are the reading -- somebody who cannot read the
   gloss cannot read the word above it either. Same reasoning as the word
   cards in both clients. */
.iw-list b {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  line-height: 1.3;
}

.iw-list i {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
}

.iw-list span {
  display: block;
  font-size: 0.78rem;
}

.iw-list em {
  display: block;
  font-size: 0.7rem;
  font-style: normal;
  color: var(--accent);
}

/* The CC BY credit. It is a licence condition, not a caption -- see
   docs/DATA_SOURCES.md -- so it must stay visible wherever the words are. */
.credit {
  color: var(--muted);
  font-size: 0.82rem;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  border-top: 1px solid var(--border);
  padding-top: 0.8rem;
  margin-top: 1.2rem;
}
