/* Packet Switching — a Logical Art nibble.
 *
 * The subject is a grid of stations and what is left of it, so the page is a
 * grid and a curve and nothing else. Colour carries exactly two facts: whether
 * a station is still standing, and whether it is still in contact with the
 * largest group. Those are different, and the difference is Baran's whole
 * criterion, so they must not be distinguishable by hue alone.
 *
 * The machine takes the studio neutral. la-accent-pick.py reports no colour
 * left that clears both the distance and contrast floors against the accents
 * already published.
 */

* { margin: 0; padding: 0; box-sizing: border-box; }

main.nibble {
  max-width: var(--la-measure);
  margin: 0 auto;
  padding: 3rem 1.25rem 3rem;
}
main.nibble p, main.nibble ul, main.nibble ol, main.nibble dl,
main.nibble h1, main.nibble h2 { max-width: none; }

body {
  font-family: var(--la-font-ui);
  background: var(--la-page);
  color: var(--la-ink);
  line-height: var(--la-leading-body);
  -webkit-font-smoothing: antialiased;
}

.pk-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

.pk-steplabel { margin: var(--la-space-5) 0 var(--la-space-2); font-weight: 600; color: var(--la-ink); }
.pk-stepno {
  display: inline-block; min-width: 1.6rem; margin-right: 0.5rem;
  padding: 0.05rem 0.5rem; border: 1px solid var(--la-hairline-strong);
  border-radius: 999px; font-family: var(--la-font-mono);
  font-size: var(--la-text-xs); color: var(--la-ink-dim); text-align: center;
}

.pk-controls {
  display: flex; flex-wrap: wrap; align-items: end;
  gap: var(--la-space-2); margin: var(--la-space-3) 0;
}
.pk-field label { display: block; margin-bottom: 0.35rem; color: var(--la-ink-dim); font-size: var(--la-text-sm); }
.pk-range { width: 100%; max-width: 20rem; accent-color: var(--la-instrument); }
.pk-btn {
  padding: 0.45rem 0.9rem; border: 1px solid var(--la-hairline-strong);
  border-radius: var(--la-radius-sm, 4px); background: var(--la-raised);
  color: var(--la-ink); font-family: var(--la-font-mono); font-size: var(--la-text-sm);
  cursor: pointer;
}
.pk-btn:hover { border-color: var(--la-instrument); }
.pk-btn[aria-pressed="true"] { border-color: var(--la-instrument); color: var(--la-instrument); }
.pk-btn:focus-visible { outline: 2px solid var(--la-instrument); outline-offset: 2px; }

/* The array. Eighteen by eighteen, so the cell is small and the state has to
   read at that size: destroyed is empty, standing-but-cut-off is an outline,
   in-the-largest-group is filled. Three states, three shapes, not three hues. */
.pk-array {
  display: grid; grid-template-columns: repeat(18, 1fr);
  gap: 2px; margin: var(--la-space-3) 0;
  max-width: 30rem;
}
.pk-cell {
  aspect-ratio: 1; border-radius: 2px;
  border: 1px solid transparent; background: transparent;
}
/* Four states, and each is a different SHAPE as well as a different tone,
   because destroyed-versus-standing has to survive a monochrome print and a
   first draft where both were outlines was unreadable on a real screen.

     gone      empty, hairline only            the station is destroyed
     standing  filled, dim                     it survived; stage two knows no more
     cut       outlined, bright                it survived and is cut off
     in        filled, bright                  it survived and is in contact  */
.pk-cell[data-state="gone"] { border-color: var(--la-hairline); }
.pk-cell[data-state="standing"] { background: var(--la-ink-dim); border-color: var(--la-ink-dim); }
.pk-cell[data-state="cut"] { border-color: var(--la-ink); }
.pk-cell[data-state="in"] { background: var(--la-instrument); border-color: var(--la-instrument); }

.pk-said { margin: var(--la-space-3) 0 0; color: var(--la-ink-dim); font-size: var(--la-text-sm); }

.pk-table { width: 100%; border-collapse: collapse; font-size: var(--la-text-sm); }
.pk-table th, .pk-table td {
  text-align: left; padding: 0.35rem 0.6rem; border-bottom: 1px solid var(--la-hairline);
}
.pk-table thead th {
  font-size: var(--la-text-xs); letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--la-ink-dim); font-weight: 600;
}
.pk-table td { font-family: var(--la-font-mono); font-size: 0.8rem; color: var(--la-ink-dim); }
.pk-table tr[data-here="yes"] td { color: var(--la-ink); }
.pk-table tr[data-here="yes"] td:first-child {
  border-left: 3px solid var(--la-instrument); padding-left: 0.45rem;
}

.pk-checks { width: 100%; border-collapse: collapse; font-size: var(--la-text-sm); }
.pk-checks th, .pk-checks td {
  text-align: left; padding: 0.35rem 0.6rem; border-bottom: 1px solid var(--la-hairline);
  vertical-align: top;
}
.pk-checks thead th {
  font-size: var(--la-text-xs); letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--la-ink-dim); font-weight: 600;
}
.pk-checks td { color: var(--la-ink-dim); }
.pk-checks td:last-child { font-family: var(--la-font-mono); font-size: 0.8rem; }
.pk-checks tr[data-mark="bad"] td { color: var(--la-warn, #e0b341); }
