/* --------------------------------------------------------------------------
   Book search, glossary hovers, people index — v1.13.0
   ----------------------------------------------------------------------- */

/* ---- Term hints (glossary + people) ---- */

.term-hint,
.person-hint {
  border-bottom: 1.5px dotted var(--ink);
  cursor: pointer;
  padding-bottom: 1px;
}

.person-hint {
  border-bottom-color: var(--blue);
}

.term-hint:hover,
.term-hint:focus-visible,
.person-hint:hover,
.person-hint:focus-visible {
  background: rgba(49, 85, 245, 0.08);
  outline: none;
}

/* ---- Shared popover ---- */

.knowledge-popover {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(18, 18, 18, 0.16);
  box-sizing: border-box;
  color: var(--ink);
  max-width: 300px;
  opacity: 0;
  padding: 16px 18px;
  position: fixed;
  transform: translateY(4px);
  transition: opacity 160ms var(--ease-out), transform 160ms var(--ease-out);
  z-index: 60;
}

@media (prefers-reduced-motion: reduce) {
  .knowledge-popover {
    transition: none;
  }
}

.knowledge-popover-visible {
  opacity: 1;
  transform: translateY(0);
}

.knowledge-popover[hidden] {
  display: none;
}

.knowledge-popover-kicker {
  font-family: var(--font-geist-mono);
  font-size: 10px;
  font-variant: small-caps;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.knowledge-popover-body {
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 8px;
}

.knowledge-popover-meta {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 8px;
}

.knowledge-popover-link {
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.knowledge-popover-link:hover {
  text-decoration: underline;
}

@media (max-width: 479px) {
  .knowledge-popover-sheet {
    border-radius: 16px 16px 0 0;
    bottom: 0;
    left: 0;
    max-width: none;
    right: 0;
    top: auto !important;
    transform: translateY(100%);
    width: 100%;
  }

  .knowledge-popover-sheet.knowledge-popover-visible {
    transform: translateY(0);
  }
}

/* ---- Chapter "people in this chapter" line ---- */

.chapter-people {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  margin: 32px 0;
}

.chapter-people a {
  color: var(--ink);
  font-weight: 700;
}

.chapter-people-label {
  color: var(--muted);
}

/* ---- Chapter footer: search the book link ---- */

.chapter-search-link {
  margin-top: 8px;
}

/* ---- Book search (book page) ---- */

.book-search {
  margin-bottom: 40px;
}

.book-search-field {
  align-items: center;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 999px;
  display: flex;
  gap: 10px;
  padding: 14px 20px;
}

.book-search-field input[type="search"] {
  appearance: none;
  background: transparent;
  border: none;
  color: var(--ink);
  flex: 1;
  font-family: inherit;
  font-size: 15px;
  outline: none;
}

.book-search-field input[type="search"]::placeholder {
  color: var(--muted);
}

.book-search-field input::-webkit-search-cancel-button {
  appearance: none;
}

.book-search-results {
  margin-top: 16px;
}

.book-search-count {
  color: var(--muted);
  font-family: var(--font-geist-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  margin: 0 0 12px;
  text-transform: uppercase;
}

.book-search-list {
  display: grid;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.book-search-result a {
  border-top: 1px solid var(--line);
  display: block;
  padding: 14px 4px;
  text-decoration: none;
}

.book-search-result a:hover .book-search-chapter,
.book-search-result a:focus-visible .book-search-chapter {
  color: var(--blue);
}

.book-search-chapter {
  color: var(--ink);
  display: block;
  font-family: var(--font-geist-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.book-search-snippet {
  color: var(--muted);
  display: block;
  font-size: 14px;
  line-height: 1.55;
}

.book-search-snippet mark {
  background: rgba(200, 255, 83, 0.55);
  color: var(--ink);
}

/* ---- People index page ---- */

.people-page {
  background: var(--paper);
  padding: clamp(60px, 8vh, 110px) 3.2vw 120px;
}

.people-hero {
  margin: 0 auto 40px;
  max-width: 720px;
}

.people-count {
  color: var(--muted);
  font-size: 14px;
  margin-top: 12px;
}

.people-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 0 auto 40px;
  max-width: 720px;
}

.people-jump a {
  color: var(--muted);
  font-family: var(--font-geist-mono);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.people-jump a:hover,
.people-jump a:focus-visible {
  color: var(--blue);
}

.people-index-group {
  margin: 0 auto 36px;
  max-width: 720px;
}

.people-index-letter {
  border-bottom: 1px solid var(--ink);
  font-size: 22px;
  margin: 0 0 12px;
  padding-bottom: 8px;
}

.people-index-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.people-index-entry {
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
  scroll-margin-top: 100px;
}

.people-index-name {
  display: block;
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 6px;
}

.people-index-oneliner {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  margin: 0 0 8px;
}

.people-index-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.people-index-chip {
  background: rgba(18, 18, 18, 0.06);
  border-radius: 999px;
  color: var(--ink);
  font-family: var(--font-geist-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  text-decoration: none;
}

.people-index-chip:hover,
.people-index-chip:focus-visible {
  background: var(--blue);
  color: white;
}

@media (max-width: 620px) {
  .people-page {
    padding: 48px 5vw 90px;
  }
}

/* ---- Reading themes (set on <html> by post.hbs) ----
   The popover is appended to <body>, so without these it inherits the
   reading theme's text colour onto a light card. The dotted hint underlines
   and the chapter-people links are --ink, which is invisible on dark. */

.reading-theme-sepia .term-hint,
.reading-theme-sepia .person-hint {
  border-bottom-color: #5a3e1b;
}

.reading-theme-sepia .chapter-people { color: #6b5a3e; }
.reading-theme-sepia .chapter-people a { color: #3b2e1a; }

.reading-theme-sepia .knowledge-popover {
  background: #ede3cc;
  border-color: #c9b89a;
  color: #3b2e1a;
}

.reading-theme-dark .term-hint,
.reading-theme-dark .person-hint {
  border-bottom-color: #a0c0ff;
}

.reading-theme-dark .term-hint:hover,
.reading-theme-dark .term-hint:focus-visible,
.reading-theme-dark .person-hint:hover,
.reading-theme-dark .person-hint:focus-visible {
  background: rgba(160, 192, 255, 0.16);
}

.reading-theme-dark .chapter-people { color: #999; }
.reading-theme-dark .chapter-people a { color: #d8d8d4; }

.reading-theme-dark .knowledge-popover {
  background: #222;
  border-color: #666;
  color: #d8d8d4;
}

.reading-theme-dark .knowledge-popover-meta { color: #999; }
.reading-theme-dark .knowledge-popover-link { color: #a0c0ff; }

/* v1.12.3 — an empty results container must not hold a grid row (and its gap)
   open in the chapter-section aside. */
.book-search-results:empty { display: none; }
