/* Data explorer page. Loaded after style.css and uses only its color, type, and spacing tokens. */

/* ---------- Page heading band ---------- */
/* Third emphasis of the palette: a pale blue band with a blue rule, so it is clear at a glance
   that this is neither the home page (light, patterned hero) nor the sources page (dark blue band). */
.explorer-head {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  /* Kept short so the chart below starts high on the page. */
  padding-block: clamp(var(--space-5), 2vw, var(--space-6)) calc(var(--space-3) + var(--space-12));
  background: var(--color-accent-soft);
  border-bottom: 4px solid var(--color-primary);
}
/* Decorative network pattern, faint and fainter still behind the text. */
.explorer-head::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: url('./assets/hero-network.svg') right top / 1000px auto no-repeat;
  opacity: 0.3;
  -webkit-mask-image: linear-gradient(to bottom, #000 0, transparent 26rem);
  mask-image: linear-gradient(to bottom, #000 0, transparent 26rem);
}
@media (min-width: 62rem) {
  .explorer-head::before {
    background-size: cover;
    opacity: 0.75;
    -webkit-mask-image: linear-gradient(to right, rgb(0 0 0 / 0.18) 0%, rgb(0 0 0 / 0.18) 50%, #000 95%);
    mask-image: linear-gradient(to right, rgb(0 0 0 / 0.18) 0%, rgb(0 0 0 / 0.18) 50%, #000 95%);
  }
}
.explorer-head h1 {
  font-size: clamp(2rem, 1.35rem + 2.2vw, 2.75rem);
  color: var(--color-ink);
}
.explorer-head .lede {
  font-size: var(--text-base);
  line-height: 1.5;
  max-width: 62rem;
  margin-top: var(--space-2);
  color: var(--color-text);
}
/* This page is wider than the others, so the chart and the controls fit side by side.
   Every band on it shares the width, so the edges of the header, the cards, and the footer line up. */
.site-header > .container,
.explorer-head > .container,
.explorer > .container,
.ex-differs > .container,
.ex-about > .container,
.site-footer > .container {
  max-width: 80rem;
}

/* ---------- Explorer section ---------- */
.explorer {
  padding-bottom: clamp(var(--space-10), 5vw, var(--space-16));
}
.ex-noscript {
  margin-top: var(--space-8);
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  max-width: none;
}

/* The chart comes first. From 64rem the controls sit in a narrower column to its right, and below
   that they follow it. The order on screen is the order in the page. Both cards sit across the edge
   of the heading band. */
.ex-layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: var(--space-5);
  margin-top: calc(-1 * var(--space-12));
}
@media (min-width: 64rem) {
  .ex-layout {
    grid-template-columns: minmax(0, 1fr) 23rem;
    gap: var(--space-6);
  }
}

/* Controls card. Its contents respond to the width of the card, not of the window. */
.ex-controls {
  container: controls / inline-size;
  min-width: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: clamp(var(--space-4), 2.5vw, var(--space-6));
  scroll-margin-top: 6rem;
}
.ex-controls-title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: var(--space-4);
}
.ex-primary {
  display: grid;
  gap: var(--space-4);
}
@container controls (min-width: 40rem) {
  .ex-primary {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  }
  /* The activity or chatbot picker sits under the question it belongs to. */
  .ex-primary .field--question {
    grid-column: 1;
    grid-row: 1;
  }
  .ex-primary .field--compare {
    grid-column: 2;
    grid-row: 1;
  }
  .ex-primary .ex-pick-field {
    grid-column: 1;
    grid-row: 2;
  }
}
.ex-controls .field label {
  color: var(--color-text);
}

/* Panels that fold away behind one button: the filters and the adjustment. */
.ex-fold {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}
.ex-fold-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}
.ex-fold-toggle {
  display: flex;
  flex: 1 1 12rem;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-width: 0;
  min-height: 48px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}
.ex-fold-toggle:hover {
  background: var(--color-surface-offset);
}
.ex-fold-toggle > span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.ex-fold-head .btn {
  flex: none;
}
.ex-chevron {
  flex: none;
  width: 18px;
  height: 18px;
  transition: transform var(--transition-interactive);
}
.ex-fold-toggle[aria-expanded='true'] > .ex-chevron,
.ex-details[open] > summary > .ex-chevron {
  transform: rotate(180deg);
}
.ex-fold-panel {
  margin-top: var(--space-4);
}
.ex-filter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3) var(--space-4);
}
.ex-filter-grid .field label {
  font-weight: 500;
  color: var(--color-text-muted);
}
@container controls (min-width: 30rem) {
  .ex-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@container controls (min-width: 44rem) {
  .ex-filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.ex-quick {
  margin-top: var(--space-4);
}

/* Link from the end of the controls back to the chart, for the one-column layout. */
.ex-back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  margin-top: var(--space-5);
  font-size: var(--text-sm);
  font-weight: 600;
}
.ex-back svg {
  flex: none;
  width: 18px;
  height: 18px;
}
@media (min-width: 64rem) {
  .ex-back {
    display: none;
  }
}

/* Native disclosures: notes under the chart, the reading guide, and the entries of "About this data". */
.ex-details {
  margin-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}
.ex-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 48px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  list-style: none;
}
.ex-details > summary::-webkit-details-marker {
  display: none;
}
/* The shared figure cards mark a disclosure with a plus sign. Here the chevron does that. */
.ex-details > summary::before,
.figure-card .ex-details[open] > summary::before {
  content: none;
}
.ex-details > summary:hover {
  color: var(--color-primary);
}
.ex-details > summary > span {
  min-width: 0;
}

/* ---------- Result card ---------- */
/* The page already keeps 5rem clear for the sticky header when it scrolls to something. */
.ex-result {
  scroll-margin-top: var(--space-2);
  padding-top: clamp(var(--space-5), 2vw, var(--space-6));
}
/* The heading takes focus after a question is asked on a small screen. It is not a control, so it gets no ring of its own. */
.ex-result .figure-title:focus {
  outline: none;
}
.ex-result .figure-title:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}
.ex-result-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4) var(--space-8);
}
.ex-result-titles {
  flex: 1 1 22rem;
  min-width: 0;
}
.ex-result .figure-title {
  margin-top: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.3rem, 1.1rem + 0.9vw, 1.75rem);
  letter-spacing: -0.01em;
}
.ex-views {
  margin-top: 0;
  flex: none;
  max-width: 100%;
}
.ex-views legend {
  color: var(--color-text-muted);
}
@media (max-width: 30rem) {
  .ex-views {
    flex: 1 1 100%;
  }
  /* Let the three options wrap when large text leaves no room for one row. */
  .ex-views .segmented-options {
    flex-wrap: wrap;
  }
  .ex-views label {
    flex: 1 1 auto;
  }
}
.ex-status {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}
.ex-count {
  font-weight: 600;
  max-width: none;
}
.ex-base {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  max-width: none;
}

.ex-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3) var(--space-6);
  margin-top: var(--space-3);
}
.ex-toolbar:empty,
.ex-toolbar:not(:has(> :not([hidden]))) {
  display: none;
}
.ex-item-field {
  flex: 0 1 22rem;
}

/* Legends: text and counts next to each swatch, so nothing depends on color alone. */
.ex-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  font-size: var(--text-sm);
  min-width: 0;
}
/* On a phone a tighter gap lets two entries share a line, so the chart starts higher. */
@media (max-width: 30rem) {
  .ex-legend {
    column-gap: var(--space-3);
  }
}
.ex-legend li {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-height: 1.75rem;
  max-width: 100%;
}
.ex-swatch {
  flex: none;
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 3px;
  border: 1.5px solid transparent;
}
.ex-swatch--dot {
  border-radius: var(--radius-full);
}
.ex-legend .ex-legend-count {
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums lining-nums;
}

.ex-chart-wrap {
  margin-top: var(--space-2);
  min-height: 12rem;
}
.ex-unit-wrap {
  position: relative;
  width: 100%;
  margin-top: var(--space-4);
}
.ex-unit-wrap canvas {
  width: 100%;
}
.ex-view .figure-note {
  margin-top: var(--space-3);
}
.ex-fallback {
  margin-top: var(--space-5);
  padding: var(--space-5);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  color: var(--color-text);
  max-width: none;
}

/* ---------- Cross-tabulation ---------- */
.ex-table-scroll {
  margin-top: var(--space-4);
  border-radius: var(--radius-sm);
  container-type: inline-size;
}
.ex-table {
  min-width: 34rem;
  border-collapse: separate;
  border-spacing: 0;
}
.ex-table caption {
  caption-side: top;
  padding-bottom: var(--space-3);
}
/* The caption text stays in view and wraps to the visible width while the table scrolls sideways. */
.ex-caption-text {
  display: block;
  position: sticky;
  left: 0;
  width: 100cqi;
  max-width: 70ch;
}
.ex-table th,
.ex-table td {
  padding: var(--space-2) var(--space-3);
  vertical-align: middle;
}
.ex-table thead th {
  vertical-align: bottom;
  line-height: 1.3;
  min-width: 5.5rem;
}
.ex-table thead th:first-child,
.ex-table tbody th {
  padding-left: 0;
  min-width: 9rem;
  text-align: left;
}
.ex-table tbody th {
  font-weight: 600;
}
.ex-table td {
  line-height: 1.3;
}
.ex-table td.ex-heat {
  border-left: 2px solid var(--color-surface);
  border-bottom: 2px solid var(--color-surface);
}
.ex-table .ex-pct {
  display: block;
  font-weight: 600;
}
.ex-table .ex-n {
  display: block;
  font-size: var(--text-xs);
}
.ex-table td.ex-plain .ex-n {
  color: var(--color-text-muted);
}
.ex-table .ex-row-total th,
.ex-table .ex-row-total td {
  border-top: 2px solid var(--color-border-strong);
}
.ex-table td.ex-suppressed {
  text-align: left;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}
.ex-tag {
  display: inline-block;
  margin-top: 0.15rem;
  padding: 0.05rem 0.45rem;
  border-radius: var(--radius-sm);
  background: var(--color-accent-soft);
  border: 1px solid var(--color-accent-ink);
  color: var(--color-accent-ink);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}
.ex-table tbody th .ex-tag {
  display: table;
}
/* On narrow screens the row labels stay in place while the numbers scroll. */
@media (max-width: 47.99rem) {
  .ex-table thead th:first-child,
  .ex-table tbody th {
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 6.5rem;
    max-width: 8.5rem;
    background: var(--color-surface);
    box-shadow: 1px 0 0 var(--color-border-strong);
    padding-right: var(--space-2);
  }
  .ex-table thead th {
    min-width: 4.75rem;
  }
  .ex-table th,
  .ex-table td {
    padding-left: var(--space-2);
    padding-right: var(--space-2);
  }
  .ex-table thead th:first-child,
  .ex-table tbody th {
    padding-left: 0;
  }
}

.ex-scroll-hint {
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  max-width: none;
}

/* ---------- Cautions ---------- */
.ex-cautions {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-4);
}
.ex-cautions:empty {
  display: none;
}
.ex-cautions li {
  max-width: none;
  padding: var(--space-3) var(--space-4);
  background: var(--color-accent-soft);
  border-left: 4px solid var(--color-accent-ink);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--color-text);
}
.ex-cautions strong,
.ex-notes-list strong {
  font-weight: 600;
}
.ex-notes-list {
  display: grid;
  gap: var(--space-3);
  padding-bottom: var(--space-2);
}
.ex-notes-list li {
  max-width: 75ch;
  font-size: var(--text-sm);
  color: var(--color-text);
}

/* ---------- Empty state ---------- */
.ex-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-top: var(--space-5);
  padding: var(--space-12) var(--space-5);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
}
.ex-empty svg {
  width: 40px;
  height: 40px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}
.ex-empty h3 {
  font-size: var(--text-lg);
  font-weight: 600;
}
.ex-empty p {
  color: var(--color-text-muted);
  max-width: 46ch;
  margin-block: var(--space-2) var(--space-5);
}

/* ---------- Card footer ---------- */
.ex-foot {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}
.ex-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-4);
}
.ex-actions .text-link {
  margin-top: 0;
}
.ex-copy-status {
  min-height: 1.5em;
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-primary);
  max-width: none;
}
@media (max-width: 30rem) {
  .ex-actions .btn {
    width: 100%;
  }
}

/* ---------- How this group differs ---------- */
.ex-differs {
  background: var(--color-surface-offset);
}
.ex-differs .section-head {
  max-width: 52rem;
}
.ex-differs-card {
  scroll-margin-top: 6rem;
}
.ex-differs-small {
  font-size: var(--text-base);
  max-width: 44rem;
}
.ex-differs-legend {
  margin-bottom: var(--space-4);
}
.ex-differs-legend li {
  gap: var(--space-3);
  font-weight: 500;
}
/* Two marker shapes: a filled circle for the group, an open diamond for all adults. */
.ex-mark {
  flex: none;
  display: inline-block;
  box-sizing: border-box;
}
.ex-mark--group {
  width: 1rem;
  height: 1rem;
  border-radius: var(--radius-full);
  background: var(--data-main);
  border: 2px solid var(--color-surface);
  box-shadow: 0 0 0 1px var(--data-main);
}
.ex-mark--all {
  width: 0.8125rem;
  height: 0.8125rem;
  background: var(--color-surface);
  border: 3px solid var(--data-slate);
  transform: rotate(45deg);
}
.ex-dumbbell {
  display: grid;
}
.ex-db-row {
  --db-pad: 3.4rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-1);
  max-width: none;
  padding-block: var(--space-3);
  border-top: 1px solid var(--color-border);
}
.ex-db-axis {
  padding-block: 0 var(--space-1);
  border-top: none;
}
.ex-db-label {
  min-width: 0;
}
.ex-db-name {
  display: block;
  font-weight: 600;
  line-height: 1.3;
}
.ex-db-base {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.ex-db-track {
  position: relative;
  height: 2.75rem;
  margin-inline: var(--db-pad);
  /* Vertical guides at 0, 25, 50, 75, and 100 percent. */
  background:
    linear-gradient(to right, var(--color-border) 1px, transparent 1px) 0 0 / 25% 100%,
    linear-gradient(to left, var(--color-border) 1px, transparent 1px) 100% 0 / 100% 100% no-repeat;
}
.ex-db-axis .ex-db-track {
  height: 1.5rem;
  background: none;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums lining-nums;
}
.ex-db-axis .ex-db-track span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}
.ex-db-line {
  position: absolute;
  top: 50%;
  height: 4px;
  margin-top: -2px;
  background: var(--data-neutral-edge);
  border-radius: 2px;
}
.ex-db-track .ex-mark {
  position: absolute;
  top: 50%;
}
.ex-db-track .ex-mark--group {
  margin: -0.5rem 0 0 -0.5rem;
}
.ex-db-track .ex-mark--all {
  margin: -0.40625rem 0 0 -0.40625rem;
}
.ex-db-val {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums lining-nums;
  line-height: 1;
  white-space: nowrap;
}
.ex-db-val--group {
  font-weight: 700;
  color: var(--data-main);
}
.ex-db-val--all {
  font-weight: 500;
  color: var(--data-slate);
}
.ex-db-val--low {
  transform: translate(calc(-100% - 0.8rem), -50%);
}
.ex-db-val--high {
  transform: translate(0.8rem, -50%);
}
.ex-db-gap {
  font-size: var(--text-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--color-text);
  max-width: none;
}
.ex-db-gap span {
  display: block;
  font-weight: 400;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.ex-db-row--muted .ex-db-gap {
  font-weight: 400;
  color: var(--color-text-muted);
}
@media (max-width: 30rem) {
  .ex-db-tick-minor {
    display: none;
  }
}
@media (min-width: 48rem) {
  .ex-db-row {
    grid-template-columns: minmax(11rem, 17rem) minmax(0, 1fr) 11.5rem;
    align-items: center;
    gap: var(--space-4);
    padding-block: var(--space-2);
  }
  .ex-db-axis {
    padding-block: 0;
  }
}
#differs-note {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

/* ---------- About this data ---------- */
.ex-about-grid {
  display: grid;
  gap: var(--space-6);
}
@media (min-width: 62rem) {
  .ex-about-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr);
    gap: var(--space-12);
  }
}
.ex-about-list {
  border-top: 2px solid var(--color-primary);
  border-bottom: 1px solid var(--color-border-strong);
}
.ex-about-item {
  margin-top: 0;
  border-top: 1px solid var(--color-border-strong);
}
.ex-about-item:first-child {
  border-top: none;
}
.ex-about-item > summary {
  min-height: 56px;
  padding-block: var(--space-2);
  font-size: var(--text-base);
  line-height: 1.3;
}
.ex-about-item > p {
  padding-bottom: var(--space-5);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  max-width: 70ch;
}

/* ---------- Relationship between two answers ---------- */
.ex-mode {
  margin-top: 0;
  margin-bottom: var(--space-5);
}
.ex-mode legend {
  color: var(--color-text);
}
/* The second option is long, so the two options stack when the card is narrow. */
@container controls (max-width: 30rem) {
  .ex-mode .segmented-options {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
  }
  .ex-mode label {
    justify-content: flex-start;
    padding-inline: var(--space-4);
    text-align: left;
  }
}
.rel-ask-block {
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--color-border);
}
.rel-controls {
  display: grid;
  gap: var(--space-5);
}
.rel-controls .ex-fold {
  margin-top: 0;
}
.rel-ask-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
}
.rel-ask-row input {
  flex: 1 1 10rem;
  width: auto;
  min-width: 0;
}
.rel-ask-row .btn {
  flex: 0 0 auto;
}
.rel-hint {
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  max-width: none;
}
.rel-examples {
  margin-top: var(--space-3);
}
.rel-examples-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}
.rel-chip-list,
.rel-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.rel-chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  max-width: 100%;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.rel-chip:hover {
  background: var(--color-surface-offset);
  border-color: var(--color-text);
}
/* In the two-column layout the examples sit in the narrow column, so with a mouse they are set tighter to keep
   all six in view. Touch screens keep the full 44 pixel height. */
@media (min-width: 64rem) and (hover: hover) and (pointer: fine) {
  .rel-examples .rel-chip-list {
    gap: 0.375rem;
  }
  .rel-examples .rel-chip {
    min-height: 36px;
    padding: 0.375rem var(--space-3);
    font-size: var(--text-xs);
  }
  .ex-controls-title {
    margin-bottom: var(--space-3);
  }
}
.rel-ask-status {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--color-primary-soft);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--color-text);
  max-width: none;
}
.rel-ask-status:empty {
  display: none;
}
.rel-ask-status[data-kind='problem'] {
  background: var(--color-accent-soft);
  border-left-color: var(--color-accent-ink);
}
.rel-suggestions {
  margin-top: var(--space-3);
}
.rel-pickers {
  display: grid;
  gap: var(--space-3) var(--space-4);
  align-items: end;
}
@container controls (min-width: 40rem) {
  .rel-pickers {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }
}
.rel-swap {
  justify-self: start;
}
.rel-adjust {
  border: none;
  min-width: 0;
  padding: 0;
  margin: 0;
}
.rel-adjust-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0 var(--space-5);
}
@container controls (min-width: 30rem) {
  .rel-adjust-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@container controls (min-width: 52rem) {
  .rel-adjust-options {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.rel-check {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  padding-block: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-text);
  cursor: pointer;
}
.rel-check input {
  flex: none;
  width: 1.375rem;
  height: 1.375rem;
  margin: 0;
  accent-color: var(--color-primary);
  cursor: pointer;
}
.rel-check:has(input:disabled) {
  color: var(--color-text-muted);
  cursor: not-allowed;
}
.rel-check input:disabled {
  cursor: not-allowed;
}
.rel-adjust .btn {
  margin-top: var(--space-3);
}

/* Result card in relationship mode */
.rel-summary {
  margin-top: var(--space-5);
  padding: var(--space-4) var(--space-5);
  background: var(--color-primary-soft);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-sm);
}
.rel-summary-title {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--space-2);
}
.rel-summary-text {
  max-width: 75ch;
  color: var(--color-text);
}
.rel-summary .rel-summary-more {
  margin-top: var(--space-3);
  border-top-color: var(--color-border-strong);
}
.rel-summary-more > summary {
  font-weight: 500;
}
.rel-summary-note {
  max-width: 75ch;
  padding-bottom: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-text);
}
/* A long legend label wraps beside its swatch instead of dropping below it. */
.ex-legend li.rel-legend-item {
  flex-wrap: nowrap;
  align-items: flex-start;
}
.rel-legend-item .ex-swatch {
  margin-top: 0.4em;
}
.rel-legend-item > span:last-child {
  min-width: 0;
}
/* The adjusted series is hatched as well as colored, so it does not depend on color alone. */
.ex-swatch--hatch {
  background-image: repeating-linear-gradient(135deg, var(--data-slate) 0 2px, var(--color-surface) 2px 5px);
}
.ex-swatch--interval {
  width: 1.5rem;
  height: 0.875rem;
  border: none;
  border-radius: 0;
  background:
    linear-gradient(var(--color-text), var(--color-text)) center / 100% 2px no-repeat,
    linear-gradient(var(--color-text), var(--color-text)) left center / 2px 100% no-repeat,
    linear-gradient(var(--color-text), var(--color-text)) right center / 2px 100% no-repeat;
}
.ex-table td.rel-number {
  text-align: right;
  font-variant-numeric: tabular-nums lining-nums;
  white-space: nowrap;
}
.ex-table th.rel-number {
  text-align: right;
}
.ex-empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
}
