/* Keep the image's own box and object-fit. Small icons get a smaller ring. */
img[data-src]:not([data-ll-status="loaded"]):not([data-ll-status="error"]) {
  content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'/%3E");
}
img[data-src][data-ll-status="loading"] {
  background-image: url("image-spinner.svg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: min(24px, 80%) min(24px, 80%);
}
.yp-watch-stage:has(#watch-prompt:not([hidden]) .yp-spinner:not([hidden])) > img[data-src] {
  background-image: none;
}

:is(.yp-card-cover, .yp-rank-cover, .yp-cover) img[data-ll-status="error"],
.yp-poster[data-ll-status="error"],
:is(.yp-card-cover, .yp-cover):has(> img[data-ll-status="loading"]) > :is(i, .yp-cover-placeholder) {
  visibility: hidden;
}
.yp-cover > noscript > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Preserve portrait framing in the existing landscape preview slots. Without
   scripting, show the full preview since the intrinsic orientation is unknown. */
:is(.yp-card-cover, .yp-rank-cover, .yp-hero-cover, .yp-preview-grid,
    .yp-pick .yp-cover, .yp-tile:not([rel~="sponsored"]) .yp-cover) img:is(.yp-img-portrait, noscript img),
img:is(.yp-poster, .profile-post-img):is(.yp-img-portrait, noscript img) {
  object-fit: contain;
  object-position: center;
  background-color: #000;
}

:is(.yp-card-cover, .yp-cover) > .yp-card-side { width: 33.333333%; opacity: 0; pointer-events: none; }
:is(.yp-card-cover, .yp-cover) > .yp-card-right { left: auto; right: 0; }
:is(.yp-card-cover, .yp-cover).yp-card-three { background: #000; }
.yp-card-three .yp-card-side { opacity: 1; }
.yp-card-three > img[data-preview-left] { left: 33.333333%; width: 33.333333%; }

.yp-gallery-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  aspect-ratio: 16 / 9;
  align-self: start;
  overflow: hidden;
  border-radius: 5px;
  background: #000;
}
.yp-gallery-strip > a { display: block; min-width: 0; min-height: 0; }
.yp-preview-grid .yp-gallery-strip img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
  object-fit: contain;
}
.yp-gallery-strip > a:focus-visible { outline-offset: -2px; }
