/* ── a code on an egg ──────────────────────────────────────────────────── */

/* The nine characters of an egg code, drawn as cells on the egg they were cut into.
   The hatch page shows this as the gate somebody types a code into, and the dialog that
   lays an egg shows the same picture with the code already on it — one presentation, so
   the code somebody copies is the code they will be asked for, sitting in the same place
   on the same picture. It is a sheet of its own rather than part of style.css because it
   is a component with two callers and no third: the hatch page links it beside style.css,
   and the app links it for the dialog, and neither page loads the other's sheets. */
.code-egg {
  position: relative;
  display: grid;
  place-items: center;
  width: 360px;
  max-width: 100%;
  aspect-ratio: 1;
  margin: 0 auto;
  background-image: url("/art/egg-hatch.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 360px 360px;
  image-rendering: pixelated;
}

/* A display value beats the hidden attribute, so hiding has to be said out loud. */
.code-egg[hidden] {
  display: none;
}

/* Three rows of three: a code is nine characters and it reads as a grid on the egg,
   not as one long line off its edge. */
.slots {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 56px);
  grid-template-rows: repeat(3, 56px);
  gap: 8px;
}

.slot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border: 1px solid var(--border-2);
  background: var(--panel-2);
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 1.6rem;
  text-transform: uppercase;
  user-select: none;
}

.slot.filled {
  color: var(--text);
}

.slot.active {
  border-color: var(--accent);
  background: var(--panel-3);
}

/* A code the nest would not take, and one it did: the colour is the border and the
   letters, so a flash is a reading of the cells rather than a picture over them. */
.slots.bad .slot {
  border-color: var(--err);
  color: var(--err);
  background: var(--panel-2);
}

.slots.ok .slot {
  border-color: var(--ok);
  color: var(--ok);
  background: var(--panel-2);
}
