/* ===========================================================================
   The colour tool — the ramp index and the printed proof.

   Plate owns the ground, faces and washes. This file adds one primitive (the
   ramp row: a radio, a swatch strip, a name) and the proof/code metrics. The
   strips are content, not decoration: each one is the ramp the player selects.
   =========================================================================== */

.cb-index {
  display: grid;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.cb-index > .pl-bench__label {
  width: 100%;
  padding-inline: var(--s3);
}
/* `display: grid` on a row would otherwise beat the user-agent's [hidden]. */
.cb-index [hidden] { display: none; }

.cb-filter {
  margin: 0;
  padding: var(--s3) var(--s3) 0;
}
.cb-filter input { font-size: var(--fs-meta); }

.cb-none {
  margin: 0;
  padding: var(--s3);
  font-style: italic;
  color: var(--line-2);
}

.cb-family {
  display: block;
  padding: var(--s3) var(--s3) var(--s1);
  border-bottom: 1px solid var(--rule);
  font-family: var(--f-legend);
  font-size: var(--fs-legend);
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--line-2);
}

.cb-ramp {
  position: relative;
  display: grid;
  gap: 3px;
  padding: var(--s2) var(--s3);
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
}
.cb-ramp:hover { background: var(--plate-hi); }
.cb-ramp:has(input:checked) {
  background: var(--ochre-faint);
  box-shadow: inset 2px 0 0 var(--ochre);
}
/* The radio keeps its semantics and its keyboard, and loses its box: the row
   is the control. Focus is drawn on the strip it selects. */
.cb-ramp input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.cb-ramp input:focus-visible ~ .cb-ramp__strip {
  outline: 2px solid var(--ochre);
  outline-offset: 2px;
}
.cb-ramp__strip {
  display: block;
  height: 10px;
  border: 1px solid var(--rule-hair);
}
.cb-ramp input:checked ~ .cb-ramp__strip { border-color: var(--ochre); }

.cb-ramp__name {
  font-family: var(--f-legend);
  font-size: var(--fs-legend);
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--line-2);
}
.cb-ramp input:checked ~ .cb-ramp__name { color: var(--line); }

/* --- proof ---------------------------------------------------------------- */

.cb-proof {
  min-height: 104px;
  max-height: 42vh;
  overflow: auto;
  overscroll-behavior: contain;
  font-size: var(--fs);
  line-height: 1.7;
}

.cb-codes {
  min-height: 104px;
  font-family: var(--f-data);
  font-size: var(--fs-meta);
  line-height: 1.6;
}

.cb-count {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--s2);
  margin: var(--s3) 0 0;
  font-size: var(--fs-meta);
  color: var(--line-2);
}
.cb-count__num {
  font-family: var(--f-data);
  color: var(--line);
}

@media (max-width: 720px) {
  /* The bench stacks on a phone, and a hundred ramps between the reader and
     the line is a page nobody reaches the bottom of. The index scrolls in
     place instead. */
  .cb-index { max-height: 42vh; overflow-y: auto; }
  .cb-ramp { padding: var(--s2); }
  .cb-ramp__strip { height: 12px; }
}
