/* ============================================================================
   PictU — composite preview (editor + delivery)
   ----------------------------------------------------------------------------
   Both previews render the TRUE composite: the same JPEG every delivery path
   consumes, produced by compose.ts. main.ts sets `aspect-ratio` on
   .final-layout-container from the layout's real composite dimensions, so a
   3-wide strip is not forced square and a tall column is not cropped.

   The loose per-photo grid below is retained only as the fallback when
   composition fails, where main.ts sets `grid-template-columns: repeat(<perRow>,
   1fr)` instead of the aspect ratio.
   ========================================================================== */

.final-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 16rem;
  padding: var(--s-4);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--surface-sunken);
}

/* Once a photo set is present the well stops being an empty-state affordance
   and becomes a plain surface, so the image — not the frame — is the object. */
.final-preview:has(.final-layout-container) {
  border-style: solid;
  border-color: var(--line);
  background: var(--surface);
}

.final-layout-container {
  display: grid;
  gap: var(--s-2);
  width: 100%;
  /* Sized for a hero: the results-page preview fills its (now wider) column
     up to this cap; the delivery page keeps its own 32rem override. (The
     camera rail that used to share this class is gone — the camera page's
     composition grid is `#photosContainer` in style.css.) */
  max-width: 44rem;
  margin: 0 auto;
}

/* The composite: one image filling the aspect-ratio box main.ts sized. */
.final-layout-container.is-composite {
  display: block;
}

.final-layout-container.is-composite img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--r-sm);
  background: var(--surface-sunken);
}

/* Fallback grid only: square cells, since compose.ts renders square slots. */
.final-layout-container:not(.is-composite) img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--r-sm);
  background: var(--surface-sunken);
}

/* The delivery photo is the page's hero: give it more room than the editor
   side panel. */
.delivery-photo .final-layout-container {
  max-width: 32rem;
}

.delivery-photo .final-preview {
  min-height: 20rem;
}

@media (max-width: 767px) {
  .final-preview,
  .delivery-photo .final-preview {
    min-height: 12rem;
    padding: var(--s-3);
  }

  .final-layout-container {
    gap: var(--s-1);
  }
}
