/* Only activated when the companion script has measured the displayed painting.

   Does not affect PhotoSwipe's hidden .pswp__caption--fake measurement element. */

.pswp.plonske-caption-enhanced .pswp__caption:not(.pswp__caption--fake) {

    position: absolute !important;

    left: var(--plonske-caption-left) !important;

    top: var(--plonske-caption-top) !important;

    width: var(--plonske-caption-width) !important;

    right: auto !important;

    bottom: auto !important;

    min-height: 0 !important;

    max-width: none !important;

    background: transparent !important;

    pointer-events: none;

}

.pswp.plonske-caption-enhanced .pswp__caption:not(.pswp__caption--fake) .pswp__caption__center {

    width: 100% !important;

    max-width: none !important;

    margin: 0 !important;

    padding: 0 !important;

    text-align: left !important;

    box-sizing: border-box;

    overflow-wrap: anywhere;

}

/* When an image is enlarged for inspection, captions shouldn't cover it. */

.pswp.plonske-caption-zoomed .pswp__caption:not(.pswp__caption--fake) {

    opacity: 0 !important;

}



/* Suppress the default bottom-left caption until geometry is available.

   Fallback keeps captions visible if image geometry cannot be measured. */

.pswp.plonske-caption-managed.pswp--open:not(.plonske-caption-enhanced):not(.plonske-caption-fallback)

  .pswp__caption:not(.pswp__caption--fake) {

    visibility: hidden !important;

}


/* v2.1.2: Align the native bottom-caption fallback with the painting without
   narrowing text to the painting's width (which could cause overlap). */
.pswp.plonske-caption-aligned-fallback .pswp__caption:not(.pswp__caption--fake) .pswp__caption__center {
    margin-left: var(--plonske-fallback-left) !important;
    margin-right: 0 !important;
    max-width: var(--plonske-fallback-width) !important;
    box-sizing: border-box;
}
