/* design-features.css — styles for the Gwern-style enhancements.
 * Grayscale only (design principle 1). Pairs with js/design-features.js,
 * scripts/inject-abstracts.py, scripts/backlinks.py, and
 * reference-location: margin in _quarto.yml. */

/* ── Sidenotes (Quarto margin footnotes) ─────────────────────────────── */
/* Quarto emits margin notes as .column-margin > div[id^="fn"] (no class). */
.column-margin > div[id^="fn"] {
  font-size: 0.82rem;
  line-height: 1.4;
  color: #444;
}
.column-margin > div[id^="fn"] p { margin-bottom: 0.4rem; }
/* Quarto collapses margin content inline below the wide breakpoint; give
   the inlined notes a quiet, clearly-secondary look there. */
@media (max-width: 991.98px) {
  .column-margin > div[id^="fn"] {
    border-left: 2px solid #ccc;
    padding-left: 0.6rem;
    margin: 0.5rem 0 0.9rem;
  }
}

/* ── Abstract previews ───────────────────────────────────────────────── */
.references details.csl-abstract {
  margin: 0.25rem 0 0.5rem 0;
  font-size: 0.85em;
  color: #444;
}
.references details.csl-abstract > summary {
  cursor: pointer;
  color: #666;
  font-variant: small-caps;
  letter-spacing: 0.04em;
  list-style-position: inside;
}
.references details.csl-abstract > p { margin: 0.3rem 0 0; }
/* Inside a hover popup (Quarto clones the entry into tippy) */
.tippy-box details.csl-abstract > summary { display: none; }
.tippy-box details.csl-abstract > p {
  margin: 0.5rem 0 0;
  padding-top: 0.5rem;
  border-top: 1px solid #ddd;
  font-size: 0.9em;
  color: inherit;
}

/* ── Contextual backlinks ────────────────────────────────────────────── */
section.backlinks ul { list-style: none; padding-left: 0; }
section.backlinks li { margin-bottom: 0.8rem; }
section.backlinks .backlink-context {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.85em;
  color: #555;
}
section.backlinks .backlink-context mark {
  background: none;
  color: inherit;
  font-weight: 600;
  padding: 0;
}
section.backlinks .backlink-section { color: #777; }

/* ── Sortable tables ─────────────────────────────────────────────────── */
table.ll-sortable th[role="button"] {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
table.ll-sortable th[role="button"]:hover,
table.ll-sortable th[role="button"]:focus-visible {
  text-decoration: underline;
  outline: none;
}
table.ll-sortable th[role="button"]::after {
  content: "\2195"; /* ↕ */
  margin-left: 0.3em;
  font-size: 0.8em;
  opacity: 0.35;
}
table.ll-sortable th[aria-sort="ascending"]::after  { content: "\2191"; opacity: 1; }
table.ll-sortable th[aria-sort="descending"]::after { content: "\2193"; opacity: 1; }

/* Dark theme: keep the grays readable */
[data-bs-theme="dark"] .column-margin > div[id^="fn"],
[data-bs-theme="dark"] .references details.csl-abstract,
[data-bs-theme="dark"] section.backlinks .backlink-context,
body.quarto-dark .column-margin > div[id^="fn"],
body.quarto-dark .references details.csl-abstract,
body.quarto-dark section.backlinks .backlink-context { color: #bbb; }
[data-bs-theme="dark"] .column-margin > div[id^="fn"],
body.quarto-dark .column-margin > div[id^="fn"] { border-color: #555; }
