/* The encyclopedia: a reading room over the stage. The choir book's
   materials - parchment text on stone, rubric red for the kicker, gilt for
   what you can act on - set as a book: a running index at the side, the
   article in a readable measure, the text and its translation as a parallel
   table, the way bilingual liturgical books print them. */
#enc { position: fixed; inset: 0; z-index: 60; background: color-mix(in srgb, var(--nave) 72%, transparent); backdrop-filter: blur(3px);
  display: flex; padding: max(12px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)); }
#enc[hidden] { display: none; }
.encWin { flex: 1; min-width: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); background: var(--stone); border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55); }
.encBar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--stone-2); }
.encBrand { font-family: var(--display); font-size: 19px; font-weight: 700; white-space: nowrap; }
.encBrand em { color: var(--rubric); font-style: normal; }
#encSearch { flex: 1; min-width: 0; max-width: 520px; }
#encClose { margin-left: auto; }
.encGrid { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 0; }
#encNav { overflow-y: auto; border-right: 1px solid var(--line); padding: 12px 10px 24px; display: flex; flex-direction: column; gap: 14px; }
#encNav button { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; width: 100%; text-align: left; background: none; border: 1px solid transparent;
  border-radius: 6px; padding: 4px 8px; font-family: var(--display); font-size: 15px; letter-spacing: 0; }
#encNav button:hover { border-color: var(--line); background: var(--stone-2); }
#encNav button.on { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 14%, var(--stone)); }
#encNav .n { font-family: var(--mono); font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
#encNav .encHome { font-family: var(--label); letter-spacing: 0.06em; font-size: 13px; }
.encFam { display: flex; flex-direction: column; gap: 2px; }
.encFam .label { padding: 0 8px 2px; }
#encMain { overflow-y: auto; padding: 22px clamp(16px, 4vw, 48px) 48px; }

.encHead { max-width: 72ch; margin-bottom: 22px; }
.encHead h2 { font-family: var(--display); font-size: clamp(26px, 3.2vw, 38px); line-height: 1.1; margin: 4px 0 8px; text-wrap: balance; font-weight: 700; }
.encHead .kicker { margin: 0; font-family: var(--label); letter-spacing: 0.08em; font-size: 13px; color: var(--rubric); text-transform: lowercase; }
.encHead .meta { margin: 0; color: var(--dim); font-size: 15px; }
.encHead .lede { font-size: 18px; line-height: 1.5; margin: 12px 0 0; color: var(--vellum); }
.encHead button.link { background: none; border: none; padding: 0; color: var(--rubric); font: inherit; letter-spacing: inherit; text-transform: inherit; text-decoration: underline; text-underline-offset: 3px; }
.encActions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.encGroup { margin-bottom: 26px; }
.encGroup > h3, .encBody h3 { font-family: var(--label); letter-spacing: 0.08em; font-size: 14px; text-transform: lowercase; color: var(--gold); margin: 0 0 10px; font-weight: 700; }
.encCards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 10px; }
.encCard { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 12px 14px; background: var(--stone-2); border: 1px solid var(--line); border-radius: 8px;
  font-family: var(--display); letter-spacing: 0; font-size: 14px; }
.encCard .nm { font-size: 18px; font-weight: 700; }
.encCard .meta { color: var(--dim); font-size: 13px; }
.encCard .sum { line-height: 1.45; }
.encCard .cnt { margin-top: auto; font-family: var(--mono); font-size: 11px; color: var(--gold); }

.encBody { display: grid; grid-template-columns: minmax(0, 68ch) minmax(240px, 360px); gap: 32px; align-items: start; }
.prose { min-width: 0; font-size: 16px; line-height: 1.62; }
.prose p { margin: 0 0 12px; }
.prose h3 { margin-top: 22px; }
.prose ul { margin: 0 0 12px; padding-left: 20px; }
.prose li { margin-bottom: 4px; }
.prose .origin, .prose .source { color: var(--dim); font-size: 14px; }
.prose .label { margin-right: 6px; }
.dim { color: var(--dim); }
.encList { min-width: 0; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; }
.encList .label { margin-top: 10px; }
.encPiece { display: grid; gap: 1px; text-align: left; width: 100%; background: none; border: 1px solid transparent; border-radius: 6px; padding: 6px 8px; font-family: var(--display); letter-spacing: 0; }
.encPiece:hover { border-color: var(--line); background: var(--stone-2); }
.encPiece .t { font-size: 15px; font-weight: 500; }
.encPiece .m { font-size: 12px; color: var(--gold); font-family: var(--label); letter-spacing: 0.04em; }
.encPiece .u { font-size: 13px; color: var(--dim); }
.encPiece .tradTag { font-family: var(--label); font-size: 12px; letter-spacing: 0.06em; color: var(--rubric); text-transform: lowercase; }
.encResults { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 4px 16px; max-width: 1100px; }

.encText { min-width: 0; }
.encText table { width: 100%; border-collapse: collapse; }
.encText td { vertical-align: top; padding: 6px 8px; border-top: 1px solid var(--line); }
.encText tr { cursor: pointer; }
.encText tr:hover td { background: var(--stone-2); }
.encText td.ln { font-size: 15px; width: 52%; }
.encText td.tr { font-size: 14px; color: var(--dim); font-style: italic; }
.encText .hint { color: var(--dim); font-size: 12px; margin-top: 8px; }

@media (max-width: 980px) {
  .encBody { grid-template-columns: minmax(0, 1fr); }
  .encList { position: static; }
}
@media (max-width: 680px) {
  .encGrid { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  #encNav { flex-direction: row; overflow-x: auto; overflow-y: hidden; border-right: none; border-bottom: 1px solid var(--line); padding: 8px 10px; gap: 10px; }
  .encFam { flex-direction: row; align-items: center; }
  .encFam .label { display: none; }
  #encNav button { width: auto; white-space: nowrap; }
  .encBrand em { display: none; }
  .encText td { display: block; width: auto !important; border-top: none; padding: 2px 4px; }
  .encText tr { display: block; border-top: 1px solid var(--line); padding: 4px 0; }
}
