/* ldu/pages-research.css: Daniel's Research section, Horizon scan (horizon_scans/index, show, _development) and Surveys (surveys/index, show).
   Redone with ux-hierarchy (Milan, 13 Nov: "full redo with ux hierarchy"). Its own sheet, clear of pages-work.css (whose old .horizon and
   .devboard rules stay for the Deviation board). Layout only, tokens only (bin/ds-lint); every control is a DS one (.btn, .ldu-table,
   .ldu-dd, .textarea in a .field, .check, .chip, modal_tag), so nothing here paints a button. Nothing lifts on hover.

   Lists are one framed .ldu-table each, the whole row a link (the name's link is stretched over the row); under 720px a row folds into a card.
   A development is a .card: impact and name, when and where from, a summary, the first step; why and the quote behind "Source and reasoning";
   the decision is DS buttons (_decision), never .ldu-seg, which switches views. A survey is a working queue: one answer to check in a card (the AI's answer beside what the law says), then every
   answer by question, one line per country. Inputs sit white on the sand page. */

.rsr { gap: 32px; }
.rsr__section { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.rsr__h { display: flex; align-items: center; gap: 8px; margin: 0; font-size: var(--fs-h2); font-weight: 600; line-height: 1.3; color: var(--ink); }
.rsr__count { font-size: var(--fs-ui); font-weight: 500; color: var(--ink-2); }
.rsr__lede { max-width: 60ch; margin: -4px 0 0; font-size: var(--fs-ui); line-height: 1.5; color: var(--ink-2); }
.rsr :is(.rsr__status, .rsr-progress__line) a { font-weight: 500; } /* Reload */
.rsr__status { margin: 0; font-size: var(--fs-ui); line-height: 1.5; color: var(--ink-2); }
.rsr__alert, .rsr__flag { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.rsr__alert { color: var(--danger); }   /* a failed run is an error */
.rsr__flag { color: var(--ink); }       /* a flag is Daniel's own mark, not an error: ink, never red (hub 20) */
.rsr__alert .icon, .rsr__flag .icon { flex: none; }
.rsr__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.rsr-seg__form { display: contents; }

/* White fields on the sand page, and in the modal (the DS gives them --bg, a shade off white). */
.rsr :is(.textarea, .input), .rsr .ldu-dd--form > .ldu-dd__trigger { background: var(--bg-2); }

/* ── the lists (Horizon index, Surveys index) ───────────────────── */
.rsr__table td { white-space: nowrap; }
.rsr-row { position: relative; }
.rsr-row__name {
  display: grid; grid-template-columns: minmax(0, max-content) auto; grid-template-areas: "title chip" "sub chip"; align-items: center; justify-content: start;
  gap: 2px 12px; color: var(--ink); text-decoration: none;
}
.rsr-row__name > span:first-child { grid-area: title; font-weight: 600; }
.rsr-row__name > .rsr-row__sub { grid-area: sub; font-size: var(--fs-meta); font-weight: 400; color: var(--ink-2); }
.rsr-row__name > .chip { grid-area: chip; }
.rsr-row__name::after { content: ""; position: absolute; inset: 0; } /* the whole row is the link */
.rsr-row__name:focus-visible { outline: none; }
.rsr-row:has(.rsr-row__name:focus-visible) { outline: var(--ring-w) solid var(--ring); outline-offset: -2px; }
.ldu-table .rsr-row__date { width: 1%; color: var(--ink-2); text-align: right; }
.rsr-row__go { width: 1%; color: var(--ink-2); white-space: nowrap; }
.rsr-row__go > span { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-ui); font-weight: 500; }
.rsr__table thead th:last-child { text-align: right; }

/* ── a client's horizon scan ───────────────────────────────────── */
.rsr__ask { display: flex; flex-direction: column; gap: 16px; max-width: 48rem; margin: 0; }
.rsr__go { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.rsr-watch { display: flex; flex-direction: column; gap: 8px; max-width: 72ch; }
.rsr-watch__line { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; margin: 0; font-size: var(--fs-ui); line-height: 1.5; color: var(--ink); }
.rsr-watch__label { margin-right: 4px; font-weight: 600; }
.rsr-watch .rsr__status .chip { margin-right: 4px; }

.rsr-devs { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.rsr-dev__title { margin: 0; font-size: var(--fs-h3); font-weight: 600; line-height: 1.4; color: var(--ink); }
.rsr-dev__text { max-width: 72ch; margin: 0; font-size: var(--fs-body); line-height: 1.55; color: var(--ink); }
.rsr-dev__more { display: flex; flex-direction: column; gap: 12px; }
.rsr-dev__more > summary {
  display: inline-flex; align-items: center; gap: 6px; width: fit-content; font-size: var(--fs-ui); font-weight: 500; color: var(--ink-2); cursor: pointer; list-style: none;
  transition: color var(--dur);
}
.rsr-dev__more > summary::-webkit-details-marker { display: none; }
.rsr-dev__more > summary:hover { color: var(--ink); }
.rsr-dev__more > summary .icon { transition: transform var(--dur); }
.rsr-dev__more[open] > summary .icon { transform: rotate(90deg); }
.rsr-dev__more[open] { gap: 12px; }
.rsr-dev__more > :not(summary) { margin-top: 0; }

.rsr-quote { max-width: 72ch; margin: 0; padding: 12px 16px; border-radius: var(--r-2); background: var(--bg); font-size: var(--fs-ui); line-height: 1.55; color: var(--ink); }
.rsr-quote small { display: block; margin-top: 6px; font-size: var(--fs-meta); color: var(--ink-2); }
.rsr-quote a { font-weight: 500; } /* the source's page */

.rsr-closed { display: flex; flex-direction: column; gap: 12px; }
.rsr-closed > summary { width: fit-content; list-style: none; }
.rsr-closed > summary::-webkit-details-marker { display: none; }
.rsr-closed > summary .icon { transition: transform var(--dur); }
.rsr-closed[open] > summary .icon { transform: rotate(180deg); }

/* ── surveys ───────────────────────────────────────────────────── */
.rsr__where { margin: 0; padding: 0; border: 0; gap: 8px; }
.rsr__where > legend { padding: 0; margin-bottom: 8px; }
.rsr__check { font-size: var(--fs-body); color: var(--ink); }

.rsr-progress { display: flex; flex-direction: column; gap: 8px; max-width: 32rem; }
.rsr-progress__line { margin: 0; font-size: var(--fs-body); line-height: 1.6; color: var(--ink-2); } /* running text, so it wraps word by word */
.rsr-progress__line > .chip { margin-right: 4px; vertical-align: 1px; }
.rsr-progress__line strong { color: var(--ink); font-weight: 600; }
.rsr-progress__bar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.rsr-progress__bar > span { display: block; height: 100%; border-radius: inherit; background: var(--ink); }

.rsr-cell__state { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-meta); font-weight: 500; }
.rsr-cell__state--ok { color: var(--ok); }
.rsr-cell__state--flag { color: var(--ink); } /* Daniel's own mark: ink, not red */
.rsr-cell__state--todo { font-weight: 400; color: var(--ink-3); } /* the AI's answer, not yet Daniel's: quiet, no colour */
.rsr-cell__wait { display: flex; align-items: center; min-height: 24px; font-size: var(--fs-ui); color: var(--ink-3); } /* level with a chip row beside it */

/* ── a development card ────────────────────────────────────────────── */
.rsr-dev { gap: 16px; }
.rsr-dev__head { display: flex; flex-direction: column; gap: 8px; }
.rsr-dev__facts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: 0; font-size: var(--fs-ui); line-height: 1.5; color: var(--ink-2); }
.rsr-dev__when { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 500; }
.rsr-dev__when .icon { flex: none; }
.rsr-dev__step { display: flex; flex-direction: column; gap: 4px; max-width: 72ch; padding: 12px 16px; border-radius: var(--r-2); background: var(--bg); }
.rsr-dev__label { font-size: var(--fs-meta); font-weight: 600; color: var(--ink-2); }
.rsr-dev__step p { margin: 0; font-size: var(--fs-body); line-height: 1.5; color: var(--ink); }
.rsr-dev__acts { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.rsr-call { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── a survey: the answer to check now, then every answer ────────── */
.rsr-check { gap: 20px; }
.rsr-check__head { display: flex; flex-direction: column; gap: 4px; }
.rsr-check__title { margin: 0; font-size: var(--fs-h2); font-weight: 600; line-height: 1.3; color: var(--ink); }
.rsr-check__place { font-weight: 500; color: var(--ink-2); }
.rsr-check__pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.rsr-check__side { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.rsr-check__label { margin: 0; font-size: var(--fs-ui); font-weight: 600; color: var(--ink); }
.rsr-check__answer { max-width: 52ch; margin: 0; font-size: var(--fs-body); line-height: 1.55; color: var(--ink); }
/* the two halves are one pair: the same surface, the same height */
.rsr-check__box, .rsr-check__side--law .rsr-quote { flex: 1; box-sizing: border-box; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; max-width: none; padding: 12px 16px; border-radius: var(--r-2); background: var(--bg); }
.rsr-check__side--law .rsr-quote { display: block; font-size: var(--fs-body); }
.rsr-check__box:not(:has(.rsr-check__answer)) { flex: none; } /* a chip alone (the answer only repeats it): no tall empty panel */
.rsr-check .rsr-quote small { margin-top: 8px; font-size: var(--fs-ui); }
.rsr-check .rsr-quote a { display: inline-flex; align-items: center; gap: 4px; }
.rsr-check__acts { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding-top: 20px; border-top: 1px solid var(--line); }
.rsr-check__state { display: inline-flex; gap: 12px; margin-left: auto; } /* Daniel's call so far, at the far right, clear of the buttons */
.rsr-done .rsr__h .icon { color: var(--ok); }
.rsr-done { display: flex; flex-direction: column; gap: 12px; }
.rsr-all { display: flex; flex-direction: column; gap: 20px; }
.rsr-all__q { display: flex; flex-direction: column; gap: 8px; }
.rsr-all__title { margin: 0; font-size: var(--fs-ui); font-weight: 600; color: var(--ink); }
.rsr-all__rows { margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--r-3); background: var(--bg-2); overflow: hidden; }
.rsr-all__row { display: grid; grid-template-columns: 136px minmax(0, 1fr); align-items: center; min-height: 48px; }
.rsr-all__row + .rsr-all__row { border-top: 1px solid var(--line); }
.rsr-all__place { padding: 0 0 0 16px; font-size: var(--fs-ui); font-weight: 500; color: var(--ink-2); }
.rsr-all__row > .rsr-cell__wait { padding: 12px 16px 12px 0; }
/* chip, answer, then the state at the right; the state comes before the answer in the source so a screen reader hears it first */
.rsr-all__link {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "chip answer state"; align-items: center; gap: 12px;
  min-height: 48px; padding: 0 16px 0 0; color: var(--ink); text-decoration: none; transition: background-color var(--dur);
}
.rsr-all__link > .chip { grid-area: chip; }
.rsr-all__link > .rsr-cell__state { grid-area: state; justify-self: end; }
.rsr-all__answer { grid-area: answer; padding: 12px 0; font-size: var(--fs-ui); line-height: 1.5; } /* whole: the answer is what he checks */
.rsr-all__link:not(:has(.chip)) { grid-template-areas: "answer answer state"; }
.rsr-all__row:has(.rsr-all__link:hover) { background: var(--bg); }
.rsr-all__row:has(.rsr-all__link[aria-current]) { background: var(--bg); }
.rsr-all__row:has(.rsr-all__link[aria-current]) .rsr-all__place { color: var(--ink); font-weight: 600; }
.rsr-all__row:has(.rsr-all__link:focus-visible) { outline: var(--ring-w) solid var(--ring); outline-offset: -2px; }
.rsr-all__link:focus-visible { outline: none; }
.rsr-q__text { max-width: 72ch; margin: 0; font-size: var(--fs-ui); line-height: 1.5; color: var(--ink-2); }
.rsr-cell__none { margin: 0; color: var(--ink-2); }

/* ── phone ─────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .rsr { gap: 24px; }
  .ldu-table.rsr__table { border: 0; background: transparent; overflow: visible; }
  .ldu-table.rsr__table thead { display: none; }
  .ldu-table.rsr__table :is(table, tbody) { display: block; }
  .ldu-table.rsr__table tbody { display: grid; gap: 8px; }
  .ldu-table.rsr__table tbody tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 12px;
    padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r-3); background: var(--bg-2);
  }
  .ldu-table.rsr__table tbody :is(th, td) { display: block; padding: 0; border: 0; white-space: normal; font-size: var(--fs-ui); }
  .rsr-row__name { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; } /* a column, so a name alone has no empty rows under it */
  .ldu-table .rsr-row__date { width: auto; align-self: start; font-size: var(--fs-meta); }
  .ldu-table.rsr__table tbody td.rsr-row__go { width: auto; white-space: nowrap; }
  .rsr .ldu-dd--form > .ldu-dd__trigger { min-height: 44px; } /* the DS form height on a phone; components.css's later --form rule puts it back to 40 */
  .rsr-dev__acts, .rsr-call { flex-direction: column; align-items: stretch; }
  .rsr-dev__acts .btn { width: 100%; justify-content: center; }
  .rsr-check__pair { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .rsr-check__acts > .rsr-seg__form, .rsr-check__acts .btn { flex: 1 1 100%; }
  .rsr-check__acts .btn { width: 100%; justify-content: center; }
  .rsr-all__row { grid-template-columns: minmax(0, 1fr); align-items: start; padding: 12px 16px; gap: 4px; }
  .rsr-all__place { padding: 0; font-size: var(--fs-meta); font-weight: 600; }
  .rsr-all__link { grid-template-columns: minmax(0, 1fr); grid-template-areas: "chip" "answer" "state"; justify-items: start; min-height: 0; padding: 0; gap: 6px; }
  .rsr-all__link > .rsr-cell__state { justify-self: start; }
  .rsr-all__link:not(:has(.chip)) { grid-template-areas: "answer" "state"; }
  .rsr-all__answer { padding: 0; }
  .rsr-check__state { order: -1; flex-basis: 100%; margin-left: 0; } /* his call first, then the buttons */
  .rsr-all__row > .rsr-cell__wait { padding: 0; }
}
