
/* ============================================================
   OurWayTrips V5.2.3 — Memories Media Fix
   Full image, natural proportions, R2 cross-device rendering.
   ============================================================ */

.memory-story-card {
  overflow: hidden;
}

/* Do not force story photos into a fixed cropped 210px strip. */
.memory-story-card .story-photo-stack {
  height: auto !important;
  min-height: 0 !important;
  display: grid;
  align-items: center;
  background: #efe3d6;
}

.memory-story-card .story-photo-stack.one {
  grid-template-columns: 1fr !important;
}

.memory-story-card .story-photo-stack.two {
  grid-template-columns: repeat(2, minmax(0,1fr)) !important;
}

.memory-story-card .story-photo-stack:not(.one):not(.two) {
  grid-template-columns: repeat(3, minmax(0,1fr)) !important;
}

.memory-story-card .story-photo-stack img {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  max-height: 520px !important;
  min-height: 0 !important;
  object-fit: contain !important;
  object-position: center center !important;
  background: #efe3d6;
}

/* One photo should use the full useful card width. */
.memory-story-card .story-photo-stack.one img {
  max-height: 620px !important;
}

/* Cloud-loaded photo state */
.memory-story-card .story-photo-stack[data-cloud-media="loading"] {
  min-height: 150px !important;
}

.memory-story-card .story-photo-stack[data-cloud-media="loading"]::after {
  content: "Loading photo…";
  display: grid;
  place-items: center;
  min-height: 150px;
  color: #7b6656;
  font-size: .86rem;
}

/* Image preview inside Add/Edit Story should also preserve the whole photo. */
.memory-photo-preview img {
  width: 100% !important;
  height: auto !important;
  max-height: 240px !important;
  object-fit: contain !important;
  background: #efe3d6;
}

/* Keep cards reasonable on narrow phones without cropping. */
@media (max-width: 760px) {
  .memory-story-card .story-photo-stack.two,
  .memory-story-card .story-photo-stack:not(.one):not(.two) {
    grid-template-columns: 1fr !important;
  }

  .memory-story-card .story-photo-stack img,
  .memory-story-card .story-photo-stack.one img {
    width: 100% !important;
    height: auto !important;
    max-height: 72vh !important;
    object-fit: contain !important;
  }

  .memory-story-card .story-body {
    padding-top: 16px !important;
  }
}
