/* Only the main project medium uses the uniform 16:9 stage. */
.pk-site .pk-project-content > .pk-main-media {
  aspect-ratio: 16 / 9;
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  overflow: hidden;
  background: var(--pk-bg);
}
.pk-site .pk-project-content > .pk-main-media > :is(.pk-video-wrap, .pk-gif-wrap) {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  aspect-ratio: auto;
}
.pk-site .pk-project-content > .pk-main-media > :is(img, video),
.pk-site .pk-project-content > .pk-main-media > :is(.pk-video-wrap, .pk-gif-wrap) > :is(img, video) {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  aspect-ratio: auto;
  object-fit: contain;
  object-position: center;
}
/* Keep the still frame above a loading loop until a decoded frame is presented. */
.pk-site .pk-project-content .pk-loop-poster-wrap { position: relative; }
.pk-site .pk-project-content .pk-loop-poster-wrap > video { opacity: 0; }
.pk-site .pk-project-content .pk-loop-poster-wrap > video[data-pk-loop-ready="1"] { opacity: 1; }
.pk-site .pk-project-content .pk-loop-poster-wrap > img.pk-loop-poster {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
}
.pk-site .pk-project-content .pk-loop-poster-wrap > img.pk-loop-poster[hidden],
.pk-site .pk-project-content .pk-loop-poster-wrap > video[data-pk-loop-ready="1"] ~ img.pk-loop-poster { display: none; }

/* These approved 16:9 previews remain complete in the slider and cover. */
.pk-site .pk-slide-media.pk-slide-media--16by9 > :is(.pk-preview-variant, .pk-video-wrap, .pk-gif-wrap, img),
.pk-site .pk-slide-media > .pk-preview-variant.pk-preview-variant--16by9 {
  position: absolute;
  inset: auto;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(100%, calc(100svh * 16 / 9));
  height: auto;
  aspect-ratio: 16 / 9;
}
.pk-site .pk-slide-media.pk-slide-media--16by9 :is(img, video),
.pk-site .pk-slide-media.pk-slide-media--16by9 > .pk-preview-variant :is(img, video),
.pk-site .pk-slide-media > .pk-preview-variant.pk-preview-variant--16by9 :is(img, video) {
  min-height: 0;
  max-height: none;
  object-fit: contain;
  object-position: center;
}

/* Targeted grid hover layers use the same full 16:9 stage as their source media.
   Overrides the older grid cover rules without affecting other project previews. */
.pk-grid .pk-track .pk-grid-hover-media--16by9 {
  inset: auto;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}
.pk-grid .pk-track .pk-grid-hover-media--16by9 > :is(.pk-video-wrap, .pk-gif-wrap) {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.pk-grid .pk-track .pk-grid-hover-media--16by9 :is(img, video),
.pk-grid .pk-track .pk-grid-hover-media--16by9 > .pk-grid-still {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  object-fit: contain;
  object-position: center;
}
