/* =========================================================================
   Constructing a Category — tool-specific styling
   -------------------------------------------------------------------------
   Shared page furniture comes from components/tool-kit.css. What is
   particular here: the account cards, the feature checklist with its two
   counts, the institutional-event fieldsets and the two small bar charts.
   ========================================================================= */

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

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

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

/* -------------------------------------------------------------------------
   The accounts
   ---------------------------------------------------------------------- */

.accounts {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  margin: 0;
  padding: 0 0 0 1.2rem;
}

.accounts > li {
  margin-top: 0;
  padding: var(--space-3);
  border: 1px solid var(--colour-border);
  border-left: 4px solid var(--colour-social-critical-psychology);
  border-radius: var(--radius-sm);
  background-color: var(--colour-surface-raised);
}

.account__text {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.5;
}

.accounts--compact {
  grid-template-columns: 1fr;
  gap: var(--space-2);
}

.accounts--compact .account__text {
  font-size: var(--text-xs);
}

/* -------------------------------------------------------------------------
   Feature checklist
   ---------------------------------------------------------------------- */

.feature-option {
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.2rem 0;
  font-size: var(--text-sm);
  line-height: 1.35;
}

.feature-option input {
  margin-top: 0.3rem;
}

.feature-option__body {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

/* Both counts are printed, so no judgement about a feature depends on
   reading the table beside it. */
.feature-option__counts {
  font-size: var(--text-xs);
  color: var(--colour-text-muted);
  font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------------------
   Institutional events
   ---------------------------------------------------------------------- */

.event {
  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> paints on the fieldset's top border and spills out when it
   wraps; floating it lays it out as a block without changing the element. */
.event__legend {
  float: left;
  width: 100%;
  padding: 0 0 var(--space-2);
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: normal;
  text-transform: none;
  color: var(--colour-text);
}

.event__option {
  clear: both;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: var(--text-sm);
  line-height: 1.35;
}

.event__option 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;
}

.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);
}

/* Both charts are small and wide; without a cap they stretch to the column
   width and become needlessly tall on a projector. */
.boundary-chart,
/* 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. */
#category-lab .status-chart {
  max-width: 30rem;
}

/* Each band also prints its own count beside the bar and appears in the
   table below, so the fills are redundant. */
.band--meets {
  fill: var(--colour-accent);
}

.band--near {
  fill: var(--colour-cognitive);
}

.band--outside {
  fill: var(--colour-border-strong);
}

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

/* -------------------------------------------------------------------------
   Consequences
   ---------------------------------------------------------------------- */

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

.consequences > li {
  margin-top: 0;
}

.consequence__choice {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 650;
}

.consequence__text,
.consequence__lost {
  margin: var(--space-1) 0 0;
  font-size: var(--text-sm);
  color: var(--colour-text-muted);
}

.consequence--final {
  list-style: none;
  margin-left: -1.2rem;
  padding: var(--space-3);
  border-left: 4px solid var(--colour-social-critical-psychology);
  border-radius: var(--radius-sm);
  background-color: var(--colour-surface);
}

.consequence--final .consequence__text {
  color: var(--colour-text);
}

/* -------------------------------------------------------------------------
   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__result-head {
  margin: 0 0 var(--space-1);
}

.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);
}

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

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

  .band--meets {
    fill: Highlight;
  }

  .band--near,
  .band--outside {
    fill: CanvasText;
  }
}
