.aps-gallery{--aps-gallery-gap:8px;position:relative;width:100%;max-width:100%;margin:1.5rem 0;box-sizing:border-box}
.aps-gallery-track{gap:var(--aps-gallery-gap)}
.aps-gallery .aps-gallery-item{display:block;flex:none!important;width:var(--aps-gallery-thumb)!important;height:var(--aps-gallery-thumb)!important;min-width:var(--aps-gallery-thumb);max-width:none;aspect-ratio:1;overflow:hidden;cursor:zoom-in;box-sizing:border-box}
.aps-gallery .aps-gallery-item img{display:block;width:100%!important;height:100%!important;object-fit:cover;max-width:none}
.aps-gallery--grid .aps-gallery-track{display:grid;grid-template-columns:repeat(var(--aps-gallery-cols),var(--aps-gallery-thumb));justify-content:start;overflow-x:auto;max-width:100%}
/* Let the carousel use the full viewport, not just the article's text column.
   Never shrink the configured thumbnail; scroll if the screen is too narrow. */
.aps-gallery--carousel{width:100%;max-width:100%;position:relative;left:auto;transform:none;padding:0 50px;overflow:hidden}
.aps-gallery--carousel .aps-gallery-track{display:flex;overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:none;width:100%;max-width:100%;margin-inline:auto;overscroll-behavior-x:contain}
.aps-gallery--carousel .aps-gallery-track::-webkit-scrollbar{display:none}
.aps-gallery--carousel .aps-gallery-item{scroll-snap-align:start}
.aps-gallery-arrow{position:absolute;top:calc(var(--aps-gallery-thumb)/2);transform:translateY(-50%);background:transparent;border:1px solid #bbb;color:inherit;width:28px;height:36px;cursor:pointer;z-index:1}
.aps-gallery-prev{left:5px}.aps-gallery-next{right:5px}

.aps-gallery-lightbox{position:fixed;inset:0;z-index:2147483000;background:rgba(0,0,0,.94);display:flex;align-items:center;justify-content:center;flex-direction:column;padding:56px 54px 35px;box-sizing:border-box;color:white}
.aps-gallery-lightbox[hidden]{display:none}.aps-gallery-lightbox img{max-width:100%;max-height:calc(100vh - 170px);object-fit:contain}
.aps-gallery-lightbox .aps-lightbox-caption{font-size:14px;line-height:1.5;text-align:center;max-width:900px;margin-top:15px;white-space:pre-line}
.aps-gallery-lightbox button{border:0;background:transparent;color:white;font-size:32px;cursor:pointer;position:absolute}
.aps-lightbox-close{right:18px;top:8px}.aps-lightbox-prev{left:12px;top:50%}.aps-lightbox-next{right:12px;top:50%}.aps-lightbox-count{font-size:13px;margin-top:8px}
