/* Keep the preview dialog stationary when a player control receives focus. */
.preview-dialog[data-slot="dialog-content"] {
  overflow: hidden !important;
  overflow: clip !important;
  overflow-anchor: none;
}

.preview-dialog[data-slot="dialog-content"] .preview-details {
  min-block-size: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

@media (max-width: 640px) {
  .preview-dialog[data-slot="dialog-content"] {
    --preview-details-space: clamp(110px, 29dvh, 240px);
    --preview-player-height: min(720px, calc(100dvh - 24px - var(--preview-details-space)), calc((100vw - 20px) * 16 / 9));
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: var(--preview-player-height) minmax(0, auto) !important;
    width: min(100vw - 20px, 420px) !important;
    height: auto !important;
    max-height: calc(100dvh - 24px);
  }

  .preview-dialog[data-slot="dialog-content"] .preview-phone {
    justify-self: center;
    width: calc(var(--preview-player-height) * 9 / 16);
    height: var(--preview-player-height) !important;
    min-height: 0;
    max-height: 100%;
  }

  .preview-dialog[data-slot="dialog-content"] .preview-details {
    max-height: var(--preview-details-space);
  }
}

/* Maintain each theme's art and leave enough space for the entire ornament. */
.video-invitation:is(.vi-cream, .vi-serenade, .vi-harmony).vi-pearl.vi-story .pearl-divider {
  width: min(240px, 90%);
  height: auto;
  aspect-ratio: 3 / 1;
  flex: 0 0 auto;
  background-size: contain !important;
}

.video-invitation:is(.vi-cream, .vi-serenade, .vi-harmony).vi-pearl.vi-story .night-countdown-unit {
  background-size: contain !important;
}

.video-invitation:is(.vi-cream, .vi-serenade, .vi-harmony).vi-pearl.vi-story .pearl-location-art {
  width: min(250px, 100%) !important;
  height: auto !important;
  aspect-ratio: 1;
  object-fit: contain;
  flex-shrink: 0;
}

.video-invitation:is(.vi-cream, .vi-serenade, .vi-harmony).vi-pearl.vi-story :is(.pearl-venue, .pearl-directions) {
  background-size: contain !important;
  max-width: 100%;
  flex-shrink: 0;
}

.video-invitation:is(.vi-cream, .vi-serenade, .vi-harmony).vi-pearl.vi-story .pearl-scene-4 > .pearl-title {
  display: block;
  background-size: contain !important;
  flex-shrink: 0;
}

.video-invitation:is(.vi-cream, .vi-serenade, .vi-harmony).vi-pearl.vi-story .pearl-photo-grid button {
  aspect-ratio: 3 / 2;
  min-width: 0;
}

/* Keep original photos within both classic and collage gallery frames. */
.video-invitation.vi-story.vi-pearl :is(.pearl-photo-grid, .rose-photos, .ivory-photos) img,
.video-invitation.vi-story.vi-pearl:is(.vi-blue.vi-castle, .vi-castle) .pearl-photo-grid img {
  object-fit: contain !important;
  object-position: center !important;
}

.video-invitation .inv-directions-address {
  max-width: 100%;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
