/* Fit the viewing area to the available screen before applying image zoom. */
body.museum-learning #museumZoom[open]{box-sizing:border-box;display:flex;flex-direction:column;width:min(1150px,calc(100vw - 24px));height:min(900px,calc(100dvh - 24px));max-width:none;max-height:none;margin:auto;padding:clamp(14px,2.5vw,24px);overflow:auto}
#museumZoom .next-zoom-head,#museumZoom .next-zoom-controls{flex-shrink:0}
#museumZoom .next-view-choices{flex-shrink:0;max-height:96px;overflow:auto}
#museumZoom .next-zoom-frame{flex:1 1 0;min-height:60px;height:auto}
#museumZoom .next-zoom-help{flex-shrink:0;max-height:5em;overflow:auto}

/* Preserve both the artwork and its controls on short landscape screens. */
@media(max-height:500px) and (min-width:500px){
 body.museum-learning #museumZoom[open]{box-sizing:border-box;display:flex;flex-direction:column;gap:0;width:calc(100vw - 24px);height:calc(100dvh - 24px);max-height:none;max-width:1150px;margin:auto;padding:12px 18px;overflow:auto}
 #museumZoom .next-zoom-head{flex-direction:row;align-items:center;gap:12px;flex-shrink:0}
 #museumZoom .next-zoom-head .eyebrow{display:none}
 #museumZoom .next-zoom-head h2{font-size:22px;line-height:1.2;margin:0}
 #museumZoom .next-zoom-head button{min-height:44px;padding:8px 12px;font-size:14px}
 #museumZoom .next-view-choices{flex-shrink:0;max-height:48px;overflow:auto}
 #museumZoom .next-zoom-controls{flex-shrink:0;gap:6px;margin:8px 0}
 #museumZoom .next-zoom-controls label{flex:1;min-width:100px;font-size:12px;gap:6px}
 #museumZoom .next-zoom-controls input{min-width:40px;width:100%}
 #museumZoom .next-zoom-controls output{min-width:42px;font-size:13px}
 #museumZoom .next-zoom-controls button{min-height:44px;min-width:44px;padding:8px 10px;font-size:13px}
 #museumZoom .next-zoom-frame{flex:1 1 0;min-height:60px;height:auto}
 #museumZoom .next-zoom-help{flex-shrink:0;max-height:3em;overflow:auto;font-size:12px;line-height:1.45;margin:6px 0 0}
}
/* Three clear control rows instead of scattered buttons on narrow phones. */
@media(max-width:500px){
 #museumZoom .next-zoom-head{flex-direction:row;align-items:flex-start;gap:10px}
 #museumZoom .next-zoom-head>div{flex:1;min-width:0}
 #museumZoom .next-zoom-head .eyebrow{display:none}
 #museumZoom .next-zoom-head h2{font-size:22px;line-height:1.25;margin:0}
 #museumZoom #nextZoomClose{width:44px;min-width:44px;height:44px;min-height:44px;padding:0;font-size:0}
 #museumZoom #nextZoomClose::after{content:'×';font-size:28px;line-height:1}
 #museumZoom .next-zoom-controls{display:grid;grid-template-columns:44px minmax(0,1fr) 44px;gap:6px;margin:12px 0}
 #museumZoom .next-zoom-controls label{grid-column:1/-1;grid-row:1;min-width:0;min-height:32px;font-size:13px}
 #museumZoom .next-zoom-controls input{min-width:0;flex:1;width:100%}
 #museumZoom #nextZoomOut{grid-column:1;grid-row:2}
 #museumZoom #nextZoomValue{grid-column:2;grid-row:2;text-align:center}
 #museumZoom #nextZoomIn{grid-column:3;grid-row:2}
 #museumZoom #nextZoomReset{grid-column:1/-1;grid-row:3}
 #museumZoom .next-zoom-controls button{min-height:44px;padding:8px;font-size:14px}
 #museumZoom .next-zoom-frame{min-height:124px}
 #museumZoom .next-zoom-help{max-height:4.4em;font-size:12px;line-height:1.45;margin:8px 0 0}
}
