.cb {
  --unlit: #1c1d21;
  --white: #e4ecff;
  --white-core: #ffffff;
  --red: #ff2d1f;
  --red-core: #ffc2b8;
  position: relative;
  width: 540px;
  height: 540px;
  overflow: hidden;
  background-color: #050506;
  /* every lamp on the board, dark: a clear lens in a black face, catching the foyer light on its upper left */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Ccircle cx='2' cy='2' r='1.35' fill='%2316171b'/%3E%3Ccircle cx='2' cy='2' r='1.05' fill='%231d1e23'/%3E%3Ccircle cx='1.62' cy='1.6' r='0.42' fill='%2334363e'/%3E%3C/svg%3E");
  background-size: 4px 4px;
}

/* No two lamps give quite the same light, a few are tired, and the nine modules of the board were not all made
   in one batch: one pixel of this image to a lamp, multiplied over the board. */
.cb::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: url("./lamps.png") 0 0 / 540px 540px;
  image-rendering: pixelated;
  mix-blend-mode: multiply;
}

/* The face of the board: the joints between its modules, the foyer reflected in it, and the fall-off at its
   corners. */
.cb::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 179.5px, rgb(255 255 255 / 0.07) 179.5px, rgb(255 255 255 / 0.07) 180px, rgb(0 0 0 / 0.5) 180px, rgb(0 0 0 / 0.5) 180.5px, transparent 180.5px) 0 0 / 180px 100%,
    linear-gradient(180deg, transparent 179.5px, rgb(255 255 255 / 0.07) 179.5px, rgb(255 255 255 / 0.07) 180px, rgb(0 0 0 / 0.5) 180px, rgb(0 0 0 / 0.5) 180.5px, transparent 180.5px) 0 0 / 100% 180px,
    linear-gradient(112deg, transparent 18%, rgb(190 205 255 / 0.05) 34%, rgb(190 205 255 / 0.015) 47%, transparent 58%),
    radial-gradient(120% 120% at 46% 42%, transparent 55%, rgb(0 0 0 / 0.34) 100%);
}

.cb *,
.cb *::before,
.cb *::after {
  box-sizing: border-box;
}

.cb svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* a lit lamp: a 3 px body with a hotter centre */
.cb-lamp,
.cb-core {
  fill: none;
  stroke-linecap: round;
}

.cb-lamp {
  stroke: var(--white);
  stroke-width: 2.9;
}

.cb-core {
  stroke: var(--white-core);
  stroke-width: 1.5;
}

/* a lamp left dark inside a lit band: its cell goes black, so glyphs cut cleanly out of the bloom */
.cb-cell {
  fill: none;
  stroke: #050506;
  stroke-width: 4;
  stroke-linecap: square;
}

.cb-off {
  fill: none;
  stroke: var(--unlit);
  stroke-width: 2.6;
  stroke-linecap: round;
}

[data-tone="red"] .cb-lamp {
  stroke: var(--red);
}

[data-tone="red"] .cb-core {
  stroke: var(--red-core);
}

/* bloom: a tight halo round each lamp and a wide one that spills onto the board */
.cb-glow {
  position: absolute;
  inset: 0;
  filter: drop-shadow(0 0 0.8px rgb(170 195 255 / 0.55)) drop-shadow(0 0 7px rgb(120 155 255 / 0.42));
}

.cb-glow[data-tone="red"] {
  filter: drop-shadow(0 0 0.8px rgb(255 70 40 / 0.6)) drop-shadow(0 0 7px rgb(255 40 20 / 0.55));
}

.cb-wipe {
  position: absolute;
  inset: 0;
}

.cb-head {
  position: relative;
  height: 60px;
}

.cb-colon {
  animation: cb-beat 1s steps(1, end) infinite;
}

@keyframes cb-beat {
  50% {
    opacity: 0.22;
  }
}

.cb-list {
  display: block;
  margin: 0;
  padding: 0;
  outline: 0;
}

.cb-row {
  position: relative;
  display: block;
  height: 96px;
  outline: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.cb-row[data-selected] {
  z-index: 1;
}

.cb-ink,
.cb-band {
  position: absolute;
  inset: 0;
}

/* The chosen showing inverts: its band lights and its glyphs go dark. The band sweeps in from the left
   nine lamps at a time while the glyphs sweep out ahead of it. */
.cb-wipe {
  transition: clip-path 0.2s steps(15, end);
}

.cb-ink .cb-wipe {
  clip-path: inset(0 0 0 0);
}

.cb-band .cb-wipe {
  clip-path: inset(0 100% 0 0);
}

.cb-row[data-selected] .cb-ink .cb-wipe {
  clip-path: inset(0 0 0 100%);
}

.cb-row[data-selected] .cb-band .cb-wipe {
  clip-path: inset(0 0 0 0);
}

.cb-band .cb-glow {
  filter: drop-shadow(0 0 0.8px rgb(170 195 255 / 0.5)) drop-shadow(0 0 12px rgb(110 150 255 / 0.5));
}

/* under the pointer, the lamps of a row come up to a faint standby */
.cb-row::before {
  content: "";
  position: absolute;
  inset: 4px 0;
  background-position: 0 -4px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Ccircle cx='2' cy='2' r='1.3' fill='%2334373f'/%3E%3C/svg%3E");
  background-size: 4px 4px;
  opacity: 0;
}

.cb-row:not([data-disabled]):hover::before {
  opacity: 1;
}

/* a sold-out showing runs at low power; only its red notice stays bright */
.cb-row[data-disabled] {
  cursor: default;
}

.cb-row[data-disabled] [data-tone="white"] {
  opacity: 0.34;
}

/* keyboard focus: a dotted line of lamps round the band, stepping along it */
.cb .cb-ring {
  position: absolute;
  inset: 0;
  display: none;
  filter: drop-shadow(0 0 0.8px rgb(170 195 255 / 0.55)) drop-shadow(0 0 6px rgb(120 155 255 / 0.42));
}

.cb .cb-row:focus-visible .cb-ring {
  display: block;
}

.cb-ring g {
  animation: cb-step 0.5s steps(1, end) infinite;
}

.cb-ring g + g {
  animation-delay: -0.25s;
}

@keyframes cb-step {
  50% {
    opacity: 0;
  }
}

.cb-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .cb-wipe {
    transition: none;
  }

  .cb-colon,
  .cb-ring g {
    animation: none;
  }

  .cb-ring g + g {
    display: none;
  }
}
