/* Reference table for /manuscript/ and /사본/.
   Served as its own file on purpose: an inline <style> inside markdown is
   rewritten by the build (smartypants turns var(--x) into var(—x) and
   "→" into curly quotes), which silently kills the rest of the sheet. */
/* ── Manuscript reference table ─────────────────────────────────────────
   A 543-row side-by-side of two Greek editions. Everything is scoped under
   .trt so nothing here can leak into the rest of the prose. */
.trt-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .9rem;
  align-items: center;
  margin: 2rem 0 .35rem;
  font-size: .74rem;
  letter-spacing: .02em;
  color: var(--text-muted, #888);
}
.trt-legend .lg { display: inline-flex; align-items: center; gap: .38rem; }
/* Each line is labelled CT or TR in the table, so the key carries the same two
   labels instead of a dash and an arrow. */
.trt-legend .lg::before {
  content: "";
  display: inline-block;
  width: 1.45rem;
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .07em;
  line-height: 1.4;
}
.trt-legend .lg.cr::before { content: "CT"; color: #9d9dab; }
.trt-legend .lg.tr::before { content: "TR"; color: var(--accent-hover, #818cf8); }

.trt-wrap { margin: 0 0 1rem; }

.trt {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
  line-height: 1.62;
}

.trt thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: .5rem .55rem .55rem;
  text-align: left;
  vertical-align: bottom;
  background: var(--bg, #0a0a0a);
  box-shadow: inset 0 -1px 0 var(--border, #222);
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: #9a9aa8;
  white-space: nowrap;
}

.trt .c-ref { width: 8.8rem; }
.trt .c-kind { width: 5.2rem; }
.trt .c-text { width: auto; }
.trt.ko .c-ref { width: 5.4rem; }

/* Book dividers */
.trt tbody.bk tr.book td {
  padding: 2.1rem 0 .6rem;
  border: 0;
  background: none;
}
.trt tbody.bk:first-of-type tr.book td { padding-top: .9rem; }
.trt .bkname {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text, #e8e8e8);
}
.trt .bkcount {
  margin-left: .55rem;
  font-size: .66rem;
  letter-spacing: .1em;
  color: var(--text-muted, #888);
  opacity: .75;
}

/* Rows */
.trt tr.tr td {
  padding: .72rem .55rem .72rem;
  vertical-align: top;
  border-top: 1px solid rgba(255, 255, 255, .075);
}
[data-trt-palette='light'] .trt tr.tr td { border-top: 1px solid rgba(20, 20, 40, .11); }
.trt tr.tr td:first-child { padding-left: 0; }
.trt tr.tr:hover td { background: rgba(99, 102, 241, .055); }
.trt tr.tr:hover td:first-child { box-shadow: inset 2px 0 0 var(--accent, #6366f1); }

.trt .c-ref {
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .01em;
  color: #9d9dab;
  white-space: nowrap;
  transition: color .15s;
  cursor: help;
}
.trt tr.tr:hover .c-ref { color: var(--accent-hover, #818cf8); }

/* Kind pills */
.trt .k {
  display: inline-block;
  padding: .1rem .42rem .13rem;
  border: 1px solid;
  border-radius: 999px;
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .06em;
  line-height: 1.5;
  white-space: nowrap;
}
/* A pill carries the same direction as the marks inside the row: mint where the
   Received Text adds, rose where it drops, quiet grey where wording only moves. */
.k-add, .k-rest { color: #8ee6b4; border-color: rgba(142, 230, 180, .32); background: rgba(142, 230, 180, .07); }
.k-drop, .k-cut { color: #e9a2aa; border-color: rgba(233, 162, 170, .32); background: rgba(233, 162, 170, .07); }
.k-chg, .k-move, .k-mix { color: #a8a8b6; border-color: rgba(168, 168, 182, .28); background: rgba(168, 168, 182, .05); }

/* The two lines. Both carry the same left padding, so the first character of
   the before line sits exactly above the first character of the after line,
   however far either one wraps. */
.trt .ln {
  position: relative;
  display: block;
  padding-left: 1.9rem;
  border-radius: 3px;
}
/* CT / TR in the gutter, so a reader never has to infer which line they are on
   from its shade alone. */
.trt .ln::before {
  position: absolute;
  left: 0;
  top: .14em;
  width: 1.6rem;
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .07em;
  line-height: inherit;
  font-family: var(--font-en, 'Inter', sans-serif);
}
.trt .ln.ct::before { content: "CT"; color: #9d9dab; }
.trt .ln.tr::before { content: "TR"; color: var(--accent-hover, #818cf8); }
.trt .ln.ct { color: #9d9dab; }
.trt .ln.tr { color: var(--text, #e8e8e8); }
[data-trt-palette='light'] .trt .ln.ct { color: #6b6b78; }

/* The bit that changed: bold + underlined, rose on the old reading and mint on
   the new one, so the direction of the change reads at a glance. */
.trt mark.chg {
  background: none;
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}
.trt .ln.ct mark.chg { color: #e9a2aa; background: rgba(233, 162, 170, .1); text-decoration-color: rgba(233, 162, 170, .6); }
.trt .ln.tr mark.chg { color: #8ee6b4; background: rgba(142, 230, 180, .1); text-decoration-color: rgba(142, 230, 180, .6); }
[data-trt-palette='light'] .trt .ln.ct mark.chg { background: rgba(176, 42, 55, .07); }
[data-trt-palette='light'] .trt .ln.tr mark.chg { background: rgba(15, 122, 69, .07); }

.trt .gone {
  font-style: italic;
  opacity: .55;
  letter-spacing: .02em;
}

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

/* ── The hover note ──────────────────────────────────────────────────── */
/* The card is opaque on purpose. A translucent card blurred with
   backdrop-filter was what painted solid white (and unreadable) in Edge on
   Windows, and the arrow below can only match the card when the card is a
   flat colour. The text colour is spelled out rather than inherited, so no
   half-applied theme can leave light text on a light card. */
.trt-tip {
  position: fixed;
  top: 0; left: 0;
  z-index: 60;
  max-width: min(370px, calc(100vw - 1.5rem));
  padding: .78rem .95rem .85rem;
  border: 1px solid rgba(99, 102, 241, .34);
  border-radius: 13px;
  background: #14141b;
  box-shadow: 0 16px 44px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .04);
  color: #e8e8e8;
  font-family: var(--font-en, 'Inter', sans-serif);
  font-size: .82rem;
  line-height: 1.6;
  letter-spacing: 0;
  opacity: 0;
  transform: translateY(5px) scale(.985);
  transition: opacity .14s ease, transform .14s ease;
  pointer-events: none;
}
.trt-tip.on { opacity: 1; transform: none; }
.trt-tip .tref {
  display: block;
  margin-bottom: .3rem;
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent-hover, #818cf8);
}
.trt-tip::after {
  content: "";
  position: absolute;
  left: var(--ax, 50%);
  bottom: -5px;
  width: 8px; height: 8px;
  background: inherit;
  border-right: 1px solid rgba(99, 102, 241, .34);
  border-bottom: 1px solid rgba(99, 102, 241, .34);
  transform: translateX(-50%) rotate(45deg);
}
.trt-tip.below::after {
  bottom: auto;
  top: -5px;
  border: 0;
  border-left: 1px solid rgba(99, 102, 241, .34);
  border-top: 1px solid rgba(99, 102, 241, .34);
}

[data-trt-palette='light'] .trt .ln.ct mark.chg { color: #b02a37; text-decoration-color: rgba(176, 42, 55, .55); }
[data-trt-palette='light'] .trt .ln.tr mark.chg { color: #0f7a45; text-decoration-color: rgba(15, 122, 69, .55); }
/* The light reading of the same card. Keyed on the palette that is really on
   screen (set from the script), not on data-theme, so the card can never come
   out white over a dark page again. */
[data-trt-palette='light'] .trt-tip {
  background: #ffffff;
  border-color: rgba(79, 70, 229, .28);
  box-shadow: 0 16px 44px rgba(20, 20, 40, .16);
  color: #16161d;
}
[data-trt-palette='light'] .trt-tip .tref { color: #3730a3; }
[data-trt-palette='light'] .trt tr.tr:hover td { background: rgba(79, 70, 229, .05); }

/* ── Phones: each row becomes a card, reference and kind on the top line ── */
@media (max-width: 560px) {
  .trt { display: block; font-size: .95rem; }
  .trt thead { display: none; }
  .trt tbody, .trt tbody.bk { display: block; }
  .trt tbody.bk tr.book { display: block; }
  .trt tbody.bk tr.book td { display: block; padding: 1.9rem 0 .2rem; }
  .trt tr.tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "ref kind" "text text";
    gap: .1rem .5rem;
    padding: .85rem 0 .95rem;
    border-top: 1px solid var(--border, #222);
  }
  .trt tr.tr td { display: block; width: auto !important; padding: 0; border: 0; background: none; }
  .trt tr.tr:hover td { background: none; box-shadow: none; }
  .trt .c-ref { grid-area: ref; font-size: .78rem; padding-top: .1rem !important; }
  .trt .c-kind { grid-area: kind; text-align: right; }
  .trt .c-text { grid-area: text; margin-top: .3rem; }
  .trt .ln { padding-left: 1.7rem; }
  .trt .ln::before { width: 1.45rem; }
  /* A card has no columns, so the repeated column headings step out. */
  .trt tr.colhead { display: none; }
}

/* ── The two controls in the legend row ───────────────────────────────
   The order switch shows which reading is printed first and flips it; the
   second button collapses or re-expands every book at once. Both carry their
   words in the markup, so the Korean page needs nothing from this file. */
.trt-btn {
  display: inline-flex;
  align-items: center;
  gap: .32rem;
  margin: 0;
  padding: .15rem .52rem .17rem .42rem;
  border: 1px solid rgba(99, 102, 241, .38);
  border-radius: 999px;
  background: rgba(99, 102, 241, .08);
  color: var(--text, #e8e8e8);
  font-family: inherit;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1.5;
  white-space: nowrap;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background .15s, border-color .15s;
}
.trt-btn:hover { background: rgba(99, 102, 241, .16); border-color: var(--accent, #6366f1); }
.trt-btn:focus-visible { outline: 2px solid var(--accent, #6366f1); outline-offset: 2px; }
.trt-btn[aria-pressed='true'].trt-all { border-color: var(--accent, #6366f1); }

.trt-swap { order: 0; }
.trt-swap .sw-ico { color: var(--accent-hover, #818cf8); font-size: .95em; line-height: 1; }
.trt-swap .sw-ico::before { content: "\21C4"; }
.trt-swap .sw-txt { display: inline-flex; align-items: center; gap: .22rem; }
.trt-swap .sw-ar { color: var(--accent-hover, #818cf8); }
.trt-swap .sw-ar::before { content: "\2192"; }

.trt-all { order: 3; margin-left: auto; }

/* The rows are printed TR first, so the key reads TR first too; flipping the
   switch reorders both. */
.trt-legend .lg.tr { order: 1; }
.trt-legend .lg.cr { order: 2; }
[data-trt-order='ct'] .trt-legend .lg.tr { order: 2; }
[data-trt-order='ct'] .trt-legend .lg.cr { order: 1; }
/* The hover hint is a caption under the key rather than a third chip: with two
   controls on the row it would wrap anyway, and left-aligned under the key it
   reads as a note instead of an orphaned fragment. */
.trt-legend .lg.hint { order: 4; flex-basis: 100%; margin-left: 0; }

/* ── Book headings double as collapse handles ──────────────────────────
   The script turns each heading into a button; without it the table simply
   stays expanded, which is the default state anyway. */
.trt .bkbtn {
  display: inline-flex;
  align-items: baseline;
  gap: .34rem;
  margin: 0;
  padding: .1rem .45rem .12rem 0;
  border: 0;
  border-radius: 6px;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background .15s;
}
.trt .bkbtn:hover { background: rgba(99, 102, 241, .09); }
.trt .bkbtn:hover .bkname { color: var(--accent-hover, #818cf8); }
.trt .bkbtn:focus-visible { outline: 2px solid var(--accent, #6366f1); outline-offset: 1px; }
.trt .bkbtn .bkcount { margin-left: 0; }

.trt .bkc {
  display: inline-block;
  width: .66rem;
  font-size: .8em;
  line-height: 1;
  color: var(--text-muted, #888);
  opacity: .9;
}
.trt .bkc::before { content: "\25BE"; }
.trt .bkbtn[aria-expanded='false'] .bkc::before { content: "\25B8"; }

/* A collapsed book keeps its heading; its verses step out of the flow. */
.trt tbody.bk.collapsed > tr.tr { display: none; }
.trt tbody.bk.collapsed > tr.colhead { display: none; }
.trt tbody.bk.collapsed > tr.book td { padding-bottom: .75rem; }

/* ── Column headings, repeated under every book ────────────────────────
   The script copies the table's own header into each book and then hides the
   original. The headings at the top of the page scroll away after the third
   verse; under a book heading they are always next to the rows they name. */
.trt.heads-per-book thead { display: none; }
.trt tr.colhead td {
  padding: .3rem .55rem .45rem;
  border-top: 1px solid var(--border, #222);
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: #7b7b89;
  white-space: nowrap;
  cursor: default;
}
[data-trt-palette='light'] .trt tr.colhead td { border-top-color: rgba(20, 20, 40, .12); color: #6b6b78; }
.trt tr.colhead td:first-child { padding-left: 0; }
