/* Grants and the funding map (#282). Both read styles.css for the layout, the filter rail, the
   phone drawer, the chips and the pop-up; this file is only what those two pages add. */

/* ---------------------------------------------------------------- the grants list */

.gr-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.gr-list.is-loading { opacity: .55; }
.gr-row {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  position: relative; display: flex; align-items: flex-start; gap: 10px;
}
.gr-row__open {
  flex: 1; display: grid; gap: 4px; padding: 12px 14px; color: inherit; text-decoration: none;
  grid-template-columns: minmax(84px, auto) 1fr; grid-template-areas: "amt who" "amt for" "amt tags";
  border-radius: var(--radius);
}
.gr-row__open:hover, .gr-row__open:focus-visible { background: var(--accent-soft); outline: none; }
.gr-row__open:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.gr-row__amt {
  grid-area: amt; font-family: var(--font-display); font-size: 1.35rem; line-height: 1.15;
  font-variant-numeric: tabular-nums; align-self: start; padding-top: 1px;
}
.gr-row__who { grid-area: who; }
.gr-row__arrow { color: var(--muted); padding: 0 3px; }
.gr-row__for { grid-area: for; font-size: .94rem; }
.gr-row__tags { grid-area: tags; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 2px; }
.gr-pager { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 12px 0; }

/* The pop-up: the two parties side by side, because the grant is the line between them. */
.gr-parties { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; margin: 14px 0 18px; }
.gr-party { background: var(--accent-soft); border-radius: var(--radius); padding: 10px 12px; }
.gr-party__name { margin: 2px 0 0; font-size: 1.05rem; }
@media (max-width: 620px) {
  .gr-parties { grid-template-columns: 1fr; }
  .gr-row__open { grid-template-columns: 1fr; grid-template-areas: "amt" "who" "for" "tags"; }
}

/* ---------------------------------------------------------------- the funding map */

.mm-honest { margin-top: 10px; }
.mm-honest > summary { cursor: pointer; font-weight: 600; }
.mm-honest ul { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 7px; }
.mm-honest li { font-size: .94rem; }

.mm-bar { flex-wrap: wrap; align-items: center; gap: 8px; }
.mm-q { max-width: 22rem; }
.mm-min { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; color: var(--muted); }
.mm-views { display: inline-flex; gap: 4px; }
.mm__swatch {
  display: inline-block; width: .62em; height: .62em; border-radius: var(--r-round);
  margin-right: .4em; vertical-align: baseline;
}
.mm-count { margin: 6px 0 10px; }

.mm { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 6px 2px; }
.mm svg { width: 100%; height: auto; display: block; }
/* The flows sit under the bubbles and are meant to be felt rather than read. */
.mm__flows { color: var(--line); opacity: .85; }
.mm__node { cursor: pointer; }
.mm__node circle { opacity: .74; transition: opacity .12s; }
.mm__node:hover circle, .mm__node:focus-visible circle { opacity: 1; stroke: var(--ink); stroke-width: 1.5; }
.mm__node:focus-visible { outline: none; }
.mm__node text { font-size: 11px; fill: var(--ink); paint-order: stroke; stroke: var(--panel); stroke-width: 3px; pointer-events: none; }
.mm figcaption { padding: 8px 8px 10px; }

.mm-table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.mm-table { border-collapse: collapse; width: 100%; font-size: .94rem; }
.mm-table th, .mm-table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.mm-table thead th { position: sticky; top: 0; background: var(--panel); white-space: nowrap; }
.mm-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.mm-table tbody tr:last-child td { border-bottom: 0; }

.mm-detail .mm-sides { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; margin: 4px 0 18px; }
.mm-side h3 { margin: 0 0 6px; font-size: 1rem; }
.mm-side ul { display: grid; gap: 4px; }
.mm-members { display: grid; gap: 5px; max-height: 24rem; overflow-y: auto; }
.mm-members li { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
@media (max-width: 620px) { .mm-detail .mm-sides { grid-template-columns: 1fr; } }

/* Federal awards on an organisation's record (#282): the same shape as its grants list. */
.nf-federal { margin-top: 22px; }
.nf-federal__list { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 7px; }
.nf-federal__list > li { display: flex; gap: 10px; align-items: baseline; }

/* The groups table on a phone. Seven columns will not fit 375px and a sideways scroll inside a
   page that already scrolls is a trap, so the three that answer "how big" stay and the rest go;
   the group's own pop-up has all of them. */
.mm-kind-sm { display: none; }
@media (max-width: 620px) {
  /* Group, members, money. "What holds it together" moves under the name; the rest are in the
     group's own pop-up. A sideways scroll inside a page that already scrolls hides the numbers. */
  .mm-table th:nth-child(2), .mm-table td:nth-child(2),
  .mm-table th:nth-child(4), .mm-table td:nth-child(4),
  .mm-table th:nth-child(6), .mm-table td:nth-child(6),
  .mm-table th:nth-child(7), .mm-table td:nth-child(7) { display: none; }
  .mm-table th, .mm-table td { padding: 8px 8px; }
  .mm-kind-sm { display: block; color: var(--muted); font-size: .84rem; margin-top: 2px; }
}
