/* Factory image viewer: local, keyboard accessible, RTL controls. */
.gallery-dialog.gallery-viewer{width:min(1280px,calc(100vw - 32px));height:min(860px,calc(100dvh - 32px));max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);padding:0;border:1px solid #34445d;border-radius:14px;background:#081a32;color:#fff;overflow:hidden}
.gallery-viewer[open]{display:block}
.gallery-shell{display:grid;grid-template-rows:auto minmax(0,1fr) auto;height:100%;min-height:0;background:#081a32}
.gallery-shell:fullscreen{width:100vw;height:100dvh;max-width:none;max-height:none;border:0;border-radius:0;color:#fff}
.gallery-toolbar{display:flex;align-items:center;gap:16px;padding:12px 16px;border-bottom:1px solid #34445d;background:#102642}
.gallery-toolbar h2{display:flex;align-items:center;gap:10px;font-size:16px;margin:0;flex:1;color:#fff}
.gallery-tools{display:flex;align-items:center;gap:6px}
.gallery-tools output{font-size:13px;min-width:48px;text-align:center;font-variant-numeric:tabular-nums}
.gallery-dialog.gallery-viewer .icon-button{display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;min-width:44px;margin:0;border:1px solid #50627c;border-radius:9px;background:#203b5b;color:#fff;cursor:pointer}
.gallery-dialog.gallery-viewer .icon-button:hover:not(:disabled){background:#335778;border-color:#90afd1}
.gallery-dialog.gallery-viewer .icon-button:disabled{opacity:.4;cursor:default}
.gallery-viewer :focus-visible{outline:3px solid #ff7900;outline-offset:2px}
.gallery-stage{position:relative;min-width:0;min-height:0;overflow:hidden;background:#071426}
.gallery-viewport{width:100%;height:100%;overflow:auto;direction:ltr;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#607793 #071426;touch-action:pan-x pan-y}
.gallery-canvas{display:flex;align-items:center;justify-content:center;min-width:100%;min-height:100%;width:max-content;height:max-content}
.gallery-dialog.gallery-viewer img{display:block;flex-shrink:0;max-width:none;max-height:none;object-fit:contain;user-select:none}
.gallery-dialog.gallery-viewer img[hidden]{display:none}
.gallery-viewport.is-zoomed{cursor:grab}.gallery-viewport.is-dragging{cursor:grabbing}
.gallery-dialog.gallery-viewer .gallery-step{position:absolute;top:50%;transform:translateY(-50%);background:#102642eF;border-color:#8da3bf;box-shadow:0 2px 12px #0004}
.gallery-previous{right:12px}.gallery-next{left:12px}.gallery-previous .icon{transform:rotate(180deg)}
.gallery-message{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);margin:0;text-align:center;font-size:14px;color:#e1e9f3;pointer-events:none;width:calc(100% - 120px)}
.gallery-message:empty{display:none}
.gallery-details{padding:16px 20px;background:#102642;border-top:1px solid #34445d}
.gallery-description{max-height:180px;overflow:auto;scrollbar-width:thin;scrollbar-color:#607793 #102642}
.gallery-description-heading{display:flex;align-items:baseline;justify-content:space-between;gap:16px}
.gallery-description h3{font-size:16px;line-height:1.8;margin:0;color:#fff;overflow-wrap:anywhere}
.gallery-counter{font-size:13px;white-space:nowrap;color:#c9d8eb}
.gallery-description p{font-size:14px;line-height:1.9;color:#e0e8f2;margin:6px 0 0;white-space:pre-line;overflow-wrap:anywhere}
#gallery-help{font-size:12px;line-height:1.8;color:#afc0d6;margin:8px 0 0}
@media(max-width:600px){
.gallery-dialog.gallery-viewer{width:calc(100vw - 16px);height:calc(100dvh - 16px);max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px);border-radius:10px}
.gallery-toolbar{display:grid;grid-template-columns:minmax(0,1fr) 44px;gap:8px;padding:10px}
.gallery-toolbar h2{font-size:14px}.gallery-tools{grid-column:1/-1;grid-row:2;justify-content:center;gap:8px}.gallery-close{grid-row:1;grid-column:2}
.gallery-details{padding:12px}.gallery-description h3{font-size:14px}.gallery-description p{font-size:13px}.gallery-description-heading{gap:8px}.gallery-previous{right:6px}.gallery-next{left:6px}
#gallery-help{font-size:11px}
}

.gallery-dialog.gallery-viewer.is-expanded{width:100vw;height:100dvh;max-width:100vw;max-height:100dvh;margin:0;border:0;border-radius:0}

.gallery-viewport::-webkit-scrollbar,.gallery-description::-webkit-scrollbar{width:6px;height:6px}
.gallery-viewport::-webkit-scrollbar-track,.gallery-description::-webkit-scrollbar-track{background:#102642}
.gallery-viewport::-webkit-scrollbar-thumb,.gallery-description::-webkit-scrollbar-thumb{background:#607793;border-radius:8px}
