/* The image viewer (components/image_viewer.cljs): one image of a grid in
   a wide modal, a 9:16 frame as tall as 70% of the window allows at the
   left, the column of the image's facts and actions at the right, under
   it on a phone (docs/design-system.md, Images). The frame never takes
   the room the column needs: 240px stay beside it. */

.image-viewer {
  display: grid;
  grid-template-columns: min(calc(70vh * 9 / 16), calc(100% - 240px - var(--space-6))) minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}

.image-viewer--no-column {
  display: flex;
  justify-content: center;
}

.image-viewer__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: var(--radius-media);
  overflow: hidden;
  background: var(--color-bg-page);
}

.image-viewer--no-column .image-viewer__frame {
  width: min(100%, calc(70vh * 9 / 16));
}

/* The original lies over the thumbnail and shows once it has loaded. */
.image-viewer__thumb,
.image-viewer__original {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-viewer__original.is-loading {
  opacity: 0;
}

.image-viewer__column {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  min-width: 0;
}

.image-viewer__actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

@media (max-width: 860px) {
  .image-viewer {
    grid-template-columns: minmax(0, 1fr);
  }

  .image-viewer__frame {
    width: min(100%, calc(70vh * 9 / 16));
    justify-self: center;
  }
}
