/* Keep feedback within the same sized box as the article image. */
/* Leave room for one actionable line, even for a panoramic terminal capture. */
.article.wrap .body.md img[style*="--article-image-width"]:not(.emoji):not(.vemoji):not(.links img):not(.gallery img) { min-height: 24px; }
.post-image-frame {
  display: block;
  position: relative;
  width: var(--frame-width, fit-content);
  max-width: 100%;
  margin-inline: auto;
}
.post-image-frame[data-state] {
  background: rgba(0, 0, 0, .05);
  border-radius: 6px;
  aspect-ratio: var(--frame-ratio, auto);
}
:root[data-theme="dark"] .post-image-frame[data-state] { background: rgba(255, 255, 255, .03); }
.post-image-frame[data-state] img { opacity: 0; }
.post-image-frame[data-state]:not([style*="--frame-ratio"]) { min-height: 6rem; }
.post-image-feedback { display: none; }
.post-image-frame[data-state="slow"] > .post-image-feedback,
.post-image-frame[data-state="failed"] > .post-image-feedback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  container-type: size;
}
.post-image-frame[data-state="slow"] > .post-image-feedback {
  pointer-events: none;
}
.post-image-frame[data-state="slow"] > .post-image-feedback::before {
  content: "";
  box-sizing: border-box;
  width: 18px;
  height: 18px;
  border: 2px solid var(--grey-3);
  border-top-color: var(--primary-color);
  border-right-color: var(--primary-color);
  border-radius: 50%;
  animation: post-image-turn 1.1s linear infinite, post-image-appear .16s ease-out;
}
@keyframes post-image-turn { to { transform: rotate(1turn); } }
@keyframes post-image-appear { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .post-image-frame[data-state="slow"] > .post-image-feedback::before { animation: none; }
}
.post-image-error {
  display: grid;
  justify-items: center;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  padding-inline: 4px;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  color: var(--text-color);
}
.post-image-error svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.post-image-alt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.post-image-alt:empty { display: none; }
.post-image-error small { font-size: 12px; }
.post-image-error button {
  font: inherit;
  border: 0;
  background: transparent;
  color: var(--primary-color);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 2px 6px;
}
.post-image-error button:focus-visible { outline: 2px solid currentColor; }
@container (max-height: 100px) {
  .post-image-error { display: flex; justify-content: center; }
  .post-image-error svg { width: 16px; height: 16px; flex: none; }
  .post-image-error small, .post-image-error button { white-space: nowrap; flex: none; }
}
@container (max-width: 210px) and (max-height: 100px) {
  .post-image-error svg { display: none; }
}
