/* Share preview (pages/share_preview.cljs, #/p/:token): the editor's post
   column as a white panel and its slide floating on the grey page
   (docs/design-system.md, Editor). Two equal side tracks keep the slide in the
   middle of the window: the panel ends the left one, the spacer fills the
   right one. */

.share-preview {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-6);
}

/* As tall as the slide beside it. */
.share-preview__panel {
  justify-self: end;
  align-self: stretch;
  width: 300px;
  max-width: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  padding: var(--space-6);
  background: var(--color-bg-surface);
  border-radius: var(--border-radius);
}

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

.share-preview__heading {
  margin: 0;
  font-size: var(--text-body);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
}

.share-preview__slide {
  position: relative;
  height: min(calc(100vh - 2 * var(--space-6)), 1040px);
  aspect-ratio: 9 / 16;
  max-width: 100%;
  overflow: hidden;
  background: var(--color-bg-surface);
  border-radius: var(--radius-media);
  box-shadow: var(--shadow-slide);
}

.share-preview__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.share-preview__spacer {
  visibility: hidden;
}

/* Loading and missing states hold one element: the middle track. */
.share-preview__loading {
  grid-column: 2;
  padding: var(--space-12);
}

.share-preview__missing {
  grid-column: 2;
  max-width: 480px;
  padding: var(--space-8) 0;
}

/* Phone: the panel over the slide, both the width of the screen. */
@media (max-width: 860px) {
  .share-preview {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: var(--space-4);
    padding: var(--space-4);
  }

  .share-preview__loading,
  .share-preview__missing {
    grid-column: 1;
    justify-self: center;
  }

  .share-preview__panel {
    justify-self: stretch;
    width: 100%;
  }

  .share-preview__slide {
    width: 100%;
    height: auto;
  }

  .share-preview__spacer {
    display: none;
  }
}
