/* The group pages: offices, states, backgrounds and compare.
   Loaded after components.css (and charts.css where a page draws charts). */

.grp { padding-block: var(--s6) var(--s8); }
@media (min-width: 768px) { .grp { padding-block: var(--s7) var(--s9); } }

/* ------------------------------------------------------------ page head */

.grp-head { max-width: 760px; margin-bottom: var(--s6); }
.grp-crumb, .grp-eyebrow { margin-bottom: var(--s2); }
.grp-crumb a { color: inherit; text-decoration: none; }
.grp-crumb a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.grp-crumb a::before { content: "← "; }
.grp-lede { margin-top: var(--s3); max-width: 60ch; }
.grp-lede strong { font-weight: 600; }
.grp-asof { margin-top: var(--s2); }
.grp-asof time { white-space: nowrap; }

/* The office switcher: quiet tabs under the title. */
.grp-offices { margin-top: var(--s5); overflow-x: auto; scrollbar-width: none; }
.grp-offices::-webkit-scrollbar { display: none; }
/* On a phone the tabs scroll, and fade at the edge like the main navigation. */
@media (max-width: 767px) {
  .grp-offices { margin-right: calc(-1 * var(--gutter)); padding-right: var(--gutter); -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); }
}
.grp-offices ul { display: flex; gap: var(--s1); list-style: none; padding: 0; margin: 0; border-bottom: 1px solid var(--hairline); }
.grp-offices a {
  display: inline-flex; align-items: center; min-height: var(--touch); padding: 0 12px;
  font-size: var(--t-small); color: var(--ink-2); text-decoration: none; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.grp-offices a:hover { color: var(--ink); }
.grp-offices a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }
.grp-offices li:first-child a { padding-left: 0; }

/* ------------------------------------------------------------ sections */

.grp-sec + .grp-sec, .grp-sec + .grp-pair, .grp-pair + .grp-sec { margin-top: var(--s7); }
@media (min-width: 768px) {
  .grp-sec + .grp-sec, .grp-sec + .grp-pair, .grp-pair + .grp-sec { margin-top: var(--s8); }
}
.grp-sec__head { max-width: 70ch; margin-bottom: var(--s4); }
.grp-sec__desc { margin-top: var(--s1); font-size: var(--t-small); line-height: var(--lh-small); color: var(--ink-2); }
.grp-sec > h2 { margin-bottom: var(--s3); }
.grp-prose { max-width: 62ch; color: var(--ink-2); }
.grp-chart { min-width: 0; }

.grp-fallback-row { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: var(--s3); align-items: center; margin: var(--s3) 0; }
.grp-fallback-name { font-size: var(--t-small); font-weight: 600; }
.grp-fallback-row + .axis, .grp-fallback-row:last-of-type + .axis { margin-left: calc(120px + var(--s3)); }

/* ------------------------------------------------------------ no figure */

.grp-nofig__list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; border-top: 1px solid var(--hairline); }
@media (min-width: 768px) {
  .grp-nofig__list { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--s6); border-top: 0; }
  .grp-nofig__item { border-top: 1px solid var(--hairline); }
}
.grp-nofig__item { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; padding: var(--s4) 0; border-bottom: 1px solid var(--hairline); }
@media (min-width: 768px) { .grp-nofig__item { border-bottom: 0; } }
.grp-nofig__item > .portrait { margin-top: 2px; }
.grp-nofig__name { font-family: var(--serif); font-optical-sizing: auto; font-size: 17px; line-height: 22px; font-weight: 560; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.grp-nofig__name a { text-decoration: none; }
.grp-nofig__name a:hover { text-decoration: underline; text-decoration-color: var(--axis); }
.grp-nofig__office { font-size: var(--t-small); line-height: var(--lh-small); color: var(--ink-2); }
.grp-nofig__reason { margin-top: var(--s2); font-size: var(--t-small); line-height: var(--lh-small); font-weight: 600; color: var(--ink); }
.grp-nofig__detail { margin-top: 2px; font-size: var(--t-small); line-height: var(--lh-small); color: var(--ink-2); }
.grp-nofig__link { margin-top: var(--s1); font-size: var(--t-micro); line-height: var(--lh-micro); }
.grp-nofig__link a { color: var(--ink-2); }
/* The governors tray grouped by reason: one heading sentence per group. A group
   that prints names only is a compact list, several columns wide. */
.grp-nofig__group + .grp-nofig__group { margin-top: var(--s5); }
.grp-nofig__h {
  margin-bottom: var(--s2);
  max-width: 70ch;
  font-family: var(--sans);
  font-size: var(--t-small);
  line-height: var(--lh-small);
  font-weight: 600;
  color: var(--ink);
}
.grp-nofig__state { font-family: var(--sans); font-size: var(--t-small); line-height: var(--lh-small); font-weight: 400; color: var(--ink-2); }
/* On a phone the state takes its own line, with no separator to lead it (DESIGN 13.21). */
@media (max-width: 479px) {
  .grp-nofig__state { flex-basis: 100%; }
  .grp-nofig__sep { display: none; }
}
.grp-nofig__list--names { border-top: 1px solid var(--hairline); }
.grp-nofig__list--names .grp-nofig__item { padding: var(--s2) 0; border-top: 0; border-bottom: 1px solid var(--hairline); }
.grp-nofig__list--names .grp-nofig__name { font-size: 16px; line-height: 20px; }
@media (min-width: 600px) {
  .grp-nofig__list.grp-nofig__list--names { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--s5); }
}
@media (min-width: 1024px) {
  .grp-nofig__list.grp-nofig__list--names { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* For governors the missing figures lead: a quiet ledger-style panel. */
.grp-nofig--lead { padding: var(--s4); border: 1px solid var(--hairline); border-radius: var(--r-card); background: color-mix(in srgb, var(--range) 10%, var(--page)); }
@media (min-width: 768px) { .grp-nofig--lead { padding: var(--s5); } }
.grp-nofig--lead .grp-nofig__item { border-color: color-mix(in srgb, var(--range-edge) 30%, transparent); }
.grp-nofig--lead .grp-nofig__list { border-color: color-mix(in srgb, var(--range-edge) 30%, transparent); }

/* ------------------------------------------------------------ tallies */

.grp-tallies { display: grid; gap: var(--s4); align-items: start; }
@media (min-width: 900px) {
  .grp-tallies:has(> :nth-child(2)) { grid-template-columns: 3fr 2fr; }
}
.grp-tally__title { font-size: var(--t-micro); line-height: var(--lh-micro); letter-spacing: var(--track-micro); text-transform: uppercase; font-family: var(--sans); font-weight: 650; color: var(--ink-3); margin-bottom: var(--s2); }
.grp-tally__sentence { margin-bottom: var(--s3); }
.grp-counts { list-style: none; padding: 0; margin: 0 0 var(--s2); display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); }
.grp-counts li { display: inline-flex; align-items: baseline; gap: 8px; }
.grp-counts__n { font-weight: 600; font-variant-numeric: tabular-nums; }
.grp-counts__none { padding-left: var(--s5); border-left: 1px solid var(--hairline); }

/* ------------------------------------------------------------ who files, coverage */

.grp-pair { display: grid; gap: var(--s7); }
@media (min-width: 900px) { .grp-pair { grid-template-columns: 1fr 1fr; gap: var(--s7); } }
.grp-pair > .grp-sec { margin-top: 0; padding-top: var(--s4); border-top: 3px double var(--axis); }
.grp-facts { margin-top: var(--s4); }
.grp-facts > div { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: var(--s3); padding: 8px 0; border-top: 1px solid var(--hairline); font-size: var(--t-small); line-height: var(--lh-small); }
.grp-facts dt { color: var(--ink-3); }
.grp-coverage { list-style: none; padding: 0; margin: 0; font-size: var(--t-small); line-height: var(--lh-small); color: var(--ink-2); }
.grp-coverage li { padding: 8px 0; border-top: 1px solid var(--hairline); }
.grp-coverage li:first-child { border-top: 0; padding-top: 0; }
.grp-coverage__n { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.grp-coverage .grade { margin-right: 2px; }
.grp-links { list-style: none; padding: 0; margin: var(--s3) 0 0; display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); font-size: var(--t-small); }

/* ------------------------------------------------------------ office index */

.grp-officelist { list-style: none; padding: 0; margin: 0; border-top: 3px double var(--axis); }
.grp-office {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "head median" "count count" "bar bar";
  column-gap: var(--s4);
  padding: var(--s4) 0;
  border-bottom: 1px solid var(--hairline);
}
.grp-office__head { grid-area: head; min-width: 0; }
.grp-office__name { font-family: var(--serif); font-optical-sizing: auto; font-weight: 540; font-size: var(--t-h2); line-height: var(--lh-h2); }
.grp-office__name a { text-decoration: none; }
.grp-office__name a:hover { text-decoration: underline; text-decoration-color: var(--axis); text-underline-offset: 4px; }
.grp-office__form { font-size: var(--t-small); line-height: var(--lh-small); color: var(--ink-2); }
.grp-office__median { grid-area: median; text-align: right; white-space: nowrap; }
.grp-office__label { display: block; font-size: var(--t-micro); line-height: var(--lh-micro); letter-spacing: var(--track-micro); text-transform: uppercase; font-weight: 650; color: var(--ink-3); }
.grp-office__value { font-size: 20px; line-height: 26px; font-weight: 600; }
.grp-office__count { grid-area: count; margin-top: 2px; font-size: var(--t-micro); line-height: var(--lh-micro); color: var(--ink-3); }
.grp-office__bar { grid-area: bar; margin-top: var(--s3); }
@media (min-width: 900px) {
  .grp-office {
    grid-template-columns: 260px minmax(0, 1fr) 120px;
    grid-template-areas: "head bar median" "count bar median";
    align-items: center;
  }
  .grp-office__bar { margin-top: 0; }
  .grp-officelist__axis { margin-left: calc(260px + var(--s4)); margin-right: calc(120px + var(--s4)); }
}
.grp-officelist__axis { margin-top: var(--s2); }
.grp-officelist + .grp-officelist__axis + .note { margin-top: var(--s3); }

/* ------------------------------------------------------------ state pages */

.grp-state { padding-top: 0; }
.grp-state__axis { position: sticky; top: 0; z-index: 2; padding-top: var(--s4); padding-bottom: 2px; background: var(--surface); }
@media (min-width: 768px) { .grp-state__axis { padding-top: var(--s5); } }
.grp-state__group + .grp-state__group { margin-top: var(--s5); }
.grp-state__heading {
  display: flex; align-items: baseline; gap: 8px;
  margin-top: var(--s4); padding-bottom: 6px;
  font-family: var(--sans); font-size: var(--t-micro); line-height: var(--lh-micro);
  letter-spacing: var(--track-micro); text-transform: uppercase; font-weight: 650; color: var(--ink-3);
  border-bottom: 1px solid var(--ink);
}
.grp-state__n { font-variant-numeric: tabular-nums; color: var(--ink-3); font-weight: 450; }
.grp-state__foot { margin-top: var(--s5); padding-top: var(--s3); border-top: 1px solid var(--hairline); }
.grp-state__foot .note { margin-top: 4px; }
.grp-state-note__reason { margin-top: var(--s2); }

.grp-states {
  list-style: none; padding: 0; margin: 0;
  columns: 1; column-gap: var(--s6);
  border-top: 3px double var(--axis);
}
@media (min-width: 640px) { .grp-states { columns: 2; } }
@media (min-width: 1000px) { .grp-states { columns: 3; } }
.grp-states li { break-inside: avoid; border-bottom: 1px solid var(--hairline); }
.grp-states a {
  display: flex; flex-direction: column; justify-content: center; min-height: 56px; padding: 8px 0;
  text-decoration: none; color: var(--ink);
}
.grp-states a:hover .grp-states__name { text-decoration: underline; text-decoration-color: var(--axis); text-underline-offset: 3px; }
.grp-states__name { font-family: var(--serif); font-optical-sizing: auto; font-size: 18px; line-height: 24px; font-weight: 540; }
.grp-states__counts { font-size: var(--t-small); line-height: var(--lh-small); color: var(--ink-2); }

/* ------------------------------------------------------------ backgrounds */

.grp-bg-table th[scope="row"] { font-weight: 600; }
.grp-bg-table th[scope="row"] a { text-decoration: none; }
.grp-bg-table + .note, .table-wrap + .note { margin-top: var(--s3); }
.grp-bg-groups { border-top: 3px double var(--axis); }
@media (min-width: 900px) {
  .grp-bg-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--s6); align-items: start; }
}
.grp-bg { border-bottom: 1px solid var(--hairline); }
.grp-bg__summary {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3);
  min-height: var(--touch); padding: 10px 0; cursor: pointer; list-style: none;
}
.grp-bg__summary::-webkit-details-marker { display: none; }
/* The chevron rides at the end of the count, inside the same unbroken run, so it can
   never drop to a line of its own when a long name and its count just fill the row. */
.grp-bg__meta::after {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 16px; vertical-align: 2px;
  border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3);
  transform: rotate(45deg) translateY(-2px); transition: transform var(--motion) var(--ease);
}
.grp-bg[open] > .grp-bg__summary .grp-bg__meta::after { transform: rotate(225deg) translateY(-2px); }
.grp-bg__summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.grp-bg__summary { flex-wrap: wrap; row-gap: 0; }
.grp-bg__label { min-width: 0; font-family: var(--serif); font-optical-sizing: auto; font-size: 18px; line-height: 24px; font-weight: 560; }
.grp-bg__meta { margin-left: auto; font-size: var(--t-small); color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* At 320px (a 400% zoom) the count line is wider than the screen: it wraps inside
   the row instead of pushing the page sideways. */
@media (max-width: 479px) { .grp-bg__meta { white-space: normal; max-width: 100%; text-align: right; } }
.grp-bg__list { padding-bottom: var(--s3); }
.grp-bg__nofig { padding-bottom: var(--s3); }

/* ------------------------------------------------------------ compare */

.cmp-nojs p { max-width: 60ch; }
.cmp-pick { margin-bottom: var(--s6); padding-bottom: var(--s5); border-bottom: 1px solid var(--hairline); }
.cmp-form { display: grid; gap: 6px; max-width: 560px; }
.cmp-form__row { display: flex; gap: var(--s2); }
.cmp-form__row .input { flex: 1; min-width: 0; }
.cmp-form__row .btn { flex: none; }
.cmp-form .input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.cmp-form .input[disabled] { opacity: 0.5; }
.note.is-warn { color: var(--ink); font-weight: 600; }
.cmp-chips { list-style: none; padding: 0; margin: var(--s4) 0 0; display: flex; flex-wrap: wrap; gap: var(--s2); }
.cmp-chips[hidden] { display: none; }
.cmp-chip {
  display: inline-flex; align-items: center; gap: 2px; min-height: 36px; padding-left: 12px;
  border: 1px solid var(--axis); border-radius: 18px; background: var(--surface);
  font-size: var(--t-small); line-height: var(--lh-small);
}
.cmp-chip__name { font-weight: 560; }
.cmp-chip__remove {
  display: inline-grid; place-items: center; width: 36px; height: 36px; margin: -1px -1px -1px 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink-2); cursor: pointer;
}
.cmp-chip__remove svg { stroke: currentColor; stroke-width: 1.5; fill: none; }
.cmp-chip__remove:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.cmp-chip__remove:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

.cmp-empty { padding-block: var(--s6); text-align: center; }
.cmp-empty__lede { font-family: var(--serif); font-optical-sizing: auto; font-size: 22px; line-height: 30px; margin-bottom: var(--s2); }
.cmp-empty .note { margin-inline: auto; }

.cmp-sec.grp-sec + .grp-sec { margin-top: var(--s7); }
.cmp-bars { padding-top: 0; }
.cmp-bars__axis { position: sticky; top: 0; z-index: 2; padding-top: var(--s4); padding-bottom: 2px; background: var(--surface); }
@media (min-width: 768px) { .cmp-bars__axis { padding-top: var(--s5); } }
.cmp-bars__item { padding-bottom: var(--s3); }
.cmp-bars__item + .cmp-bars__item { border-top: 1px solid var(--hairline); }
.cmp-bars__list > li + li > .pl { border-top: 0; }
.cmp-bars__sentence { font-size: var(--t-small); line-height: var(--lh-small); color: var(--ink-2); max-width: 62ch; }
.cmp-bars__pub { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; font-size: var(--t-micro); line-height: var(--lh-micro); color: var(--ink-3); }
.cmp-bars__foot { margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--hairline); }
.cmp-bars__foot .note { margin-top: 4px; }

.cmp-hist-grid { display: grid; gap: var(--s4); align-items: start; }
@media (min-width: 900px) {
  .cmp-hist-grid--2, .cmp-hist-grid--3, .cmp-hist-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.cmp-hist { min-width: 0; }
.cmp-hist__name { font-family: var(--serif); font-optical-sizing: auto; font-weight: 560; font-size: 20px; line-height: 26px; }
.cmp-hist__office { font-size: var(--t-small); line-height: var(--lh-small); color: var(--ink-2); margin-bottom: var(--s3); }
/* The scale is forced to the shared ruler here: no per-person scale switch. */

.cmp-verdicts { display: grid; gap: var(--s4); }
@media (min-width: 900px) {
  .cmp-verdicts--2, .cmp-verdicts--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cmp-verdicts--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.cmp-verdict { display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
.cmp-verdict__name { font-family: var(--serif); font-optical-sizing: auto; font-weight: 560; font-size: 20px; line-height: 26px; }
.cmp-verdict__label { margin-top: var(--s1); }
.cmp-verdict__sentence { font-size: var(--t-small); line-height: var(--lh-small); color: var(--ink-2); }
.cmp-verdict .verdict { align-self: flex-start; }
.cmp-pair { margin-top: var(--s2); display: grid; gap: 6px; container-type: inline-size; }
.cmp-pair__row, .cmp-pair__axis { display: grid; grid-template-columns: 84px minmax(0, 1fr) 112px; gap: var(--s2); align-items: center; }
.cmp-pair__label { font-size: var(--t-micro); line-height: var(--lh-micro); color: var(--ink-3); font-variant-numeric: tabular-nums; }
/* The words before an open-ended amount ("at least", "open both ways") take a line of their own above it. */
.cmp-pair__value { font-size: var(--t-small); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cmp-pair__value .value__pre { display: block; font-size: var(--t-micro); line-height: var(--lh-micro); }
.cmp-pair__bar { min-width: 0; }

.cmp-facts { border-top: 3px double var(--axis); }
.cmp-facts__table th[scope="row"] { color: var(--ink-3); font-weight: 450; white-space: nowrap; width: 1%; }
.cmp-facts__table thead th { text-transform: none; letter-spacing: 0; font-family: var(--serif); font-size: 16px; line-height: 22px; font-weight: 560; color: var(--ink); vertical-align: bottom; }
.cmp-facts__table thead th a { text-decoration: none; }
.cmp-facts__table td { min-width: 140px; }
.cmp-facts__table td.num { text-align: left; }
.cmp-facts__src { font-family: var(--mono); font-size: var(--t-micro); line-height: var(--lh-micro); }
.cmp-facts__src a { color: var(--ink-2); }
.cmp-grades { display: grid; gap: 8px; margin-top: var(--s4); max-width: 78ch; font-size: var(--t-micro); line-height: var(--lh-micro); color: var(--ink-2); }
.cmp-grades > li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: start; }
.grp-filers { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: var(--s4); }
.grp-filers li { break-inside: avoid; padding-bottom: 4px; }
@media (max-width: 479px) { .grp-filers { columns: 1; } }

/* A narrow card (a phone, or three or four side by side): the then/now pair
   stacks label and value over a full-width bar, so the axis keeps room for its labels. */
@container (max-width: 559px) {
  .cmp-pair__row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label value" "bar bar"; row-gap: 2px; }
  .cmp-pair__label { grid-area: label; }
  .cmp-pair__value { grid-area: value; }
  .cmp-pair__bar { grid-area: bar; }
  .cmp-pair__axis { grid-template-columns: minmax(0, 1fr); }
  .cmp-pair__axis > span:empty { display: none; }
}

/* The facts table keeps its row labels in view while it scrolls sideways. */
.cmp-facts__table th[scope="row"] { position: sticky; left: 0; z-index: 1; background: var(--page); }
@media (max-width: 599px) {
  .cmp-facts__table th[scope="row"] { white-space: normal; width: auto; min-width: 104px; max-width: 120px; padding-right: 12px; }
  .cmp-facts__table td { min-width: 150px; }
}

/* Elected, not yet in office (governors page only), and Left office (any office
   with a former official). The two lists share one layout. */
.grp-elect__list, .grp-former__list { list-style: none; padding: 0; margin: 0; display: grid; border-top: 1px solid var(--hairline); }
@media (min-width: 768px) { .grp-elect__list, .grp-former__list { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--s6); } }
.grp-elect__item, .grp-former__item { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; padding: var(--s3) 0; border-bottom: 1px solid var(--hairline); }
.grp-elect__item > .portrait, .grp-former__item > .portrait { margin-top: 2px; }
.grp-elect__name, .grp-former__name { font-family: var(--serif); font-optical-sizing: auto; font-size: 17px; line-height: 22px; font-weight: 560; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.grp-elect__name a, .grp-former__name a { text-decoration: none; }
.grp-elect__name a:hover, .grp-former__name a:hover { text-decoration: underline; text-decoration-color: var(--axis); }
.grp-elect__office, .grp-former__office { font-size: var(--t-small); line-height: var(--lh-small); color: var(--ink-2); }
.grp-elect__now { font-size: var(--t-small); line-height: var(--lh-small); color: var(--ink-3); }
