/* Lazy archive additions use the existing Fathers Library visual language. */
.tb-archive-era-head { margin-top: 2.8rem; }

.tb-archive-author-card::before,
.tb-archive-work-card::before {
  content: "LIBRARY";
  display: block;
  width: max-content;
  margin-bottom: .7rem;
  color: var(--gold, #c9a24d);
  font-family: var(--cinzel, serif);
  font-size: .54rem;
  letter-spacing: .18em;
}

.tb-archive-work-divider {
  grid-column: 1 / -1;
  margin: 1.1rem 0 .15rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(201, 162, 77, .25);
  color: var(--gold-dim, #a07d35);
  font-family: var(--cinzel, serif);
  font-size: .68rem;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.tb-archive-loading,
.tb-archive-error {
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .7rem;
  padding: 2rem;
  color: var(--text-dim, #aaa18c);
  text-align: center;
}

.tb-archive-loading strong,
.tb-archive-error strong {
  color: var(--cream, #ece4d2);
  font-family: var(--fell, Georgia, serif);
  font-size: 1.25rem;
  font-weight: 400;
}

.tb-archive-loading small { color: var(--text-faint, #6e6657); }

.tb-archive-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid rgba(201, 162, 77, .18);
  border-top-color: var(--gold, #c9a24d);
  border-radius: 50%;
  animation: tb-archive-spin .8s linear infinite;
}

@keyframes tb-archive-spin { to { transform: rotate(360deg); } }

.tb-archive-index-active {
  color: var(--gold, #c9a24d) !important;
  border-left-color: var(--gold, #c9a24d) !important;
}

.tb-archive-source {
  margin: .8rem 0 1.25rem;
  color: var(--text-faint, #6e6657);
  font-size: .72rem;
  overflow-wrap: anywhere;
}

.tb-archive-text p {
  margin: 0 0 1.15em;
}

.tb-archive-text p:first-child::first-letter {
  float: left;
  margin: .1em .13em 0 0;
  color: var(--gold, #c9a24d);
  font-family: var(--fell, "IM Fell English", Georgia, serif);
  font-size: 3.35em;
  line-height: .72;
}

.tb-archive-load-more {
  display: block;
  width: min(100%, 580px);
  margin: 1.5rem auto .5rem;
  padding: .9rem 1.1rem;
  border: 1px solid rgba(201, 162, 77, .34);
  border-radius: 999px;
  color: var(--gold, #c9a24d);
  background: rgba(201, 162, 77, .06);
  font-family: var(--cinzel, serif);
  font-size: .66rem;
  letter-spacing: .07em;
  cursor: pointer;
}

.tb-archive-load-more:hover,
.tb-archive-load-more:focus-visible {
  color: #080808;
  background: var(--gold, #c9a24d);
  outline: none;
}

/* ---- headings inside the text ------------------------------------------- */

.tb-archive-heading {
  scroll-margin-top: 92px;
  margin: 2.2rem 0 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(201, 162, 77, .16);
  font-weight: 400;
}

.tb-archive-text > .tb-archive-heading:first-child {
  margin-top: .2rem;
  padding-top: 0;
  border-top: 0;
}

.tb-archive-heading-badge {
  display: block;
  color: var(--gold-dim, #a07d35);
  font-family: var(--cinzel, serif);
  font-size: .64rem;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.tb-archive-heading-title {
  display: block;
  margin-top: .25rem;
  color: var(--gold, #c9a24d);
  font-family: var(--fell, "IM Fell English", Georgia, serif);
  font-size: 1.32rem;
  line-height: 1.3;
}

.tb-archive-heading-level-0 .tb-archive-heading-title { font-size: 1.5rem; }

.tb-archive-heading-level-1 {
  margin-left: .9rem;
  border-top-style: dotted;
}

.tb-archive-heading-back {
  float: right;
  margin: -1.6rem 0 0;
  color: var(--text-faint, #6e6657);
  font-family: var(--cinzel, serif);
  font-size: .55rem;
  letter-spacing: .12em;
  text-decoration: none;
  text-transform: uppercase;
}

.tb-archive-heading-back:hover { color: var(--gold, #c9a24d); }

/* The drop capital belongs to the opening of the text, not to the paragraph
   that happens to follow a chapter heading. */
.tb-archive-text .tb-archive-heading + p::first-letter {
  float: none;
  margin: 0;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* ---- divisions in the sidebar index ------------------------------------- */

.tb-archive-subindex {
  margin: 0 0 .35rem;
  padding-left: .7rem;
  border-left: 1px solid rgba(201, 162, 77, .22);
}

.tb-archive-subindex-link {
  display: block;
  padding: .34rem 0 !important;
  border-bottom: 1px solid rgba(255, 255, 255, .035) !important;
}

.tb-archive-subindex-link span { font-size: .6rem !important; }
.tb-archive-subindex-link small { font-size: .74rem !important; }

.tb-archive-subindex-more {
  padding: .4rem 0;
  color: var(--text-faint, #6e6657);
  font-size: .74rem;
  font-style: italic;
  line-height: 1.4;
}

@media (max-width: 720px) {
  .tb-archive-source { font-size: .64rem; }
  .tb-archive-work-divider { font-size: .6rem; }
  .tb-archive-heading-title { font-size: 1.18rem; }
  .tb-archive-heading-level-0 .tb-archive-heading-title { font-size: 1.3rem; }
  .tb-archive-heading-back { float: none; display: block; margin: .35rem 0 0; }
}

/* ---- read aloud (tb-fathers-audio.js) ----------------------------------- */

/* Both shapes the library renders get the same target: the archive's <p>
   paragraphs and the spans wrapped around the hand-curated pre-line runs. */
.tb-fa-passage {
  cursor: pointer;
  border-radius: 2px;
  transition: background .18s ease, box-shadow .18s ease;
}

.tb-fa-passage:hover {
  background: rgba(201, 162, 77, .05);
}

.tb-fa-speaking,
.tb-fa-speaking:hover {
  background: rgba(201, 162, 77, .12);
  box-shadow: 0 0 0 .35rem rgba(201, 162, 77, .12);
}

.tb-fa-listen {
  margin-left: auto;
}

.tb-fa-btn {
  background: transparent;
  color: var(--gold, #C9A24D);
  border: 1px solid rgba(201, 162, 77, .38);
  padding: .32rem .62rem;
  font-family: var(--cinzel, 'Cinzel', serif);
  font-size: .64rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  line-height: 1.5;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}

.tb-fa-btn:hover {
  background: rgba(201, 162, 77, .12);
  border-color: rgba(201, 162, 77, .7);
  color: #fff0bf;
}

.tb-fa-bar {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  z-index: 70;
  transform: translateX(-50%);
  display: flex;
  gap: .5rem;
  align-items: center;
  max-width: min(96vw, 880px);
  padding: .6rem .8rem;
  background: rgba(8, 8, 8, .97);
  border: 1px solid var(--gold-border, rgba(201, 162, 77, .2));
  box-shadow: 0 .6rem 2rem rgba(0, 0, 0, .6);
  backdrop-filter: blur(10px);
}

.tb-fa-bar[hidden] { display: none; }

.tb-fa-bar .tb-fa-toggle {
  min-width: 2.6rem;
  font-size: .82rem;
}

.tb-fa-label {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text-dim, #aaa18c);
  font-family: var(--cinzel, 'Cinzel', serif);
  font-size: .62rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tb-fa-bar-error .tb-fa-label {
  color: #e2a0a0;
  text-transform: none;
  letter-spacing: .04em;
}

.tb-fa-select {
  background: #050505;
  color: var(--text, #eee7d9);
  border: 1px solid var(--gold-border, rgba(201, 162, 77, .2));
  padding: .3rem .35rem;
  font-family: var(--crimson, 'Crimson Text', serif);
  font-size: .82rem;
  outline: none;
}

/* The page floats its own font-size pill in the bottom-right corner; while the
   bar is up the pill is lifted clear of it, so neither control covers the
   other at any width. */
body.tb-fa-active .fathers-reader-controls {
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + var(--tb-fa-bar-height, 64px) + .6rem);
}

@media (max-width: 720px) {
  .tb-fa-bar {
    left: .5rem;
    right: .5rem;
    bottom: .5rem;
    transform: none;
    max-width: none;
    flex-wrap: wrap;
    gap: .4rem;
  }
  .tb-fa-label {
    order: 5;
    flex-basis: 100%;
    white-space: normal;
  }
  /* The drawer covers the page on this layout, so the bar stays out of it. */
  body.tb-nav-locked .tb-fa-bar { display: none; }
}
