/*
 * Read before writing (the Director, 29 Sep 2026, about 16:57; J249 changed, 30 Sep 2026, about 16:09;
 * js/v21_readlist.js, contract/READ_LIST.md).
 * What Fred checked before writing the job, folded to one line just above the Why. The desk's own tokens, so it follows
 * every theme, dark and High contrast. A source not read is amber: the folded line, its mark and its own line.
 * Nothing moves but the chevron, and that stays still under reduced motion and Calm. No inline styles anywhere.
 */
.rl-wrap { margin-top: 12px; }
details.rl { border-radius: 12px; background: var(--brand-soft); }
details.rl > summary {
  list-style: none; display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 10px;
  border-radius: 12px; cursor: pointer; font-size: .875rem; line-height: 1.3rem; color: var(--ink);
}
details.rl > summary::-webkit-details-marker { display: none; }
details.rl > summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
details.rl > summary > .ico { flex: none; margin-left: auto; color: var(--brand-text); transition: transform var(--t-small) var(--ease-out); }
details.rl[open] > summary > .ico { transform: rotate(180deg); }
.rl-mark { flex: none; display: inline-flex; color: var(--ok); }
.rl-line { flex: 1 1 auto; min-width: 0; display: flex; align-items: baseline; gap: 2px 10px; }
.rl-count { flex: none; font-weight: 700; color: var(--brand-text); white-space: nowrap; }
.rl-flag {
  flex: none; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap;
  color: var(--warn); background: color-mix(in srgb, var(--warn) var(--tint-alpha, 12%), transparent);
}
.rl-sum { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
details.rl[open] .rl-line { flex-wrap: wrap; }
details.rl[open] .rl-sum { flex-basis: 100%; white-space: normal; overflow: visible; }

/* ---------- a source not read ---------- */
details.rl.rl-unread { background: color-mix(in srgb, var(--warn) var(--tint-alpha, 12%), transparent); box-shadow: inset 3px 0 0 var(--warn); }
details.rl.rl-unread .rl-mark, details.rl.rl-unread .rl-count { color: var(--warn); }
details.rl.rl-unread .rl-flag { background: var(--solid); box-shadow: 0 0 0 1px color-mix(in srgb, var(--warn) 45%, transparent); }

/* ---------- the list, in the order it was read ---------- */
.rl-body { padding: 2px 12px 12px 34px; }
.rl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: .875rem; line-height: 1.35rem; }
.rl-row { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; column-gap: 8px; align-items: baseline; }
.rl-tick { display: inline-flex; align-self: center; color: var(--ok); }
.rl-not .rl-tick { color: var(--warn); }
.rl-l { color: var(--ink); overflow-wrap: anywhere; }
.rl-not .rl-l { font-weight: 700; }
.rl-t { color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rl-why {
  grid-column: 2 / -1; margin: 4px 0 2px; padding: 6px 10px; border-radius: 8px; font-weight: 600; color: var(--ink);
  background: color-mix(in srgb, var(--warn) 14%, var(--solid)); box-shadow: inset 3px 0 0 var(--warn); overflow-wrap: anywhere;
}
.rl-why b { color: var(--warn); }
.rl-at { margin: 10px 0 0; font-size: .8125rem; color: var(--ink-3); }

/* ---------- narrow screens, stillness, print ---------- */
@media (max-width: 560px) {
  .rl-line { flex-wrap: wrap; }
  .rl-sum { flex-basis: 100%; }
  .rl-body { padding-left: 12px; }
}
@media (prefers-reduced-motion: reduce) { details.rl > summary > .ico { transition: none; } }
:root[data-calm="on"] details.rl > summary > .ico { transition: none; }
@media print {
  .rl-sum { white-space: normal; overflow: visible; }
  details.rl > summary > .ico { display: none; }
}
/* J201 (29 Sep 2026): the sources read as a row of ticks at the top of the job ("references x tick y tick"),
   wrapping on a narrow screen; each keeps its tick or its amber mark and its time. */
.rl-list { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.rl-row { display: inline-grid; grid-template-columns: 16px auto auto; }
.rl-row.rl-not { flex-basis: 100%; }

/* ---------- J249 changed (30 Sep 2026): the brain's own list, grouped by where it looked ---------- */
.rl-body-g { padding-left: 12px; }
.rl-plan { margin: 0 0 10px; font-size: .875rem; line-height: 1.375rem; color: var(--ink-2); overflow-wrap: anywhere; }
.rl-plan b { color: var(--ink); }
.rl-groups { display: grid; gap: 6px; }
details.rl-g { border-radius: 10px; background: var(--solid); box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 10%, transparent); }
details.rl-g > summary {
  list-style: none; display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 10px;
  border-radius: 10px; cursor: pointer; font-size: .875rem; color: var(--ink);
}
details.rl-g > summary::-webkit-details-marker { display: none; }
details.rl-g > summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
details.rl-g > summary > .ico { flex: none; margin-left: auto; color: var(--brand-text); transition: transform var(--t-small) var(--ease-out); }
details.rl-g[open] > summary > .ico { transform: rotate(180deg); }
.rl-g-where { flex: 0 1 auto; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.rl-g-n {
  flex: none; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--brand-text); background: var(--brand-soft);
}
details.rl-g.rl-g-not { box-shadow: inset 3px 0 0 var(--warn), 0 0 0 1px color-mix(in srgb, var(--warn) 35%, transparent); }
details.rl-g.rl-g-not .rl-g-n { color: var(--warn); background: color-mix(in srgb, var(--warn) var(--tint-alpha, 12%), transparent); }
.rl-g-body { padding: 0 10px 10px 12px; }
.rl-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: .875rem; line-height: 1.35rem; }
.rl-item { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; column-gap: 8px; align-items: baseline; border-radius: 6px; }
.rl-item:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.rl-item.rl-not .rl-tick { color: var(--warn); }
.rl-item.rl-not .rl-l { font-weight: 700; }
.rl-item .rl-l .link { font-weight: 600; text-align: left; overflow-wrap: anywhere; }
.rl-item .rl-l .link:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.rl-note { grid-column: 2 / -1; margin: 2px 0 0; font-size: .8125rem; line-height: 1.25rem; color: var(--ink-3); overflow-wrap: anywhere; }
.rl-note .rl-k { font-weight: 700; color: var(--ink-2); }
.rl-item .rl-why { margin-top: 4px; }
.rl-more { margin-top: 8px; min-height: 32px; font-size: .8125rem; }
.rl-more:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
@media (max-width: 560px) {
  .rl-body-g { padding: 2px 8px 10px; }
  .rl-item { grid-template-columns: 16px minmax(0, 1fr); }
  .rl-item .rl-t { grid-column: 2; }
  .rl-g-body { padding: 0 8px 10px; }
}
@media (prefers-reduced-motion: reduce) { details.rl-g > summary > .ico { transition: none; } }
:root[data-calm="on"] details.rl-g > summary > .ico { transition: none; }
:root[data-theme="high_contrast"] details.rl-g { box-shadow: none; border: 2px solid #000; background: #fff; }
:root[data-theme="high_contrast"] details.rl-g.rl-g-not { box-shadow: inset 4px 0 0 #000; }
:root[data-theme="high_contrast"] .rl-note, :root[data-theme="high_contrast"] .rl-plan { color: #000; }
@media (forced-colors: active) {
  details.rl, details.rl-g { border: 1px solid CanvasText; }
  details.rl-g.rl-g-not, details.rl.rl-unread { border-width: 3px; }
  .rl-g-n, .rl-flag { border: 1px solid CanvasText; }
}
@media print {
  details.rl-g > summary > .ico { display: none; }
  .rl-more { display: none; }
}
