/* Elegia Presence Generator — Landing layout authority v3.8
   Gallery: 1 wide + 2 square images
   Content: editorial + hard overflow containment
   Services: preserves responsive authority from v3.7
*/

/* ===== Gallery authority: 3 photos only ===== */
.preview-frame[data-device="desktop"] .landing-gallery__grid,
.preview-frame[data-device="tablet"] .landing-gallery__grid,
#elegiaExportFrame .landing-gallery__grid,
body > .landing-preview .landing-gallery__grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 14px !important;
  height: auto !important;
  align-items: stretch !important;
}

.preview-frame[data-device="desktop"] .landing-gallery__item,
.preview-frame[data-device="tablet"] .landing-gallery__item,
#elegiaExportFrame .landing-gallery__item,
body > .landing-preview .landing-gallery__item {
  min-width: 0 !important;
  min-height: 0 !important;
  height: auto !important;
  grid-row: auto !important;
}

.preview-frame[data-device="desktop"] .landing-gallery__item--1,
.preview-frame[data-device="tablet"] .landing-gallery__item--1,
#elegiaExportFrame .landing-gallery__item--1,
body > .landing-preview .landing-gallery__item--1 {
  grid-column: 1 / -1 !important;
  aspect-ratio: 16 / 9 !important;
}

.preview-frame[data-device="desktop"] .landing-gallery--3 .landing-gallery__item--2,
.preview-frame[data-device="desktop"] .landing-gallery--3 .landing-gallery__item--3,
.preview-frame[data-device="tablet"] .landing-gallery--3 .landing-gallery__item--2,
.preview-frame[data-device="tablet"] .landing-gallery--3 .landing-gallery__item--3,
#elegiaExportFrame .landing-gallery--3 .landing-gallery__item--2,
#elegiaExportFrame .landing-gallery--3 .landing-gallery__item--3,
body > .landing-preview .landing-gallery--3 .landing-gallery__item--2,
body > .landing-preview .landing-gallery--3 .landing-gallery__item--3 {
  grid-column: auto !important;
  aspect-ratio: 1 / 1 !important;
}

/* Fewer than three photos remain graceful. */
.preview-frame[data-device="desktop"] .landing-gallery--2 .landing-gallery__item--2,
.preview-frame[data-device="tablet"] .landing-gallery--2 .landing-gallery__item--2,
#elegiaExportFrame .landing-gallery--2 .landing-gallery__item--2,
body > .landing-preview .landing-gallery--2 .landing-gallery__item--2 {
  grid-column: 1 / -1 !important;
  aspect-ratio: 16 / 9 !important;
}

/* Mobile: predictable vertical stack. */
.preview-frame[data-device="mobile"] .landing-gallery__grid {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 9px !important;
  height: auto !important;
}

.preview-frame[data-device="mobile"] .landing-gallery__item,
.preview-frame[data-device="mobile"] .landing-gallery__item--1,
.preview-frame[data-device="mobile"] .landing-gallery__item--2,
.preview-frame[data-device="mobile"] .landing-gallery__item--3 {
  grid-column: auto !important;
  grid-row: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  aspect-ratio: 16 / 10 !important;
}

/* ===== Editorial content containment ===== */
.preview-frame .landing-content,
.preview-frame .landing-content__grid,
.preview-frame .landing-content__item,
#elegiaExportFrame .landing-content,
#elegiaExportFrame .landing-content__grid,
#elegiaExportFrame .landing-content__item,
body > .landing-preview .landing-content,
body > .landing-preview .landing-content__grid,
body > .landing-preview .landing-content__item {
  min-width: 0 !important;
  max-width: 100% !important;
}

.preview-frame .landing-content__item h3,
.preview-frame .landing-content__item p,
#elegiaExportFrame .landing-content__item h3,
#elegiaExportFrame .landing-content__item p,
body > .landing-preview .landing-content__item h3,
body > .landing-preview .landing-content__item p {
  min-width: 0 !important;
  max-width: 100% !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  white-space: normal !important;
}

.preview-frame .landing-content__item,
.preview-frame .landing-content--single .landing-content__item,
.preview-frame .landing-content--editorial .landing-content__item.is-featured,
#elegiaExportFrame .landing-content__item,
#elegiaExportFrame .landing-content--single .landing-content__item,
#elegiaExportFrame .landing-content--editorial .landing-content__item.is-featured,
body > .landing-preview .landing-content__item,
body > .landing-preview .landing-content--single .landing-content__item,
body > .landing-preview .landing-content--editorial .landing-content__item.is-featured {
  overflow: hidden !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  background: transparent !important;
  border-left: 0 !important;
  border-right: 0 !important;
  border-bottom: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

@media (max-width: 620px) {
  #elegiaExportFrame .landing-gallery__grid,
  body > .landing-preview .landing-gallery__grid {
    grid-template-columns: 1fr !important;
    gap: 9px !important;
  }

  #elegiaExportFrame .landing-gallery__item,
  #elegiaExportFrame .landing-gallery__item--1,
  #elegiaExportFrame .landing-gallery__item--2,
  #elegiaExportFrame .landing-gallery__item--3,
  body > .landing-preview .landing-gallery__item,
  body > .landing-preview .landing-gallery__item--1,
  body > .landing-preview .landing-gallery__item--2,
  body > .landing-preview .landing-gallery__item--3 {
    grid-column: auto !important;
    aspect-ratio: 16 / 10 !important;
  }
}
