/* two-questions.css — the interactive companion to the spend-categorization
   essay (templates/core/two_questions.html). Tokens only: no palette, fonts or
   theme blocks of its own, so it follows light/dark with the rest of the site.
   One accent: lines and cells where the two views disagree use the accent
   text colour; text on an accent fill uses --color-on-accent. */

.tq-head .lead { max-width: var(--layout-reading); }
.tq-fiction { margin: 0; border: 1px dashed var(--color-border-strong); }
.tq-head noscript .alert { margin: var(--space-6) 0 0; max-width: var(--layout-reading); }

.tq-note { max-width: var(--layout-reading); }
.tq-small { font-size: var(--type-size-base); }

.tq-big {
  margin: 0;
  font-family: var(--type-family-display);
  font-size: var(--type-display-xl);
  line-height: 1;
  font-variant-numeric: lining-nums tabular-nums;
}

/* ---------- The two dashboards ---------- */
.tq-duel-wrap { padding-bottom: var(--space-16); }
.tq-duel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: var(--space-6);
  align-items: center;
}
.tq-dash { padding-top: var(--space-4); border-top: 1px solid var(--color-text); }
.tq-dash p { margin-bottom: var(--space-3); }
.tq-dash__who { font-weight: var(--type-weight-semibold); }
.tq-dash__who .muted { margin-left: var(--space-2); font-weight: var(--type-weight-regular); font-size: var(--type-size-sm); }
.tq-dash__label { color: var(--color-text-muted); font-size: var(--type-size-base); }
.tq-dash__foot { margin: 0; padding-top: var(--space-3); border-top: 1px solid var(--color-border); font-size: var(--type-size-base); }
.tq-dash__foot .muted { display: block; font-size: var(--type-size-sm); }
.tq-vs {
  margin: 0;
  padding: var(--space-1) var(--space-3);
  color: var(--color-accent-text);
  border: 1px solid var(--color-accent-text);
  border-radius: var(--radius-pill);
  font-size: var(--type-size-sm);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tq-gapline {
  max-width: var(--layout-reading);
  margin: var(--space-8) 0 0;
  font-family: var(--type-family-display);
  font-size: var(--type-size-xl);
  line-height: 1.45;
}
.tq-gapline strong { font-weight: var(--type-weight-semibold); }

/* ---------- Cutoffs ---------- */
.tq-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: var(--space-6) var(--space-10);
  align-items: end;
}
.tq-cgroup { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-3) var(--space-6); }
.tq-cgroup legend {
  margin-bottom: var(--space-3);
  font-size: var(--type-size-base);
  font-weight: var(--type-weight-semibold);
}
.tq-cgroup legend .muted { margin-left: var(--space-2); font-size: var(--type-size-sm); font-weight: var(--type-weight-regular); }
.tq-slider label {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--type-size-sm);
}
.tq-slider output { color: var(--color-text); font-weight: var(--type-weight-semibold); font-variant-numeric: tabular-nums; }
.tq-slider input { width: 100%; min-height: 32px; margin: 0; accent-color: var(--color-accent); }

/* ---------- Fig. 1, the flip ---------- */
.tq-flip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--space-10);
  align-items: start;
}
.tq-figure { margin: 0; }
.tq-scroll { overflow-x: auto; }
.tq-slope { width: 100%; min-width: 640px; height: auto; font-family: var(--type-family); }
.tq-key { display: inline-flex; align-items: center; gap: var(--space-2); margin-left: var(--space-4); white-space: nowrap; }
.tq-key__line { display: inline-block; width: 22px; border-top: 3px solid var(--color-border-strong); }
.tq-key__line--flip { border-top-color: var(--color-accent-text); }
.tq-key__line--sel { border-top-color: var(--color-text); }

.tq-col-title { fill: var(--color-text); font-size: 12.5px; font-weight: var(--type-weight-semibold); }
.tq-col-sub { fill: var(--color-text-muted); font-size: 11px; }
.tq-grp { fill: var(--color-text-muted); font-size: 10.5px; letter-spacing: 0.06em; }
.tq-rule { stroke: var(--color-border); }
.tq-link { fill: none; stroke-linecap: round; }
.tq-link--same { stroke: var(--color-border-strong); stroke-opacity: 0.6; }
.tq-link--flip { stroke: var(--color-accent-text); stroke-opacity: 0.45; }
.tq-link--sel { stroke: var(--color-text); }
.tq-row { cursor: pointer; }
.tq-hit { fill: transparent; }
.tq-row:hover .tq-hit, .tq-row.is-selected .tq-hit { fill: var(--color-surface-strong); }
.tq-name { fill: var(--color-text); font-size: 11.5px; }
.tq-val { fill: var(--color-text-muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.tq-dot { fill: var(--color-text-muted); }
.tq-row.is-flip .tq-dot { fill: var(--color-accent-text); }
.tq-row.is-selected .tq-dot { fill: var(--color-text); }
.tq-row.is-selected .tq-name { font-weight: var(--type-weight-bold); }

.tq-card { padding-top: var(--space-4); border-top: 1px solid var(--color-text); font-size: var(--type-size-base); }
.tq-card .field { margin-bottom: var(--space-6); }
.tq-card__cat { margin: 0; color: var(--color-text-muted); font-size: var(--type-size-sm); letter-spacing: 0.04em; text-transform: uppercase; }
.tq-card__name { margin: 0 0 var(--space-4); font-family: var(--type-family-display); font-size: var(--type-display-md); line-height: var(--type-leading-tight); }
.tq-kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); margin-bottom: var(--space-4); }
.tq-kv dt, .tq-chips dt { color: var(--color-text-muted); font-size: var(--type-size-sm); }
.tq-kv dd { margin: 0; font-weight: var(--type-weight-semibold); font-variant-numeric: tabular-nums; }
.tq-chips { margin-bottom: var(--space-4); }
.tq-chips > div { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); padding-block: var(--space-2); border-top: 1px solid var(--color-border); }
.tq-chip { margin: 0; padding: 2px var(--space-2); border: 1px solid var(--color-border-strong); border-radius: var(--radius-pill); font-size: var(--type-size-sm); }
.tq-chip--flip { color: var(--color-accent-text); border-color: var(--color-accent-text); }
.tq-stack { display: block; width: 100%; height: 10px; margin-bottom: var(--space-2); background: var(--color-surface-muted); }
.tq-t0 { fill: var(--color-accent); background: var(--color-accent); }
.tq-t1 { fill: color-mix(in srgb, var(--color-accent) 55%, var(--color-bg)); background: color-mix(in srgb, var(--color-accent) 55%, var(--color-bg)); }
.tq-t2 { fill: color-mix(in srgb, var(--color-accent) 22%, var(--color-bg)); background: color-mix(in srgb, var(--color-accent) 22%, var(--color-bg)); }
.tq-stack-leg { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); color: var(--color-text-muted); font-size: var(--type-size-sm); }
.tq-stack-leg > span { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--color-text); }
.tq-swatch { display: inline-block; width: 10px; height: 10px; }
.tq-reading { margin: 0; padding-top: var(--space-4); border-top: 1px solid var(--color-border); }
.tq-reading strong { font-weight: var(--type-weight-semibold); }

/* ---------- Fig. 2, trust drift ---------- */
.tq-drift {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: var(--space-10);
  align-items: start;
}
.tq-big--drift { margin-bottom: var(--space-3); color: var(--color-accent-text); }
.tq-matrix { width: 100%; border-collapse: separate; border-spacing: 4px; font-size: var(--type-size-sm); }
.tq-matrix th, .tq-matrix__corner { padding: var(--space-2); color: var(--color-text-muted); font-weight: var(--type-weight-regular); text-align: left; vertical-align: bottom; }
.tq-matrix tbody th { vertical-align: middle; }
.tq-matrix th b { display: block; color: var(--color-text); font-weight: var(--type-weight-semibold); }
.tq-matrix__corner { font-size: var(--type-size-xs); line-height: 1.35; }
.tq-cell {
  min-width: 7.5rem;
  padding: var(--space-3);
  vertical-align: top;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}
.tq-cell span { display: block; }
.tq-cell__amt { font-size: var(--type-size-lg); font-weight: var(--type-weight-semibold); font-variant-numeric: tabular-nums; }
.tq-cell__tag { margin-top: var(--space-2); font-size: var(--type-size-xs); }
.tq-cell--agree { border: 2px solid var(--color-text); }
/* Disagreement tint: the accent mixed into the surface. Cell text stays
   --color-text, which keeps >= 4.5:1 up to the strongest level in both themes. */
.tq-cell--l1 { background: color-mix(in srgb, var(--color-accent) 8%, var(--color-surface)); }
.tq-cell--l2 { background: color-mix(in srgb, var(--color-accent) 16%, var(--color-surface)); }
.tq-cell--l3 { background: color-mix(in srgb, var(--color-accent) 24%, var(--color-surface)); }
.tq-cell--l4 { background: color-mix(in srgb, var(--color-accent) 32%, var(--color-surface)); }

/* ---------- Fig. 3, the banner ---------- */
.tq-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: var(--space-10);
  align-items: start;
}
.tq-seg { margin-bottom: var(--space-5); }
.tq-seg label {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.tq-seg label:has(input:checked) { border-color: var(--color-accent-text); outline: 1px solid var(--color-accent-text); }
.tq-seg input { margin-top: 3px; }
.tq-seg b { display: block; font-weight: var(--type-weight-semibold); }
.tq-seg small { display: block; color: var(--color-text-muted); font-size: var(--type-size-sm); }

.tq-mock { background: var(--color-surface); border: 1px solid var(--color-border-strong); }
.tq-mock__bar {
  margin: 0;
  padding: var(--space-2) var(--space-4);
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  font-family: var(--type-family-mono);
  font-size: var(--type-size-xs);
}
.tq-assume { padding: var(--space-5); background: var(--color-surface-muted); border-bottom: 1px solid var(--color-border); font-size: var(--type-size-base); }
.tq-assume__q { margin-bottom: var(--space-4); font-family: var(--type-family-display); font-size: var(--type-size-xl); line-height: 1.3; }
.tq-assume__q em { color: var(--color-accent-text); font-style: italic; }
.tq-assume__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: var(--space-3) var(--space-6); margin-bottom: var(--space-4); }
.tq-assume__grid dt { color: var(--color-text-muted); font-size: var(--type-size-xs); letter-spacing: 0.06em; text-transform: uppercase; }
.tq-assume__grid dd { margin: 0; }
.tq-assume__not { margin: 0; padding-top: var(--space-3); color: var(--color-text-muted); border-top: 1px solid var(--color-border); font-size: var(--type-size-sm); }
.tq-assume__not b { color: var(--color-text); font-weight: var(--type-weight-semibold); }
.tq-mock__body { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); padding: var(--space-5); }
.tq-mock__body span { height: 56px; background: var(--color-surface-strong); opacity: 0.6; }
.tq-mock__body .tq-mock__wide { grid-column: span 2; height: 112px; }
.tq-mock__body .tq-mock__tall { height: 112px; }
.tq-copy { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-top: var(--space-4); }

/* ---------- Close ---------- */
.tq-close { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--space-10); }
.tq-close__quote { margin: 0; font-family: var(--type-family-display); font-size: var(--type-display-md); line-height: 1.35; }
.tq-close p { font-size: var(--type-size-base); }

@media (max-width: 960px) {
  .tq-controls { grid-template-columns: minmax(0, 1fr); }
  .tq-flip, .tq-drift, .tq-banner, .tq-close { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .tq-duel { grid-template-columns: minmax(0, 1fr); }
  .tq-vs { justify-self: start; }
  .tq-cgroup { grid-template-columns: minmax(0, 1fr); }
  .tq-key { margin-left: 0; margin-right: var(--space-4); }
  .tq-matrix { border-spacing: 2px; font-size: var(--type-size-xs); }
  .tq-matrix th, .tq-matrix__corner { padding: var(--space-1); }
  .tq-cell { min-width: 0; padding: var(--space-2) var(--space-1); }
  .tq-cell__amt { font-size: var(--type-size-base); }
  .tq-cell__tag { display: none; }
  .tq-mock__body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
