/* Kasauti home: the hero (brief v4, 5.1), "Break the survey" (5.2) and strictness (5.4).
   Visual direction "evidence is the ornament": the survey is drawn as it is, one cell per interview,
   inside crop marks on the ledger grid. Nothing moves unless the visitor changes something. */

/* ---------- Hero: the claim on the left, the two ways in on the right ---------- */

.hero--split {
  display: grid;
  gap: 1.5rem 4rem;
  padding: 3.5rem 0 2.25rem;
}

.hero--split > * {
  min-width: 0;
}

.hero--split h1 {
  max-width: 14em;
  margin: 0;
  font-size: clamp(2.3rem, 1.4rem + 3.6vw, 4.5rem);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.015em;
}

@media (min-width: 62rem) {
  .hero--split {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    align-items: end;
  }
}

.hero-side {
  display: grid;
  gap: 0.9rem;
}

.hero-side p {
  margin: 0;
}

.hero .hero-actions {
  margin: 0;
}

.hero-actions .btn {
  display: inline-flex;
  align-items: center;
  min-height: 3.25rem;
  padding: 0 1.5rem;
  border-width: 1.5px;
  border-radius: 2px;
}

.hero-promise {
  font-weight: 600;
}

.hero-promise a {
  font-weight: 500;
}

/* ---------- The sandbox ---------- */

.sbx {
  margin: 0 0 1rem;
}

.sbx-tool {
  padding: clamp(1rem, 3vw, 2rem) clamp(0.9rem, 3vw, 2rem) clamp(0.9rem, 2.5vw, 1.5rem);
}

.sbx-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1.5rem;
  margin-bottom: 1.5rem;
}

.sbx-top h2 {
  margin: 0;
  font-size: clamp(1.7rem, 1.4rem + 1.4vw, 2.25rem);
  font-weight: 500;
}

.sbx-top .yb-label {
  text-transform: none;
  letter-spacing: 0.02em;
}

.sbx-top .yb-label b {
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* The unit chart: 30 columns, one per enumerator; 20 cells, one per interview. */
.uc {
  display: grid;
  grid-template-columns: repeat(30, minmax(0, 1fr));
  gap: clamp(2px, 0.8vw, 10px);
  align-items: end;
}

.uc__col {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.uc__cells {
  display: flex;
  flex-direction: column-reverse;
  gap: clamp(1px, 0.3vw, 3px);
  width: min(100%, 1rem);
}

.uc__cells i {
  display: block;
  height: clamp(5px, 1.1vw, 9px);
  border: 1px solid var(--yb-rule);
}

.uc__cells i.on {
  border-color: var(--yb-kasauti);
  background: var(--yb-kasauti);
}

.uc__col.is-changed .uc__cells {
  outline: 1.5px solid var(--yb-ink);
  outline-offset: 2px;
}

.uc__label {
  height: 3.6rem;
  font-family: var(--yb-mono);
  font-size: 0.625rem;
  line-height: 1;
  white-space: nowrap;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: var(--yb-ink);
}

.uc-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1.5rem;
  margin: 1rem 0 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--yb-rule);
  font-size: 0.875rem;
  color: var(--yb-soft);
}

.uc-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.uc-legend i {
  width: 1rem;
  height: 0.55rem;
  border: 1px solid var(--yb-rule);
}

.uc-legend i.on {
  border-color: var(--yb-kasauti);
  background: var(--yb-kasauti);
}

/* Add a problem */
.sb-controls {
  margin-top: 1.5rem;
}

.sb-controls__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.75rem;
}

.sb-controls .yb-label {
  margin-right: 0.5rem;
}

.controls {
  display: contents;
  list-style: none;
}

.controls li {
  display: contents;
}

.toggle {
  min-height: 2.75rem;
  padding: 0 1.1rem;
  border: 1.5px solid var(--yb-ink);
  border-radius: 2px;
  background: transparent;
  color: var(--yb-ink);
  font: 600 0.9375rem/1.2 var(--sans);
  cursor: pointer;
}

.toggle[aria-pressed='true'] {
  border-color: var(--yb-kasauti);
  background: var(--yb-kasauti);
  color: #fff;
}

.sb-summary {
  margin: 1rem 0 0;
  padding: 0.6rem 0.8rem;
  border-left: 3px solid var(--yb-kasauti);
  background: var(--yb-paper-2);
  font-size: 0.9375rem;
}

.sb-controls p + p {
  margin: 0.75rem 0 0;
}

/* Strictness */
.levels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  max-width: 34rem;
  margin: 1.75rem 0 0;
  padding: 0;
  border: 0;
}

.levels legend {
  margin-bottom: 0.5rem;
  padding: 0;
  font-family: var(--yb-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--yb-soft);
}

.level {
  position: relative;
  display: grid;
  gap: 0.1rem;
  min-height: 3.5rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--yb-rule);
  cursor: pointer;
}

.level input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.level__name {
  font-weight: 600;
}

.level__n {
  font-family: var(--yb-mono);
  font-size: 0.75rem;
  color: var(--yb-soft);
}

.level:has(input:checked) {
  border-color: var(--yb-ink);
  box-shadow: inset 0 0 0 1px var(--yb-ink);
  background: var(--yb-paper-2);
}

.level:has(input:focus-visible) {
  outline: 2px solid var(--yb-kasauti);
  outline-offset: 2px;
}

.sbx .note {
  margin: 0.5rem 0 0;
  padding: 0;
  border: 0;
  font-size: 0.875rem;
  color: var(--yb-soft);
}

/* Why each enumerator is flagged: the ranked table, folded away under the chart. */
.sb-why {
  margin-top: 1.5rem;
  border-block: 1px solid var(--yb-rule);
}

.sb-why summary {
  padding: 0.85rem 0;
  font-weight: 600;
  cursor: pointer;
}

.rank {
  width: 100%;
  margin: 0 0 1rem;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.rank thead th {
  padding: 0 0.5rem 0.4rem 0;
  border-bottom: 1px solid var(--yb-ink);
  font: 400 0.75rem/1.3 var(--yb-mono);
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
  color: var(--yb-soft);
}

.rank td,
.rank tbody th {
  padding: 0.5rem 0.75rem 0.5rem 0;
  border-bottom: 1px solid var(--yb-rule);
  font-weight: 400;
  text-align: left;
  vertical-align: top;
}

.rank code,
.bc code {
  font-family: var(--yb-mono);
  font-size: 0.8125rem;
}

.rank .rk {
  width: 2.5rem;
  color: var(--yb-soft);
  font-family: var(--yb-mono);
  font-size: 0.8125rem;
}

.rank .fl {
  width: 11rem;
  white-space: nowrap;
  font-family: var(--yb-mono);
  font-size: 0.8125rem;
}

.rank .why {
  color: var(--yb-soft);
}

.rank tr[data-listed] .why {
  color: var(--yb-ink);
}

.rank tr.changed th code {
  box-shadow: 0 0 0 2px var(--yb-paper), 0 0 0 3.5px var(--yb-ink);
}

.mark {
  display: inline-block;
  width: 5rem;
  height: 0.55rem;
  margin-right: 0.5rem;
  background: linear-gradient(var(--yb-rule), var(--yb-rule)) no-repeat left / var(--w, 0%) 100%;
  outline: 1px solid var(--yb-rule);
}

tr[data-listed] .mark {
  background-image: linear-gradient(var(--yb-kasauti), var(--yb-kasauti));
}

@media (max-width: 47.99em) {
  .rank thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .rank tr {
    display: grid;
    grid-template-columns: 2rem 1fr auto;
    gap: 0 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--yb-rule);
  }

  .rank td,
  .rank tbody th {
    width: auto;
    padding: 0;
    border: 0;
  }

  .rank .why {
    grid-column: 2 / -1;
    margin-top: 0.2rem;
    font-size: 0.875rem;
  }

  .mark {
    width: 3.5rem;
  }
}

.sbx-next {
  margin-top: 1.25rem;
  font-size: 0.95rem;
}

/* ---------- Check cards: the threshold is the evidence, so it speaks in the evidence voice ---------- */

.check .yb-label {
  margin-bottom: 0.35rem;
}

.check dd.check__rule {
  font-family: var(--yb-mono);
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--yb-kasauti);
}

/* The hidden attribute wins over .btn and friends. */
.sbx [hidden] {
  display: none !important;
}
