@keyframes imgExpanded {
  from {
    opacity: 0.5;
    transform: translate(-50%, -48%) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

figure {
  cursor: zoom-in;
}

figure.zoom {
  border-radius: 0.5rem;
  margin: 0;
  width: inherit;
  max-width: 1000px;
  height: auto;
  z-index: var(--z-index-max);
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-height: 100dvh;
  overflow: auto;
  cursor: zoom-out;
  animation: imgExpanded 250ms ease-in-out;
}

article:has(.zoom)::before {
  content: "";
  background-color: rgba(0, 0, 0, 0.33);
  backdrop-filter: blur(4px);
  z-index: calc(var(--z-index-max) - 1);
  position: fixed;
  width: 100dvw;
  height: 100dvh;
  top: 0;
  left: 0;
}
