/* Responsive card tiers for the cropper result workspace. */
.results.card-view {
  container-type: inline-size;
  width: 100%;
}

.results.card-view .crop-card {
  width: 100%;
  max-width: 100%;
}

.results.card-view .crop-card .preview-wrap {
  height: auto;
  max-width: 100%;
  align-self: center;
  aspect-ratio: var(--preview-ratio, 16 / 9);
}

/* Large card: landscape fills the available web workspace. */
.results.card-view:not(.card-medium-view):not(.card-small-view)
  .crop-card.is-landscape .preview-wrap {
  width: min(100%, var(--large-landscape-fit-width, 100%));
  max-height: 60dvh;
}

/* Large portrait/square previews never grow taller than the viewport. */
.results.card-view:not(.card-medium-view):not(.card-small-view)
  .crop-card.is-portrait .preview-wrap {
  width: auto;
  height: min(76dvh, 920px);
  max-height: calc(100dvh - 120px);
}

/* Medium card scales from the result workspace rather than a fixed pixel size. */
.results.card-medium-view .crop-card.is-landscape .preview-wrap {
  width: min(100%, clamp(460px, 76cqw, 1080px));
}

.results.card-medium-view .crop-card.is-portrait .preview-wrap {
  width: auto;
  height: min(58dvh, 680px);
  max-height: calc(100dvh - 170px);
}

/* Small card remains visibly smaller than medium on every desktop width. */
.results.card-small-view .crop-card.is-landscape .preview-wrap {
  width: min(100%, clamp(320px, 54cqw, 760px));
}

.results.card-small-view .crop-card.is-portrait .preview-wrap {
  width: auto;
  height: min(44dvh, 520px);
  max-height: calc(100dvh - 220px);
}

.results.card-view .crop-card.is-portrait .preview-wrap > img,
.results.card-view .crop-card.is-landscape .preview-wrap > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@media (max-width: 760px) {
  .results.card-view:not(.card-medium-view):not(.card-small-view)
    .crop-card.is-portrait .preview-wrap {
    height: min(68dvh, 720px);
    max-height: calc(100dvh - 110px);
  }

  .results.card-medium-view .crop-card.is-landscape .preview-wrap { width: min(100%, 86cqw); }
  .results.card-small-view .crop-card.is-landscape .preview-wrap { width: min(100%, 70cqw); }
  .results.card-medium-view .crop-card.is-portrait .preview-wrap { height: min(52dvh, 580px); }
  .results.card-small-view .crop-card.is-portrait .preview-wrap { height: min(40dvh, 440px); }
}

@media (max-width: 480px) {
  .results.card-view .crop-card .preview-wrap {
    width: 100% !important;
    height: auto !important;
    max-height: 70dvh;
  }
}
