/* Step 1 and its previews show the complete source image. No crop is applied
   to media bytes, stored drafts, publication payloads or uploaded files. */
.social-ghost #editor img,
.social-ghost .post-copy img,
.social-ghost .post-media img {
  display: block;
  position: static;
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: min(64vh, 640px) !important;
  object-fit: contain !important;
  margin: 16px auto;
}
.social-ghost .post-media { align-items: center; }
.social-ghost .post-media img { margin: 0 auto; }
.social-ghost .media-tile img { object-fit: contain; }
.social-ghost .story-card .post-copy img,
.social-ghost .story-card .post-media img { max-height: 260px !important; }
/* The existing rails also widen above 900px on a landscape touch screen. */
@media (min-width: 900px) {
  .social-ghost #page0 { padding-inline: 120px 110px !important; }
  .social-ghost.sg-clean #page0,
  .social-ghost.sg-keyboard #page0 { padding-inline: 18px !important; }
}
#imageFormatInfo {
  color: #eee5fa;
  background: #201929;
  border: 1px solid #67517f;
  border-radius: 12px;
  padding: 10px 12px;
  margin: 10px 0 14px;
  font: 12px/1.5 system-ui, sans-serif;
  min-width: 0;
}
#imageFormatInfo[hidden] { display: none; }
.image-format-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.image-format-auto { color: #e1caff; background: #39264f; border-radius: 20px; padding: 2px 8px; font-size: 11px; }
.image-format-list { list-style: none; margin: 6px 0 0; padding: 0; }
.image-format-item { display: flex; flex-wrap: wrap; gap: 2px 12px; padding: 4px 0; min-width: 0; }
.image-format-name { max-width: 100%; overflow-wrap: anywhere; color: #c4b7d4; }
.image-format-dimensions { font-weight: 600; overflow-wrap: anywhere; }
.image-format-item { align-items: center; }
.image-format-inspect { border: 1px solid #67517f; border-radius: 10px; padding: 8px 10px; min-height: 44px; color: #eee5fa; background: #39264f; cursor: pointer; font: 600 12px/1.3 system-ui; }
.image-format-note { margin: 4px 0 0; color: #c4b7d4; font-size: 11px; }
#imageFormatInfo summary { cursor: pointer; padding: 9px 0; min-height: 24px; }
#imageFormatInfo summary:focus-visible { outline: 2px solid #ac78fa; outline-offset: 2px; }
#imageFormatViewer {
  box-sizing: border-box;
  margin: auto;
  padding: 12px;
  width: min(1100px, calc(100vw - 20px));
  height: min(850px, calc(100dvh - 20px));
  max-height: calc(100dvh - 20px);
  max-width: calc(100vw - 20px);
  border: 1px solid #67517f;
  border-radius: 18px;
  color: #eee5fa;
  background: #191320;
  overflow: hidden;
}
#imageFormatViewer[open] { display: flex; flex-direction: column; gap: 10px; }
#imageFormatViewer::backdrop { background: #070510b8; }
.image-viewer-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex: none; }
#imageFormatViewer h2 { margin: 0; color: inherit; font: 650 16px/1.4 system-ui; }
.image-viewer-info { margin: 3px 0 0; font: 12px/1.4 system-ui; overflow-wrap: anywhere; }
.image-viewer-close, .image-viewer-tools button { box-sizing: border-box; min-width: 44px; min-height: 44px; border: 1px solid #67517f; border-radius: 12px; background: #30213f; color: #eee5fa; cursor: pointer; font: 600 20px/1.3 system-ui; }
.image-viewer-close { flex: none; }
.image-viewer-body { display: grid; grid-template-columns: minmax(0, 1fr) 56px; gap: 8px; min-height: 0; min-width: 0; flex: 1; }
.image-viewer-viewport { overflow: auto; overscroll-behavior: contain; min-width: 0; min-height: 0; border-radius: 12px; border: 1px solid #67517f; background: #0c0a14; scrollbar-width: auto; scrollbar-color: #9977c0 #251c33; touch-action: pan-x pan-y; }
.image-viewer-canvas { box-sizing: border-box; display: grid; place-items: center; width: max-content; min-width: 100%; min-height: 100%; padding: 12px; }
#imageFormatViewer .image-viewer-canvas img { display: block; max-width: none !important; max-height: none !important; object-fit: contain; margin: 0; }
.image-viewer-tools { display: flex; flex-direction: column; align-items: stretch; gap: 6px; overflow: auto; }
.image-viewer-tools button:last-child { font-size: 11px; }
.image-viewer-tools button:disabled { opacity: .45; cursor: default; }
.image-viewer-scale { font: 600 12px/1.5 system-ui; text-align: center; }
.image-viewer-help { flex: none; margin: 0; font: 11px/1.5 system-ui; }
#imageFormatViewer :focus-visible, .image-format-inspect:focus-visible { outline: 2px solid #bd92f9; outline-offset: 2px; }
@media (max-height: 480px) {
  #imageFormatViewer { gap: 4px; padding: 8px; }
  #imageFormatViewer .image-viewer-help { font-size: 10px; }
}
@media (hover: hover) and (pointer: fine) {
  #imageFormatInfo { color: #342647; background: #f8f5fd; border-color: #d8cbe9; }
  .image-format-auto { color: #6035a3; background: #ebe1fa; }
  .image-format-name, .image-format-note { color: #665574; }
  .image-format-inspect { background: #eee5fa; color: #6035a3; border-color: #cbb6e4; }
  #imageFormatViewer { background: #fff; color: #342647; border-color: #cbb6e4; color-scheme: light; }
  .image-viewer-close, .image-viewer-tools button { background: #eee5fa; color: #6035a3; border-color: #cbb6e4; }
  .image-viewer-viewport { background: #f4f3f8; border-color: #d8cbe9; scrollbar-color: #9677b8 #eae4f3; }
}
