/* Compaction Lab (when-context-turns-against-you post). Token-driven only: every colour is a site token, so the light
   and dark themes follow the tokens and no theme-specific rule is needed. Loaded by the post itself. */
.cpl {
  --cpl-target: 2.75rem; /* 44 CSS px touch target (WCAG 2.5.5) */
  margin: var(--space-lg) 0;
  padding: var(--space-md);
  border: thin solid var(--color-border);
  border-radius: 0.5em;
  background: var(--color-bg-alt);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.45;
  max-width: 100%;
  min-width: 0;
}
.cpl[hidden] { display: none; }
.cpl__eyebrow { margin: 0; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-muted); }
.cpl__title { margin: 0 0 0.2em; font-weight: 700; font-size: var(--text-base); }
.cpl__note { margin: 0 0 var(--space-sm); color: var(--color-text-muted); font-size: var(--text-xs); font-style: italic; }
.cpl__panel-title {
  margin: var(--space-md) 0 var(--space-xs); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-muted);
}

/* The session, folded by default so the controls and the result sit together */
.cpl__session { margin: 0 0 var(--space-sm); }
.cpl__session > summary { min-height: var(--cpl-target); display: flex; align-items: center; gap: 0.4em; cursor: pointer; font-weight: 600; font-size: var(--text-ui); list-style: none; }
.cpl__session > summary::-webkit-details-marker { display: none; }
.cpl__session > summary::before { content: "\25B8"; color: var(--color-text-muted); }
.cpl__session[open] > summary::before { content: "\25BE"; }
.cpl__session > summary:focus-visible { outline: 0.2em solid var(--color-accent); outline-offset: 0.1em; }

.cpl__policy { margin: 0; padding: var(--space-xs) var(--space-sm) var(--space-sm); border: thin solid var(--color-border); border-radius: 0.4em; min-width: 0; }
.cpl__policy legend { padding: 0 0.25em; }
.cpl__label { font-weight: 600; font-size: var(--text-ui); }
.cpl__radio { display: flex; align-items: center; gap: 0.5em; min-height: var(--cpl-target); cursor: pointer; }
.cpl__radio input { width: 1.1em; height: 1.1em; margin: 0; accent-color: var(--color-accent); flex: none; }
.cpl__radio input:focus-visible { outline: 0.2em solid var(--color-accent); outline-offset: 0.1em; }

/* The result: five numbers and one sentence, right under the choice */
.cpl__result { margin: var(--space-sm) 0 0; }
.cpl__stats { display: grid; gap: var(--space-xs) var(--space-md); grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
@media (min-width: 40em) { .cpl__stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.cpl__stat { min-width: 0; }
.cpl__stat dt { font-size: var(--text-xs); color: var(--color-text-muted); }
.cpl__stat dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cpl__stat:first-child, .cpl__stat:last-child { grid-column: 1 / -1; }
.cpl__verdict {
  margin: var(--space-sm) 0 0; padding-left: var(--space-xs); border-left: 0.25em solid var(--color-accent);
  font-family: var(--font-serif); font-size: var(--text-base);
}

/* The window, block by block */
.cpl ol.cpl__list { margin: 0; padding: 0; list-style: none; }
.cpl li.cpl__item { margin: 0; }
.cpl__item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 var(--space-sm);
  padding: 0.4em 0 0.4em var(--space-xs); border-bottom: thin solid var(--color-border); border-left: 0.25em solid transparent;
}
.cpl__who { grid-column: 1 / -1; font-size: var(--text-xs); font-weight: 600; color: var(--color-text-muted); }
.cpl__text { min-width: 0; overflow-wrap: anywhere; }
.cpl__tok { font-size: var(--text-xs); color: var(--color-text-muted); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.cpl__tok::after { content: " tokens"; }
.cpl__item--tool { border-left-color: var(--color-pop-gold); }
.cpl__item--cleared { border-left-color: var(--color-border); color: var(--color-text-muted); }
.cpl__item--summary { border-left-color: var(--color-pop-coral); }
.cpl__item--record { border-left-color: var(--color-accent); }
.cpl__item--fixed { border-left-color: var(--color-pop-violet); }
.cpl__was { font-size: var(--text-xs); }
.cpl__line { display: block; }
.cpl__line--gone { color: var(--color-text-muted); }

/* Marks: the shape differs as well as the colour, so the clash reads without colour */
.cpl__mark { background: transparent; color: inherit; font-weight: 700; padding: 0 0.1em; }
.cpl__mark--old { border-bottom: 0.15em solid var(--color-pop-coral); }
.cpl__mark--new { border-bottom: 0.3em double var(--color-accent); }
.cpl__mark--gone { font-weight: 400; text-decoration: line-through; }
