:root {
  --header-bg: #f3f1ee;
  --panel-bg: #e9eeee;
  --bar-bg: #dce5e3;
  --border: #c9cfcd;
  --accent: #007d78;
  --accent-dark: #005f5b;
  --nav-accent: #4169a1;
  --nav-accent-hover: #003f8f;
  --term-color: #52666d;
  --text: #171717;
  --muted: #626a68;
  --page-width: 88rem;
  --sidebar-width: 24rem;
}

* { box-sizing: border-box; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html { color-scheme: light; }

body {
  margin: 0;
  color: var(--text);
  background: #fff;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.55;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.site {
  width: min(100%, var(--page-width));
  min-height: 100vh;
  margin-inline: auto;
  background: #fff;
}

.site-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .65rem;
  min-height: 4.5rem;
  padding: .45rem .75rem;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
}

.menu-button,
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 2.7rem;
  height: 2.7rem;
  padding: 0;
  color: var(--accent-dark);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: .45rem;
}

.brand {
  min-width: 0;
  line-height: 1.1;
}

.brand-title {
  display: block;
  overflow: hidden;
  font-size: clamp(1.1rem, 5vw, 1.75rem);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-subtitle {
  display: block;
  margin-top: .2rem;
  color: var(--muted);
  /*font-family: Georgia, "Times New Roman", serif;*/
  font-family: "Noto Serif", Georgia, serif;
  font-size: 1rem;
  font-style: italic;
}

.portrait {
  display: none;
  width: 5rem;
  height: 5rem;
  object-fit: cover;
  background: #dedbd5;
  border: 1px solid var(--border);
}

.search {
  grid-column: 1 / -1;
  display: flex;
  min-width: 0;
  height: 2.55rem;
  background: #fff;
  border: 2px solid #b8bfd0;
  border-radius: .7rem;
  overflow: hidden;
}

.search select {
  max-width: 8rem;
  padding-inline: .55rem;
  background: #f8f8f8;
  border: 0;
  border-right: 1px solid var(--border);
  outline: none;
}

.search input {
  min-width: 0;
  flex: 1;
  padding: .4rem .65rem;
  border: 0;
  outline: 0;
}

.search button {
  display: grid;
  place-items: center;
  width: 2.7rem;
  padding: 0;
  color: #111;
  background: transparent;
  border: 0;
}

.layout { min-height: calc(100vh - 7.05rem); }

.menu-panel {
  position: fixed;
  z-index: 20;
  inset: 0 auto 0 0;
  width: min(88vw, var(--sidebar-width));
  padding: .8rem .6rem 2rem;
  overflow-y: auto;
  background: var(--panel-bg);
  border-right: 1px solid var(--border);
  box-shadow: .4rem 0 1.2rem rgb(0 0 0 / .18);
  transform: translateX(-105%);
  transition: transform .2s ease;
}

.menu-panel.open { transform: translateX(0); }

.menu-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 .65rem;
  padding: 0 .25rem;
  font-size: 1rem;
}

.menu-tree,
.menu-tree ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.menu-tree ul { padding-left: 1.35rem; }
.menu-tree li { margin: .08rem 0; }

.tree-row {
  display: flex;
  align-items: flex-start;
  gap: .4rem;
  min-height: 1.8rem;
}

.tree-toggle {
  flex: 0 0 1.25rem;
  width: 1.25rem;
  height: 1.65rem;
  padding: 0;
  color: #315c9c;
  background: transparent;
  border: 0;
}

.tree-toggle::before {
  display: inline-block;
  content: "▶";
  font-size: .72rem;
  transition: transform .15s ease;
}

.tree-toggle[aria-expanded="true"]::before { transform: rotate(90deg); }

.tree-link {
  padding: .12rem 0;
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.tree-link:hover,
.tree-link:focus-visible { color: var(--accent-dark); text-decoration: underline; }

.leaf::before {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  margin: 0.6rem 0.4rem 0;
  border: 1.7px solid #2b57bd;
  border-radius: 50%;
  background-color: #cbd9f3;
  box-sizing: border-box;
  content: "";
  align-self: flex-start;
}

[hidden] { display: none !important; }

.overlay {
  position: fixed;
  z-index: 10;
  inset: 0;
  background: rgb(0 0 0 / .35);
}

.content { min-width: 0; }

.reader-bar {
  display: flex;
  align-items: center;
  min-height: 2.45rem;
  background: var(--bar-bg);
  border-bottom: 1px solid var(--border);
}

.reader-nav {
    display: flex;
    flex: 0 0 auto;
    gap: 0;
    padding-inline: 0.35rem;
}

.reader-nav button {
  display: grid;
  place-items: center;
  padding: 0.15rem 0.1rem;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.reader-nav svg {
  width: 1.35rem;
  height: 1.35rem;
  fill: none;
  stroke: var(--nav-accent);
  stroke-width: 3.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.15s ease;
}

.reader-nav button:disabled {
  opacity: 0.35;
  cursor: default;
}

.reader-nav button:not(:disabled):hover svg {
  stroke: var(--nav-accent-hover);
}

.breadcrumb {
  min-width: 0;
  padding: .45rem .65rem;
  overflow: hidden;
  font-size: .82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader {
  max-width: 60rem;      /* 960px */
  padding: 1rem clamp(1rem, 4vw, 2.6rem) 3rem;
}

.reader h1 {
  margin: 0 0 .65rem;
  /*font-family: Georgia, "Times New Roman", serif;*/
  font-family: "Noto Serif", Georgia, serif;
  font-size: clamp(1.7rem, 7vw, 2.55rem);
  line-height: 1.15;
}

.reader h2 {
    margin: 1.5rem 0 0.35rem;
    font-size: 1.15rem;
}

.verse-number {
  color: var(--accent-dark);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.synonyms strong { 
  color: var(--term-color);
}

.synonyms a { text-decoration: none; }
.synonyms a:hover,
.synonyms a:focus-visible { text-decoration: underline; }

.synonyms strong.synonym-highlight {
  color: var(--term-color);
  background: #ffe066;
  border-radius: .2rem;
  padding: .1rem .15rem;
}

.purport {
  /*font-family: Georgia, "Times New Roman", serif;*/
  font-family: "Noto Serif", Georgia, serif;
  font-size: 1.06rem;
  text-align: justify;
}

.bottom-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.bottom-nav a { color: var(--accent-dark); font-weight: 700; text-decoration: none; }

@media (min-width: 60rem) {
  .site {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .site-header,
  .construction-notice {
    flex: 0 0 auto;
  }

  .site-header {
    grid-template-columns: auto minmax(15rem, 1fr) minmax(18rem, 25rem);
    padding: .25rem .55rem;
  }

  .menu-button { display: none; }
  .portrait { display: block; }
  .search { grid-column: auto; }

  .layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  .menu-panel {
    position: static;
    width: auto;
    min-height: 0;
    overflow-y: auto;
    box-shadow: none;
    transform: none;
  }

  .content {
    min-height: 0;
    overflow-y: auto;
  }

  .reader-bar {
    position: sticky;
    z-index: 5;
    top: 0;
  }

  .menu-heading,
  .overlay {
    display: none !important;
  }

  .reader {
    padding-top: 1.35rem;
  }

  .bottom-nav {
    display: none;
  }
}

/* check later */

.reader h1.verse-heading {
  margin-bottom: 0.5rem;
  font-size: 1.65rem;
  line-height: 1.25;
}

.verse-reference {
  color: var(--nav-accent);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: normal;
}

.chapter-reference {
  font-size: 0.75em;
  font-weight: normal;
  color: dimgrey;
}

.original {
  margin: 0.1rem 0 0;
  font-size: 1.2rem;
  font-weight: bold;
  line-height: 1.35;
  text-align: center;
  white-space: pre-line;
}

.transliteration {
  margin-top: 0;
  margin-bottom: 1.2rem;
  font-family: "Noto Serif", Georgia, serif;
  font-style: italic;
  text-align: center;
  white-space: pre-line;
  line-height: normal;
}

.translation {
  margin: 0 0 1.2rem;
  /*font-family: Georgia, "Times New Roman", serif;*/
  font-family: "Noto Serif", Georgia, serif;
  font-size: 1.06rem;
  text-align: left;
}

.synonyms {
  margin-top: 0;
}

.construction-notice {
  padding: .3rem .75rem;
  color: #6b4d00;
  background: #fff3c4;
  border-bottom: 1px solid #dccb89;
  font-size: .9rem;
  font-weight: 700;
  text-align: center;
}

article > h2 {
  color: #315f9b;
  text-align: center;
}

/***/
.portal-list {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.portal-list li {
  margin: .15rem 0;
}

.portal-list a {
  display: block;
  padding: .45rem .5rem;
  color: var(--nav-accent);
  font-weight: 700;
  text-decoration: none;
  border-radius: .25rem;
}

.portal-list a:hover,
.portal-list a:focus-visible {
  color: var(--nav-accent-hover);
  background: var(--bar-bg);
}

.reader h1.portal-heading {
  color: var(--nav-accent);
  font-size: 1.65rem;
  line-height: 1.25;
}
/***/

.chapter-header {
  margin-bottom: 2rem;
  color: var(--nav-accent);
  text-align: center;
}

.chapter-number {
  margin-bottom: .4rem;
  font-family: "Noto Serif", Georgia, serif;
  font-size: 1.5rem;
}

.reader h1.chapter-title {
  margin: 0;
  color: inherit;
  font-size: 2rem;
  line-height: 1.25;
}

.chapter-text {
  margin-bottom: 1rem;
  font-family: "Noto Serif", Georgia, serif;
  font-size: 1.06rem;
  line-height: 1.8;
}

.chapter-text a {
  font-weight: 700;
  text-decoration: none;
}

.chapter-text a:hover,
.chapter-text a:focus-visible {
  text-decoration: underline;
}

.chapter-translation {
  margin-left: .25rem;
}

.quoted_verse {
  margin-top: 0.1in;
  margin-bottom: 0.1in;
  font-family: "Noto Serif", serif;
  font-size: 14pt;
  font-style: italic;
  text-align: center;
}

.book-index {
  columns: 2;
  column-gap: 2rem;
}

.index-entry {
  break-inside: avoid;
  margin-bottom: .5rem;
}

.index-subentry {
  margin-left: 1.5rem;
}

@media (max-width: 700px) {
  .book-index {
    columns: 1;
  }
}

body.loading,
body.loading * {
  cursor: wait !important;
}

.index-search {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem;
  margin: 1.3rem 0;
}

/* Search extends the existing index form without changing other index pages. */
.search-form .index-search { margin: .8rem 0; }
.search-options { font-size: .9rem; }
.search-proximity { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.search-proximity[hidden] { display: none; }
.search-proximity input[type="number"] { flex: 0 0 5rem; width: 5rem; }
.search-check { display: inline-flex; align-items: center; gap: .4rem; }
.index-search .search-check input { flex: none; min-height: 0; width: auto; }
.search-more summary { cursor: pointer; color: var(--nav-accent); }
.search-help { font-size: .85rem; margin: .6rem 0 1rem; }

.index-search input { flex: 1 1 12rem; min-width: 0; }
.index-search input,
.index-search select {
  min-height: 2.6rem;
  padding: .45rem .65rem;
  color: var(--text);
  background: #fff;
  border: 1px solid #b9c5d3;
  border-radius: .35rem;
}
.index-search input:focus,
.index-search select:focus {
  border-color: var(--nav-accent);
}
.index-search button,
.index-pages button,
.index-back {
  min-height: 2.6rem;
  padding: .45rem .8rem;
  border: 1px solid #b9c5d3;
  border-radius: .35rem;
  background: #fff;
  color: var(--nav-accent);
  font-weight: 600;
  line-height: 1.4;
  transition: background-color .15s, border-color .15s, color .15s;
}
.index-search button:hover:not(:disabled),
.index-pages button:hover:not(:disabled),
.index-back:hover:not(:disabled) {
  background: #edf3fb;
  border-color: var(--nav-accent);
  color: var(--nav-accent-hover);
}
.index-search button[type="submit"] {
  background: var(--nav-accent);
  border-color: var(--nav-accent);
  color: #fff;
  padding-inline: 1rem;
}
.index-search button[type="submit"]:hover:not(:disabled) {
  background: var(--nav-accent-hover);
  border-color: var(--nav-accent-hover);
  color: #fff;
}
.index-search :is(input, select, button):focus-visible,
.index-pages button:focus-visible,
.index-back:focus-visible,
.index-hierarchy button:focus-visible {
  outline: 1px solid var(--nav-accent);
  outline-offset: 1px;
}

.index-search button { position: relative; }

.index-search button::after {
  content: "";
  position: absolute;
  top: 50%;
  left: calc(100% + .5rem);
  width: .8em;
  height: .8em;
  border: 2px solid var(--nav-accent);
  border-top-color: transparent;
  border-radius: 50%;
  display: none;
}

body.loading .index-search button::after {
  display: block;
  animation: synonym-search-spin .7s linear infinite;
}

@keyframes synonym-search-spin {
  from { transform: translateY(-50%) rotate(0deg); }
  to { transform: translateY(-50%) rotate(360deg); }
}

.index-results {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(11rem, 15rem);
  grid-template-areas: "terms hierarchy";
  gap: 1.5rem;
  align-items: start;
}

.index-hierarchy { grid-area: hierarchy; border: 1px solid var(--border); border-radius: .3rem; overflow: hidden; }
.index-hierarchy h2 { margin: 0; padding: .55rem .7rem; background: #edf3fb; color: #315c9c; text-align: left; }
.index-hierarchy-level { display: block; }
.index-hierarchy > button[data-hierarchy-id] {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  width: 100%;
  padding: .45rem .7rem;
  text-align: left;
  background: #fff;
  border: 0;
}
.index-hierarchy > button[data-hierarchy-id] + button { border-top: 1px solid var(--border); }
.index-hierarchy > button[data-hierarchy-id]:hover,
.index-hierarchy > button[data-hierarchy-id]:focus-visible,
.index-hierarchy > button.is-selected { background: #edf3fb; }
.index-hierarchy > button.is-selected { font-weight: 700; }
.index-hierarchy h2 button {
  display: inline;
  padding: 0;
  text-align: left;
  color: inherit;
  background: transparent;
  border: 0;
  font-weight: inherit;
  text-decoration: underline;
}
.index-results .index-list { grid-area: terms; columns: 2 11rem; margin-top: 0; }

@media (max-width: 40rem) {
  .index-results {
    grid-template-columns: 1fr;
    grid-template-areas: "hierarchy" "terms";
    gap: 1rem;
  }
}

.index-list {
  columns: 3 12rem;
  list-style: none;
  padding: 0;
}

.index-list li { break-inside: avoid; margin: 0 0 .45rem; }
.index-list span { color: var(--muted); }
.index-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem 1rem;
}
.index-heading h1 { margin-bottom: 0; }
.index-controls { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-left: auto; }
.index-pages { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; color: var(--muted); font-size: .9rem; }
.index-pages button { font-size: 1rem; }
.index-pages button { display: inline-flex; align-items: center; gap: .35rem; }
.synonym-meaning { padding: .6rem 0; border-bottom: 1px solid var(--border); }
.synonym-meaning h2 { margin-top: .3rem; font-weight: 400; }
.synonym-locations { display: flex; flex-wrap: wrap; column-gap: 1rem; row-gap: .3rem; }
.index-back { display: inline-flex; align-items: center; gap: .35rem; margin-left: auto; }
.index-back svg,
.index-pages svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 3.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.index-list a,
.synonym-locations a,
.word-location > a {
  color: #551a8b;
}

.search-area {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.header-links {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: 0.35rem;
  font-size: 0.8rem;
}

.header-link-button {
  padding: 0;
  color: #0000ee;
  background: transparent;
  border: 0;
  text-decoration: underline;
}

.authenticated-user {
  color: var(--muted);
}

.search-button {
  font-size: 1.6rem;
  line-height: 1;
}

.login-dialog {
  width: min(90vw, 24rem);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: .45rem;
  box-shadow: 0 .5rem 2rem rgb(0 0 0 / .25);
}

.login-dialog::backdrop {
  background: rgb(0 0 0 / .4);
}

.login-form {
  display: grid;
  gap: .55rem;
  padding: 1.25rem;
}

.login-form h2 {
  margin: 0 0 .4rem;
  color: var(--nav-accent);
  font-size: 1.25rem;
}

.login-form label {
  font-weight: 700;
}

.login-form input {
  width: 100%;
  padding: .5rem .6rem;
  border: 1px solid var(--border);
  border-radius: .3rem;
}

.login-message {
  margin: .25rem 0 0;
  color: #a00000;
}

.login-actions {
  display: flex;
  justify-content: flex-end;
  gap: .6rem;
  margin-top: .65rem;
}

.login-actions button {
  padding: .4rem .8rem;
}

.admin-only {
  display: none;
}

.administrator-authenticated .admin-only {
  display: inline-block;
}

.content-edit-actions {
  margin: .35rem 0 .7rem;
  text-align: right;
}

.content-edit-button {
  margin-left: .35rem;
  padding: .18rem .45rem;
  color: var(--nav-accent);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: .25rem;
  font-size: .75rem;
}

.editor-dialog {
  width: min(94vw, 70rem);
  height: min(90vh, 52rem);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: .45rem;
  box-shadow: 0 .5rem 2rem rgb(0 0 0 / .25);
}

.editor-dialog::backdrop {
  background: rgb(0 0 0 / .4);
}

.editor-form {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  gap: .65rem;
  height: 100%;
  padding: 1rem;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .15rem;
  padding: .2rem;
  background: #eeeeee;
  border: 1px solid var(--border);
}

.editor-toolbar button {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: .2rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: .2rem;
}

.editor-toolbar button:hover,
.editor-toolbar button:focus-visible {
  background: #fff;
  border-color: var(--border);
}

.editor-toolbar img {
  display: block;
  width: 24px;
  height: 24px;
}

.editor-form h2 {
  margin: 0;
  color: var(--nav-accent);
  font-size: 1.25rem;
}

.editor-form textarea {
  width: 100%;
  min-height: 20rem;
  padding: .65rem;
  resize: none;
  font-family: Consolas, "Courier New", monospace;
  font-size: .9rem;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  overflow: auto;
  border: 1px solid var(--border);
}

.editor-message {
  margin: 0;
  color: #a00000;
}

.editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: .6rem;
}

.editor-actions button {
  padding: .4rem .8rem;
}

.zoomable-photo {
  cursor: zoom-in;
}

.photo-viewer {
  position: fixed;
  box-sizing: border-box;
  overflow: hidden;
  max-width: calc(100vw - 2rem);
  max-height: calc(100vh - 2rem);
  padding: 2.5rem 1rem 1rem;
  border: 0;
  border-radius: 8px;
  background: #fff;
}

.photo-viewer::backdrop {
  background: rgb(0 0 0 / 80%);
}

.photo-viewer img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 12rem);
  object-fit: contain;
}

.photo-viewer-close {
  position: absolute;
  top: .25rem;
  right: .5rem;
  border: 0;
  background: transparent;
  font-size: 2rem;
  cursor: pointer;
}

.photo-viewer-caption {
  margin: .75rem 0 0;
  text-align: center;
}

.photo-viewer-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .75rem;
}

.photo-viewer-controls[hidden] { display: none; }
.photo-viewer-controls button { padding: .4rem .75rem; }
.photo-viewer-controls .photo-viewer-arrow { font-size: 1.8rem; line-height: 1; padding: .25rem .7rem; }
.photo-viewer-controls button:disabled { opacity: .5; cursor: default; }
.photo-viewer-status { font-size: .9rem; color: var(--muted); }

.index-search select { max-width: 100%; }
.index-pages button:disabled,
.index-back:disabled,
.index-search button:disabled {
  color: #7b8795;
  background: #f5f7fa;
  border-color: #dce2e9;
  cursor: default;
  opacity: 0.7;
}
.index-summary, .word-location-type { color: var(--muted); }
.word-location { padding: .7rem 0; border-bottom: 1px solid var(--border); }
.word-location > a { font-weight: 700; }
.word-location-type { display: inline-block; margin-left: .7rem; font-size: .85rem; }
.word-location p { margin: .4rem 0; }
mark.word-highlight { background: #ffe34d; color: inherit; padding: 0 .08em; }

.index-search .index-find-mode { flex: 0 0 auto; width: auto; }

/* Conversation metadata; transcript typography uses the existing purport rules. */
.reader h1.conversation-heading {
  text-align: center;
}

.conversation-details {
  margin: 0 0 1.5rem;
  color: dimgrey;
  font-size: .9rem;
  text-align: center;
  overflow-wrap: anywhere;
}

.conversation-empty {
  text-align: center;
  font-style: italic;
}

/* Audio recording pages and transcript links. */
.item-audio-links {
  text-align: center;
  margin: -0.5rem 0 1.5rem;
}

.audio-recording {
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
}

.audio-artwork {
  display: block;
  width: 100%;
  height: auto;
  max-height: 65vh;
  object-fit: contain;
  margin: 0 auto 1rem;
}

.audio-player {
  display: block;
  width: 100%;
}

.audio-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  margin: 1rem 0;
}

.audio-playback-error {
  text-align: center;
  color: var(--muted);
}

/* Floating player: stays in the viewport while the transcript scrolls. */
.audio-popup {
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 30;
  width: min(23rem, calc(100vw - 1.5rem));
  max-height: calc(100dvh - 1.5rem);
  overflow-y: auto;
  background: var(--surface, #fff);
  color: var(--text, #222);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  box-shadow: 0 0.5rem 2rem #0003;
}

.audio-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--bar-bg);
}

.audio-popup-close {
  padding: 0.1rem 0.5rem;
  font-size: 1.6rem;
  line-height: 1;
}

.audio-popup-body { padding: 0.75rem; }
.audio-popup-title { margin: 0 0 0.75rem; font-size: 0.95rem; }
.audio-popup-artwork {
  display: block;
  width: 100%;
  max-height: 30vh;
  object-fit: contain;
  margin-bottom: 0.75rem;
}
.audio-popup audio { display: block; width: 100%; }
.audio-popup-status { margin: 0.5rem 0 0; font-size: 0.85rem; }
.audio-popup-status:empty { display: none; }

/* Disciples: alphabet, initiation year and place lists. */
.disciples-table-wrap {
  overflow-x: auto;
}

.disciples-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.disciples-table th,
.disciples-table td {
  padding: .55rem .75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.disciples-table th:first-child,
.disciples-table td:first-child {
  padding-left: 0;
}

/* Photo galleries */
.photo-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
  gap: 1.25rem;
  margin: 1rem 0;
}
.photo-gallery-card, .gallery-photo {
  margin: 0;
  min-width: 0;
  border: 1px solid var(--border);
  background: var(--panel-bg);
}
.photo-gallery-card {
  display: flex;
  flex-direction: column;
  color: var(--accent-dark);
  text-decoration: none;
}
.photo-gallery-card strong, .photo-gallery-card > span { padding: .35rem .75rem; }
.photo-gallery-card img, .gallery-photo img {
  display: block;
  width: 100%;
  height: 12rem;
  object-fit: contain;
  background: var(--header-bg);
}
.photo-gallery-card:hover { border-color: var(--accent); }
.photo-gallery-empty { display: grid; place-items: center; min-height: 12rem; }
.gallery-photo-open { display: block; width: 100%; padding: 0; border: 0; background: transparent; }
.portrait-gallery .gallery-photo img { height: 18rem; }
.gallery-photo figcaption { padding: .65rem .75rem; overflow-wrap: anywhere; }
.gallery-photo figcaption span { display: block; margin-top: .3rem; white-space: pre-line; }
.gallery-toolbar, .gallery-pagination { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; margin: 1rem 0; }
.gallery-toolbar button, .gallery-pagination button { padding: .35rem .75rem; border: 1px solid var(--border); background: var(--bar-bg); color: var(--accent-dark); }
.gallery-pagination button:disabled { opacity: .45; cursor: default; }

/* Video overview and player */
.video-filters { display: flex; flex-wrap: wrap; gap: .8rem; align-items: end; margin-bottom: 1rem; }
.video-filters label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; }
.video-filters input, .video-filters select { max-width: 100%; padding: .4rem; font: inherit; }
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 1.2rem; }
.video-card { display: flex; flex-direction: column; gap: .4rem; padding: .7rem; border: 1px solid #d2dddf; border-radius: .3rem; text-decoration: none; }
.video-card img, .video-no-poster { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #172325; }
.video-no-poster { display: grid; place-items: center; font-size: 2.5rem; color: white; }
.video-card span { font-size: .9rem; }
.video-player { display: block; width: 100%; max-height: 75vh; background: #000; }


.video-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.2rem; margin-top: 1rem; }
.video-subtitle-option { display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; color: #52666a; font-size: .9rem; cursor: pointer; }
.video-subtitle-option input { width: 1rem; height: 1rem; margin: 0; accent-color: #578186; cursor: pointer; }
.video-subtitle-option input:focus-visible { outline: 2px solid #578186; outline-offset: 3px; }
.video-subtitle-status { color: #68777a; font-size: .9rem; }
.video-subtitle-status:empty { display: none; }

/* Cross-reference bars reuse index-controls/index-pages from Text Search. */
.cross-reference-link { text-decoration: underline; text-decoration-style: dotted; text-underline-offset: .15em; }
.cross-reference-range { margin-bottom: 1rem; font-size: .9rem; }
.cross-reference-range a { display: inline-block; margin-right: .5rem; }
