/* Manual galleries keep reading position stable and support any maintained image count. */
.trial-gallery{--trial-gallery-ratio:16 / 9;min-width:0;margin:0;align-self:start}
.trial-gallery[data-gallery-orientation="portrait"]{--trial-gallery-ratio:2 / 3}
.trial-gallery [hidden]{display:none!important}
.trial-gallery-selectors{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:0;margin:3px 0 0}
.trial-gallery-selectors[data-gallery-position="top"]{min-height:32px;margin:0 0 8px}
.trial-gallery-selectors button{display:grid;place-items:center;flex:0 0 24px;width:24px;height:24px;margin:0;padding:0;border:0;border-radius:50%;background:transparent;cursor:pointer}
.trial-gallery-selectors[data-gallery-position="top"] button{flex-basis:32px;width:32px;height:32px}
@media(pointer:coarse){.trial-gallery-selectors button{flex-basis:32px;width:32px;height:32px}}
.trial-gallery-selectors button>span{display:block;width:7px;height:7px;border-radius:10px;background:var(--ui-muted);opacity:.5;transition:width .18s ease,background-color .18s ease,opacity .18s ease}
.trial-gallery-selectors button[aria-pressed="true"]>span{width:18px;background:var(--ui-blue);opacity:1}
.trial-gallery-selectors button:hover>span{background:var(--ui-blue);opacity:1}
.trial-gallery button:focus-visible,.trial-gallery-picture:focus-visible{outline:3px solid var(--ui-focus);outline-offset:3px}
.trial-gallery-slide{min-width:0;margin:0 0 12px}
.trial-gallery-slide:last-child{margin-bottom:0}
.trial-gallery-slide:not([hidden]){animation:trial-gallery-reveal .2s ease-out}
@keyframes trial-gallery-reveal{from{opacity:.35}to{opacity:1}}
@media(prefers-reduced-motion:reduce){.trial-gallery-slide:not([hidden]){animation:none}.trial-gallery-selectors button>span{transition:none}}
/* Override the older compact-poster rules and round the fitted image itself. */
.trial-gallery .trial-gallery-picture{position:relative;display:block;width:100%;height:auto;max-width:100%;aspect-ratio:var(--trial-gallery-ratio);margin:0;border:1px solid #cbd5e1;border-radius:20px;background:#f1f5fb;box-shadow:0 6px 20px #23385b14;overflow:hidden;cursor:zoom-in}
.trial-gallery .trial-gallery-picture img{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:block;width:auto;height:auto;max-width:calc(100% - 16px);max-height:calc(100% - 16px);object-fit:contain;object-position:center;border-radius:12px}
.trial-gallery-slide figcaption{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:3px 12px;margin:6px 0 0;color:var(--ui-muted);font-size:11px;line-height:1.6}
.trial-gallery-slide figcaption>*{min-width:0;max-width:100%;overflow-wrap:anywhere}
.trial-gallery-slide figcaption strong{font-weight:500}
.trial-gallery-sources{margin-top:8px;padding:8px 10px;border:1px solid var(--ui-line);border-radius:8px;background:var(--ui-surface);font-size:12px;line-height:1.6;color:var(--ui-ink)}
.trial-gallery-sources summary{cursor:pointer;color:var(--ui-blue)}
.trial-gallery-sources p{margin:8px 0 4px;font-size:12px}
.trial-gallery-sources dl{margin:8px 0}.trial-gallery-sources dt{font-weight:650;margin-top:6px}.trial-gallery-sources dd{margin:2px 0 6px}
.trial-gallery-sources ul{margin:4px 0;padding-left:18px}
.trial-gallery-sources small{color:var(--ui-muted);font-size:11px}
@media(max-width:800px){.trial-prepare-page .trial-readiness-panel>.trial-gallery{grid-row:span 2}}
@media(max-width:600px){.trial-gallery[data-gallery-orientation="portrait"] .trial-gallery-picture{max-width:380px;margin-inline:auto}}
@media print{.trial-gallery-selectors,.trial-gallery-sources{display:none!important}.trial-gallery-slide{break-inside:avoid}.trial-prepare-page .trial-gallery{display:none!important}}
