/*
  The portrait ships dithered and resolves to the real photograph on hover —
  the dither is a cover, not the picture. Touch devices get the same reveal by
  tapping, via .is-revealed.
*/
.dither {
  position: relative;
  flex: none;
  width: 9rem; /* 6 × --step, so the portrait sits on the text grid */
  aspect-ratio: 1;
  overflow: hidden;
  /* Also the dither's paper colour: JS reads it back resolved, which sidesteps
     parsing light-dark() out of a custom property. */
  background: var(--dither-paper);
  border: 1px solid var(--page-rule);
  display: block;
  padding: 0;
}

.dither__photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.dither__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  color: var(--dither-ink); /* read back resolved by dither.js */
  /* Stepped, not smooth — it should read as a mode switch, not a crossfade. */
  transition: opacity calc(var(--motion-step) * 4) steps(5, end);
}

.dither:hover .dither__canvas,
.dither:focus-visible .dither__canvas,
.dither.is-revealed .dither__canvas {
  opacity: 0;
}

.dither:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

@media (max-width: 34rem) {
  .dither {
    width: 6rem; /* 4 × --step */
  }
}
