.cms-gallery-grid { display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,14rem),1fr));gap:1rem; }
.cms-gallery-grid img { display:block;width:100%;height:auto; }
/* Optional stable frame: source candidates may differ by rounded pixel ratios.
   The empty, hidden-to-AT SVG reserves the verified master ratio before loading.
   No inline styles, fixed photo crops, JS timing or relaxed CSP are needed. */
.cms-gallery-photo--stable{position:relative}
.cms-gallery-photo--stable>.cms-gallery-ratio{display:block;width:100%;height:auto;pointer-events:none}
.cms-gallery-grid>.cms-gallery-photo--stable>img{position:absolute;inset:0;display:block;width:100%;height:100%;object-fit:contain}
.cms-gallery-dialog { box-sizing:border-box;width:min(96vw,75rem);max-width:100%;max-height:92dvh;overflow:auto;border:0;background:#fff;color:#17212b;padding:1rem;padding-bottom:max(1rem,env(safe-area-inset-bottom)); }
.cms-gallery-dialog::backdrop { background:rgb(0 0 0 / .8); }
.cms-gallery-dialog button { min-height:44px;min-width:44px;cursor:pointer; }
.cms-gallery-dialog button:focus-visible,.cms-gallery-grid a:focus-visible { outline:3px solid #245d91;outline-offset:3px; }
.cms-gallery-stage { display:grid;place-items:center;min-height:5rem;touch-action:pan-y pinch-zoom; }
.cms-gallery-stage img { display:block;max-width:100%;max-height:65dvh;width:auto;height:auto;object-fit:contain; }
.cms-gallery-stage img[hidden] { display:none; }
.cms-gallery-lock { overflow:hidden; }

/* Optional presentation profiles. The two-argument renderer keeps its defaults. */
.cms-gallery-grid--masonry { display:block;columns:1;column-gap:1rem; }
.cms-gallery-grid--masonry>a { display:block;break-inside:avoid;margin:0 0 1rem; }
.cms-gallery-grid--masonry img { width:100%;height:auto; }
@media(min-width:600px){.cms-gallery-grid--masonry{columns:2}}
@media(min-width:1000px){.cms-gallery-grid--masonry{columns:3}}
.cms-gallery-dialog--immersive {
 position:fixed;inset:0;
 width:100vw;max-width:100vw;height:100vh;height:100dvh;max-height:100vh;max-height:100dvh;
 margin:0;padding:0;border:0;overflow:hidden;background:transparent;color:#fff;
}
.cms-gallery-dialog--immersive::backdrop{background:rgb(0 0 0 / .88)}
.cms-gallery-dialog--immersive .cms-gallery-stage{position:absolute;inset:72px 76px;min-width:0;min-height:0}
.cms-gallery-dialog--immersive .cms-gallery-stage img{width:auto;height:auto;min-width:0;min-height:0;max-width:100%;max-height:100%;object-fit:contain}
.cms-gallery-dialog--immersive button{
 position:absolute;z-index:1;display:grid;place-items:center;width:48px;height:48px;min-width:48px;min-height:48px;
 padding:0;border:1px solid rgb(255 255 255 / .4);border-radius:50%;background:rgb(0 0 0 / .4);color:#fff;
}
.cms-gallery-dialog--immersive button svg{display:block;pointer-events:none}
.cms-gallery-dialog--immersive button:hover{background:rgb(255 255 255 / .18)}
.cms-gallery-dialog--immersive button:disabled{opacity:.4;cursor:default}
.cms-gallery-dialog--immersive button:focus-visible{outline:3px solid #fff;outline-offset:4px}
.cms-gallery-dialog--immersive [data-photo-close]{top:max(16px,env(safe-area-inset-top));right:max(16px,env(safe-area-inset-right))}
.cms-gallery-dialog--immersive [data-photo-prev],.cms-gallery-dialog--immersive [data-photo-next]{top:calc(50% - 24px)}
.cms-gallery-dialog--immersive [data-photo-prev]{left:max(12px,env(safe-area-inset-left))}
.cms-gallery-dialog--immersive [data-photo-next]{right:max(12px,env(safe-area-inset-right))}
.cms-gallery-dialog--immersive [data-photo-status]{position:absolute;bottom:max(20px,env(safe-area-inset-bottom));left:12px;right:12px;margin:0;text-align:center;font:13px/1.5 Arial,sans-serif;letter-spacing:.04em}
@media(max-width:599px){
 .cms-gallery-dialog--immersive .cms-gallery-stage{inset:max(80px,calc(64px + env(safe-area-inset-top))) 12px max(80px,calc(64px + env(safe-area-inset-bottom)))}
 .cms-gallery-dialog--immersive button{width:44px;height:44px;min-width:44px;min-height:44px}
}
@media(prefers-reduced-motion:reduce){.cms-gallery-dialog--immersive,.cms-gallery-dialog--immersive *{animation:none;transition:none;scroll-behavior:auto}}
@media(forced-colors:active){.cms-gallery-dialog--immersive button{border:2px solid ButtonText}.cms-gallery-dialog--immersive button:focus-visible{outline-color:Highlight}}
