/* Shared opt-in image viewer. All selectors scoped to the component. */
.bsp-image-gallery { display:grid; grid-template-columns:minmax(0,1fr); gap:1.25rem; }
.bsp-image-gallery figure { margin:0; min-width:0; }
.bsp-image-gallery [data-bsp-image] { display:block; border:1px solid #536d87; border-radius:.65rem; overflow:hidden; cursor:zoom-in; }
.bsp-image-gallery img { display:block; width:100%; height:auto; }
.bsp-image-gallery figcaption { margin-top:.6rem; line-height:1.6; }
.bsp-image-gallery .bsp-image-actions { display:flex; gap:.75rem; flex-wrap:wrap; align-items:center; margin-top:.5rem; }
.bsp-image-gallery a:focus-visible,.bsp-iv button:focus-visible,.bsp-iv a:focus-visible,.bsp-iv-stage:focus-visible { outline:3px solid #ffd086; outline-offset:3px; }
.bsp-iv { box-sizing:border-box; position:fixed; inset:0; margin:auto; padding:0; border:1px solid #647b95; border-radius:.65rem; width:min(96vw,1600px); max-width:96vw; height:94vh; height:94dvh; max-height:94dvh; background:#0b1523; color:#edf5ff; overflow:hidden; z-index:10000; }
.bsp-iv:not([open]) { display:none; }
.bsp-iv[open] { display:grid; grid-template-rows:auto minmax(0,1fr) auto; }
.bsp-iv::backdrop { background:rgba(0,0,0,.85); }
.bsp-iv-head,.bsp-iv-foot { display:flex; align-items:center; gap:.5rem; flex-wrap:wrap; padding:.6rem .8rem; background:#132337; }
.bsp-iv-head { justify-content:space-between; }
.bsp-iv-title { margin:0; font-size:1rem; font-weight:700; flex:1; min-width:0; overflow-wrap:anywhere; }
.bsp-iv-tools { display:flex; align-items:center; gap:.35rem; flex-wrap:wrap; }
.bsp-iv button,.bsp-iv a { font:inherit; font-size:.875rem; line-height:1.2; box-sizing:border-box; color:#edf5ff; background:#20364e; border:1px solid #7891ab; border-radius:.35rem; padding:.5rem .7rem; min-height:44px; min-width:44px; text-decoration:none; display:inline-flex; align-items:center; justify-content:center; cursor:pointer; }
.bsp-iv button:disabled { opacity:.45; cursor:default; }
.bsp-iv-stage { position:relative; min-height:0; min-width:0; overflow:hidden; touch-action:none; background:#050c16; cursor:grab; }
.bsp-iv-stage.bsp-dragging { cursor:grabbing; }
.bsp-iv-stage img { position:absolute; max-width:none; max-height:none; width:auto; height:auto; user-select:none; -webkit-user-drag:none; transform-origin:0 0; pointer-events:none; }
.bsp-iv-foot { font-size:.82rem; justify-content:space-between; }
.bsp-iv-status { font-variant-numeric:tabular-nums; }
.bsp-iv-message { position:absolute; inset:0; display:grid; place-content:center; text-align:center; padding:1rem; pointer-events:none; }
.bsp-iv-message[hidden] { display:none; }
body.bsp-iv-open { overflow:hidden; }
@media(max-width:600px) { .bsp-iv { width:100vw; max-width:100vw; height:100vh; height:100dvh; max-height:100dvh; border-radius:0; } .bsp-iv-head,.bsp-iv-foot{padding:.45rem;} .bsp-iv-title{flex-basis:70%;} .bsp-iv-tools{gap:.25rem;} .bsp-iv-foot .bsp-iv-help{display:none;} }
.bsp-image-gallery .bsp-image-open { display:block; padding:.65rem .85rem; background:#14283b; color:#c5eaff; font-weight:600; text-align:center; }
.bsp-iv .bsp-iv-title { font-size:1rem; line-height:1.35; margin:0; }
.bsp-iv-stage img[hidden] { display:none; }

/* v1.1: hidden controls stay hidden despite component button display rules. */
.bsp-iv [hidden] { display:none !important; }
.bsp-iv-tools { min-width:0; }
.bsp-iv-stage:focus-visible { outline-offset:-3px; }
@media(max-height:440px) { .bsp-iv-head,.bsp-iv-foot { padding:.25rem .4rem; } .bsp-iv-tools { gap:.2rem; } .bsp-iv-foot .bsp-iv-help { display:none; } }

/* Region highlighting uses the same viewport transform as the original image. */
.bsp-iv-region{position:absolute;box-sizing:border-box;border:2px solid #ffd086;box-shadow:0 0 0 1px #081423;pointer-events:none;z-index:1}
.bsp-iv .bsp-iv-status{overflow-wrap:anywhere;min-width:0}
