@font-face {
  font-family: "Chaplin CG";
  src: url("/static/fonts/Chaplin%20CG%20Regular.otf") format("opentype");
  font-display: swap;
}

@font-face {
  font-family: "Minuet W01";
  src: url("/static/fonts/Minuet%20W01%20Regular.otf") format("opentype");
  font-display: swap;
}

:root {
  --bg: #fdfcf9;
  --fg: #2b2620;
  --muted: #6b6355;
  --accent: #8a3324;
  --border: #e4ddd0;
  --sidebar-bg: #f5f1e8;
  --highlight: #f6e6a0;
  --link: #0000ee;
  --sidebar-width: 360px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: "Noto Sans", "Noto Sans Devanagari", "Noto Sans Bengali", "Noto Serif Gujarati", system-ui, sans-serif;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.6;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  padding: 0.75rem 0;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
}

.site-header .site-title {
  flex: 1 1 var(--sidebar-width);
  max-width: var(--sidebar-width);
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 1.5rem;
}

.site-header .site-title h1 {
  margin: 0;
  color: var(--fg);
  font-size: 1.25rem;
  font-weight: 700;
  overflow-wrap: break-word;
}

.site-header .site-logo {
  flex-shrink: 0;
}

.menu-toggle {
  display: none;
  flex-shrink: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--fg);
}

.sidebar-backdrop {
  display: none;
}

.header-search {
  flex: 3 1 260px;
  min-width: 260px;
  padding-right: 1.5rem;
}

.search-hint {
  margin-top: 0.3rem;
  margin-left: 1rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.layout {
  flex: 1;
  min-height: 0;
  display: flex;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  height: 100%;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 1rem;
  overflow-y: auto;
}

.sidebar details {
  margin-bottom: 0.4rem;
}

.sidebar summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.25rem 0;
}

.sidebar summary.active {
  font-weight: 800;
  color: var(--accent);
}

.sidebar summary .book-subtitle {
  font-size: 0.8rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--muted);
}

.sidebar ul {
  list-style: none;
  margin: 0.25rem 0 0.5rem 0.75rem;
  padding: 0;
}

.sidebar li {
  margin: 0.15rem 0;
}

.sidebar details a {
  font-size: 0.92rem;
}

.sidebar ul.single-chapter-books {
  list-style: disc;
  margin: 0.5rem 0 0 1rem;
  padding: 0;
}

.sidebar ul.single-chapter-books li {
  margin: 0.15rem 0;
}

/* "Name : Subtitle (dates)" on the title line, then "by Author (year)" on its
   own line below -- the journal-masthead shape, for a stand-alone book. */
.sidebar ul.single-chapter-books li .book-subtitle {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--muted);
}

.sidebar ul.single-chapter-books li .nav-byline {
  display: block;
}

.sidebar a:hover {
  text-decoration: underline;
}

.sidebar details span.active {
  font-size: 0.92rem;
  color: var(--accent);
  font-weight: 700;
}

.sidebar span.active {
  color: var(--accent);
  font-weight: 700;
}

/* Mark the leaf nav item for the page you're on with a trailing ► so the
   current location is obvious even deep in a collapsed tree. */
.sidebar span.active::after {
  content: "\00A0\25BA";
  font-size: 0.7em;
  vertical-align: 0.1em;
}

.sidebar li.book-desc {
  margin: 0 0 0.5rem 0;
  line-height: 1.3;
}

.sidebar li.nav-about a,
.sidebar li.nav-about span.active,
.sidebar p.nav-about a,
.sidebar p.nav-about span.active {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sidebar p.nav-about {
  margin: 0.3rem 0;
}

/* Sidebar nav heading hierarchy. Every grouping label is a real heading so
   the nav has a valid outline: section (h2) > sub-category / journal (h3) >
   journal nested in a sub-group (h4). One scale, consistently decreasing;
   `.sidebar-section h2` (Books, External References) shares the h2 rule. */
.sidebar h2,
.sidebar h3,
.sidebar h4 {
  margin: 0;
  font-weight: 600;
  line-height: 1.2;
  color: var(--muted);
}

.sidebar summary > h2,
.sidebar summary > h3,
.sidebar summary > h4 {
  display: inline;
}

/* Only the four top-level sections (h2) are uppercased; they're also set
   apart from their h3 children by size, weight and a darker ink. h3 and h4
   differ by size on the muted ink. */
.sidebar h2 {
  font-size: 1.25rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg);
}

.sidebar h3 {
  font-size: 1rem;
}

.sidebar h4 {
  font-size: 0.75rem;
}

/* Journals nested in the "R.C. Das" sub-group (h4) are still real content,
   not a deep sub-label: size them like the group's ABOUT link and The
   Pilgrim's issue list rather than shrinking them to the h4 scale. */
.sidebar .journal-group-body summary > h4 {
  font-size: 0.92rem;
}

.sidebar summary.active > h2,
.sidebar summary.active > h3,
.sidebar summary.active > h4 {
  color: var(--accent);
}

/* Author groups: "R.C. Das" (h2) reads as a section header; "Autobiographical
   Writings" / "Missions" (h3) are nested toggles. */
.sidebar details.author-category {
  margin: 0.2rem 0 0.3rem;
}

.sidebar details.author-category .book-subtitle {
  display: block;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--muted);
}

/* A single-chapter book listed directly under an author group (no category
   toggle above it) sits at the same level as a category heading, so give its
   link the h3 size rather than the smaller in-details link size. */
.sidebar li.author-book-h3 > a,
.sidebar li.author-book-h3 > span.active {
  font-size: 1rem;
}

/* A book listed directly at the top of an author group (e.g. Immortal Life)
   reads like a journal masthead: "Name : Subtitle (year)" on one line, with a
   muted provenance parenthetical on its own line below. */
.sidebar li.author-book-h3 .book-subtitle {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--muted);
}

.sidebar li.author-book .nav-note {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
}

/* The Journals section is itself a collapsible group (h2), like the "R.C.
   Das" author group above it. */
.sidebar details.journals {
  margin-bottom: 0.75rem;
}

.sidebar details.journals > .section-body {
  margin: 0.35rem 0 0 0.75rem;
}

/* Journals > "R.C. Das" sub-heading (h3): a labelled grouping of journals,
   with plain-text placeholders for publications not yet transcribed. Its
   body sits on an indented rail so nested journals read as belonging to it.
   Always muted -- it's a label, never the active target. */
.sidebar details.journal-group {
  margin: 0.3rem 0 0.5rem;
}

.sidebar .journal-group-body {
  margin: 0.25rem 0 0 0.35rem;
  padding-left: 0.7rem;
  border-left: 1px solid var(--border);
}

.sidebar p.journal-placeholder {
  margin: 0.3rem 0;
  color: var(--muted);
}

/* Matches the h4 treatment of "The Church of Christ", the transcribed
   journal these placeholders sit beside in the R.C. Das group. */
.sidebar p.journal-placeholder .journal-name {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.2;
}

.sidebar p.journal-placeholder .nav-years {
  display: block;
  font-weight: 400;
  color: #b3b3b3;
}

.sidebar p.journal-placeholder .nav-status {
  display: block;
  font-weight: 400;
}

.sidebar li.book-desc .nav-author,
.sidebar li.book-desc .nav-years,
.sidebar li.book-desc .nav-status {
  display: block;
}

.sidebar span.nav-author {
  font-size: 0.8rem;
  color: var(--muted);
}

.sidebar span.nav-years {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

.sidebar span.nav-date {
  font-size: 0.8rem;
  color: var(--muted);
}

.sidebar span.nav-status {
  font-size: 0.75rem;
  font-style: italic;
  color: #b3b3b3;
}

.sidebar-section {
  margin-bottom: 0.75rem;
}

.sidebar-section > h2 {
  margin: 0 0 0.4rem 0;
}

.sidebar-section.external-refs {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.sidebar-section.external-refs ul {
  list-style: disc;
  margin: 0 0 0 1rem;
  padding: 0;
}

.sidebar-section.external-refs li {
  margin: 0.15rem 0;
}

.main {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.main-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.search-panel {
  display: none;
}

.search-panel.active {
  display: block;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--sidebar-bg);
}

#search-input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
}

#search-count {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.8rem;
}

#search-results {
  margin-top: 0.75rem;
  max-height: 60vh;
  overflow-y: auto;
}

.search-result {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.search-result-body {
  min-width: 0;
  flex: 1;
}

.match-badge {
  flex: 0 0 auto;
  min-width: 1.6rem;
  height: 1.6rem;
  padding: 0 0.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 999px;
  line-height: 1;
}

.search-result a {
  font-weight: 600;
}

.search-result .book-name {
  color: var(--muted);
  font-size: 0.8rem;
}

.search-result .snippet {
  color: var(--fg);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

#load-more {
  display: block;
  margin: 0.75rem auto 0;
  padding: 0.5rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--sidebar-bg);
  color: var(--fg);
  font-size: 0.9rem;
  cursor: pointer;
}

.search-result mark {
  background: var(--highlight);
  padding: 0 2px;
}

mark.search-target {
  background: var(--highlight);
  padding: 0 2px;
}

mark.search-target-current {
  background: var(--accent);
  color: #fff;
}

.match-nav {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.6rem;
  background: var(--sidebar-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--fg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.match-nav button {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1.2;
}

.match-nav button:hover {
  background: var(--sidebar-bg);
}

.content {
  max-width: 46rem;
  margin: 0;
  padding: 1rem 2rem 2rem;
}

h1,
h2,
h3 {
  color: var(--accent);
}

.book-pilgrim>h1 {
  font-family: "Chaplin CG", "SignPainter", "Apple Chancery", cursive;
  font-size: 2.4rem;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.book-church-of-christ>h1 {
  font-family: "Minuet W01", cursive;
  font-weight: 400;
}

/* Hriday Gita is Gujarati verse; render it in a Gujarati serif face. */
.book-hridaygita,
.chapter-hridaygita-tableofcontents {
  font-family: "Noto Serif Gujarati", Georgia, "Times New Roman", serif;
}

.book-hridaygita .line-block {
  margin: 0 0 1rem;
}

/* Immortal Life is an English rendering of Hriday Gita, set as verse. */
.book-immortallife .line-block {
  margin: 0 0 1rem;
}

/* The chapter opens with an English gloss of the Sanskrit chapter title
   ("Bhaktiyog" -> "The Yoga of Devotion"); show it as a muted subtitle tucked
   under the heading, matching the sidebar's book-subtitle. */
.book-immortallife > h1 + p {
  margin-top: -0.6rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.chapter-hridaygita-tableofcontents table {
  border-collapse: collapse;
}

.chapter-hridaygita-tableofcontents th,
.chapter-hridaygita-tableofcontents td {
  padding: 0.2rem 1.5rem 0.2rem 0;
  vertical-align: baseline;
}

.chapter-hridaygita-tableofcontents th {
  border-bottom: 1px solid var(--border);
}

.page-toc {
  margin: 2rem 0;
  font-family: Georgia, "Times New Roman", serif;
}

.page-toc h2 {
  margin: 0 0 0.75rem;
  color: var(--fg);
  font-size: 1.5rem;
}

.page-toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.page-toc li {
  margin: 0.3rem 0;
}

.page-toc .toc-level-3 {
  margin-left: 1rem;
}

.page-toc .toc-level-4 {
  margin-left: 2rem;
}

.page-toc .toc-level-5 {
  margin-left: 3rem;
}

.chapter-pilgrim-tableofcontents,
.chapter-church-of-christ-tableofcontents,
.chapter-itcbulletin-tableofcontents {
  font-family: Georgia, "Times New Roman", serif;
}

.chapter-pilgrim-tableofcontents>h2,
.chapter-church-of-christ-tableofcontents>h2,
.chapter-itcbulletin-tableofcontents>h2 {
  margin: 2rem 0 0.75rem;
  color: var(--fg);
  font-size: 1.35rem;
}

.chapter-pilgrim-tableofcontents ul,
.chapter-church-of-christ-tableofcontents ul,
.chapter-itcbulletin-tableofcontents ul {
  margin: 0.25rem 0 1.75rem;
  padding-left: 1.5rem;
  list-style: none;
}

.chapter-pilgrim-tableofcontents ul ul,
.chapter-church-of-christ-tableofcontents ul ul,
.chapter-itcbulletin-tableofcontents ul ul {
  margin: 0.1rem 0;
}

/* Portrait image floated right with a caption. Two markup forms feed this:
   a hand-written `<figure class="portrait">` in a template, and `{.portrait}`
   in chapter markdown — pandoc wraps that as `<figure><img class="portrait">`
   with the alt text as a `<figcaption>`. */
figure.portrait,
figure:has(> img.portrait) {
  float: right;
  max-width: 260px;
  margin: 0 0 1rem 1.5rem;
  text-align: center;
}

figure.portrait img,
img.portrait {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
}

figure.portrait figcaption,
figure:has(> img.portrait) figcaption {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

/* Centered, not floated — e.g. the Sadhu Sundar Singh photo on the home page. */
figure.portrait-centered {
  float: none;
  max-width: 320px;
  margin: 2rem auto 0;
  clear: both;
}

.lede {
  color: var(--muted);
}

.intro p {
  max-width: 65ch;
}

.issue-metadata {
  width: auto;
  margin: 1rem auto 2rem;
  border-collapse: collapse;
  font-family: Georgia, "Times New Roman", serif;
}

.issue-metadata th,
.issue-metadata td {
  padding: 0.12rem 0.7rem;
  border: 0;
}

.issue-metadata thead tr {
  border-top: 2px solid var(--fg);
  border-bottom: 1px solid var(--fg);
}

.issue-metadata tbody tr:last-child {
  border-bottom: 2px solid var(--fg);
}

/* ITC Bulletin vols. 1-2 carry an extra "Originally" note (masthead table
   column, sidebar nav, and Master TOC heading) recording how the issue was
   numbered before the series was recatalogued as volume-only. */
.originally-note,
.book-itcbulletin .issue-metadata th:nth-child(3),
.book-itcbulletin .issue-metadata td:nth-child(3) {
  color: #c4bdb0;
}

.originally-note {
  font-size: 0.85em;
  font-weight: normal;
}

.breadcrumb {
  flex: 0 0 auto;
  padding: 0.6rem 2rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  font-size: 0.85rem;
  color: var(--muted);
}

article img {
  max-width: 100%;
  height: auto;
}

article video {
  display: block;
  width: 100%;
  max-width: 720px;
  height: auto;
  margin: 1rem auto 2rem;
  border-radius: 4px;
  background: #000;
}

.footnote-ref {
  font-weight: bold;
}

.chapter-pager {
  display: flex;
  justify-content: space-between;
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

.footnotes {
  font-size: 0.85rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  margin-top: 2rem;
  padding-top: 1rem;
}

.footnote-back {
  font-weight: bold;
}

@media (max-width: 800px) {
  .site-header {
    gap: 0.5rem 0.75rem;
    padding: 0.6rem 1rem;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    width: min(85vw, 320px);
    height: 100%;
    max-height: none;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.25);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .main {
    width: 100%;
  }

  .content {
    padding: 0.75rem 1.25rem 1.25rem;
  }

  .breadcrumb {
    padding: 0.6rem 1.25rem;
  }

  figure.portrait,
  figure.portrait-centered,
  figure:has(> img.portrait) {
    float: none;
    max-width: 100%;
    margin: 0 0 1.5rem;
  }
}

/* ---- Feedback widget -------------------------------------------------- */

.feedback-launcher {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 40;
  padding: 0.5rem 1rem;
  font: inherit;
  font-size: 0.9rem;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

.feedback-launcher:hover {
  background: #6f281d;
}

.feedback-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.45);
}

.feedback-overlay[hidden] {
  display: none;
}

.feedback-dialog {
  position: relative;
  width: 100%;
  max-width: 30rem;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.feedback-dialog h2 {
  margin: 0 2rem 0.5rem 0;
  font-size: 1.25rem;
  color: var(--fg);
}

.feedback-intro {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.feedback-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 2rem;
  height: 2rem;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
}

.feedback-form label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg);
}

.feedback-form textarea,
.feedback-form input[type="email"],
.feedback-form select {
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.5rem;
  font: inherit;
  color: var(--fg);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.feedback-form textarea {
  resize: vertical;
}

.feedback-optional {
  font-weight: 400;
  color: var(--muted);
}

.feedback-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.feedback-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.feedback-actions button {
  padding: 0.45rem 1rem;
  font: inherit;
  font-size: 0.9rem;
  border-radius: 4px;
  cursor: pointer;
}

.feedback-cancel {
  color: var(--fg);
  background: none;
  border: 1px solid var(--border);
}

.feedback-submit {
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
}

.feedback-submit:disabled {
  opacity: 0.6;
  cursor: default;
}

.feedback-status {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  min-height: 1.2em;
}

.feedback-status.is-error {
  color: var(--accent);
}

.feedback-status.is-success {
  color: #2e7d32;
}
