/* =========================================================================
   Attitude-Behaviour Gap Laboratory — tool-specific styling
   -------------------------------------------------------------------------
   Shared page furniture comes from components/tool-kit.css. What is
   particular here: the four colleague cards in experiment 1, the contribution
   chart in experiment 2 and the scatterplot in experiment 3.
   ========================================================================= */

#ab-lab .interactive__controls,
#ab-lab .interactive__stage {
  min-width: 0;
}

@media (min-width: 52em) {
  #ab-lab .interactive__body {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

@media (min-width: 76em) {
  #ab-lab .interactive__body {
    grid-template-columns: minmax(0, 26rem) minmax(0, 1fr);
  }
}

/* -------------------------------------------------------------------------
   Colleague cards
   ---------------------------------------------------------------------- */

.person {
  margin: 0 0 var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--colour-border);
  border-radius: var(--radius-md);
  background-color: var(--colour-surface-raised);
}

/* A <legend> is painted on the fieldset's top border, so floating it makes it
   lay out as an ordinary block without changing the element or its
   announcement with each radio. */
.person__legend {
  float: left;
  width: 100%;
  padding: 0;
  margin: 0;
  font-size: var(--text-base);
  font-weight: 650;
  letter-spacing: normal;
  text-transform: none;
  color: var(--colour-text);
}

.person__blurb {
  clear: both;
  margin: 0.2rem 0 var(--space-2);
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--colour-text-muted);
}

.person .control--choice {
  min-height: 2.75rem;
  font-size: var(--text-sm);
}

/* -------------------------------------------------------------------------
   Nested fieldsets in experiment 3
   ---------------------------------------------------------------------- */

.subfield {
  margin: 0 0 var(--space-3);
  padding: 0;
  border: 0;
}

.subfield legend {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--colour-text-muted);
}

.subfield .control--choice {
  align-items: flex-start;
  gap: 0.6rem;
  font-size: var(--text-sm);
  line-height: 1.35;
}

.subfield .control--choice input {
  margin-top: 0.3rem;
}

/* -------------------------------------------------------------------------
   Stage navigation
   ---------------------------------------------------------------------- */

.stage-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.stage-nav .button {
  min-height: 2.75rem;
}

/* -------------------------------------------------------------------------
   Results
   ---------------------------------------------------------------------- */

.prevalence {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 650;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.driver {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--colour-text-muted);
}

.spec__coherence {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border-left: 4px solid var(--colour-border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--colour-surface);
  font-size: var(--text-sm);
}

.spec__coherence[data-state="ok"] {
  border-left-color: var(--colour-neuropsychology);
}

.spec__coherence[data-state="tension"] {
  border-left-color: var(--colour-social-critical-psychology);
}

/* A near-square viewBox stretched across the stage column becomes needlessly
   tall, so both charts are capped. */
/* The id prefix is load-bearing, not decoration. interactive-shell.css sets
   `.interactive__stage svg { max-width: 100% }`, whose specificity (0,1,1)
   beats a bare class rule here, so an unprefixed cap is silently ignored
   and the chart stretches to the full stage width. */
#ab-lab .contribution-chart {
  max-width: 26rem;
}

/* The id prefix is load-bearing, not decoration. interactive-shell.css sets
   `.interactive__stage svg { max-width: 100% }`, whose specificity (0,1,1)
   beats a bare class rule here, so an unprefixed cap is silently ignored
   and the chart stretches to the full stage width. */
#ab-lab .scatter-chart {
  max-width: 20rem;
}

/* Every bar prints its own signed value beside it, so direction never depends
   on the fill. */
.bar--adds {
  fill: var(--colour-accent);
}

.bar--subtracts {
  fill: var(--colour-social-critical-psychology);
}

.chart__point {
  fill: var(--colour-accent);
  fill-opacity: 0.55;
}

.data-table td[data-match="no"] {
  font-weight: 700;
}

.data-table td[data-emphasis="yes"],
.chart__table td[data-emphasis="yes"] {
  font-weight: 700;
  background-color: var(--colour-accent-soft);
}

/* -------------------------------------------------------------------------
   Challenge results
   ---------------------------------------------------------------------- */

.claims__results {
  margin: var(--space-3) 0 0;
  padding-left: 1.2rem;
  display: grid;
  gap: var(--space-3);
}

.claims__results > li {
  margin-top: 0;
  padding-left: var(--space-3);
  border-left: 3px solid var(--colour-border-strong);
}

.claims__results > li[data-agreed="yes"] {
  border-left-color: var(--colour-neuropsychology);
}

.claims__results > li[data-agreed="no"] {
  border-left-color: var(--colour-social-critical-psychology);
}

.claims__result-head {
  margin: 0 0 var(--space-1);
}

.claims__evidence {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  color: var(--colour-text-muted);
}

/* -------------------------------------------------------------------------
   Forced colours
   ---------------------------------------------------------------------- */

@media (forced-colors: active) {
  .person,
  .spec__coherence,
  .claims__results > li {
    border: 1px solid CanvasText;
  }

  .bar--adds,
  .chart__point {
    fill: Highlight;
  }

  .bar--subtracts {
    fill: CanvasText;
  }

  .data-table td[data-emphasis="yes"],
  .chart__table td[data-emphasis="yes"] {
    border: 2px solid Highlight;
  }
}
