/* Viewer v2 (2026-11-08). Scoped to .mgv; does not alter shared site.css */

.mgv{border:0;padding:0;margin:0;width:100vw;height:100dvh;max-width:none;max-height:none;background:#f7f3ec;color:#2a2622}
.mgv::backdrop{background:#f7f3ec}
.mgv-in{display:grid;grid-template-rows:auto 1fr auto auto;height:100%;max-width:1440px;margin:0 auto;padding:12px 24px 16px;box-sizing:border-box}
.mgv-top{display:flex;align-items:center;gap:12px}
.mgv-ttl{font-family:"MG Serif",Georgia,serif;font-size:28px;margin:0;font-weight:500;color:#2a2622}
.mgv-n{margin:0 auto;font-size:17px;color:#5a514a;font-variant-numeric:tabular-nums}
.mgv button{min-width:44px;min-height:44px;background:#fff;color:#2a2622;border:1px solid #5a514a;border-radius:6px;font:inherit;font-size:16px;cursor:pointer;padding:0 14px}
.mgv button:hover{border-color:#2a2622}
.mgv button:focus-visible{outline:3px solid #8e2416;outline-offset:3px}
.mgv button[aria-pressed="true"]{background:#2a2622;color:#fff}
.mgv-x{font-size:26px!important;padding:0!important}
.mgv-stage{position:relative;min-height:0;display:flex;align-items:center;justify-content:center;gap:16px}
.mgv-frame{flex:1;min-width:0;height:100%;display:flex;align-items:center;justify-content:center;overflow:hidden;touch-action:pan-y pinch-zoom}
.mgv-frame.zoomed{overflow:auto;justify-content:flex-start;align-items:flex-start;touch-action:auto;cursor:grab}
.mgv-img{display:block;max-width:100%;max-height:100%;width:auto;height:auto;object-fit:contain;outline:1px solid #d6d0c4}
.mgv-frame.zoomed .mgv-img{max-width:none;max-height:none;margin:auto}
.mgv-side{width:52px;height:64px;font-size:30px!important;padding:0!important;flex:0 0 auto}
.mgv-cap{border-top:1px solid #d6d0c4;margin:14px auto 0;padding-top:12px;width:min(100%,900px);display:flex;flex-wrap:wrap;gap:4px 24px;align-items:baseline;justify-content:space-between}
.mgv-t{font-family:"MG Serif",Georgia,serif;font-size:30px;line-height:1.2;margin:0;font-weight:500;color:#2a2622}
.mgv-c{margin:0;font-size:17px;color:#5a514a}
.mgv-hint{margin:0;font-size:14px;color:#5a514a}
.mgv-tools{display:flex;gap:8px;justify-content:center;margin-top:10px}
.mgv-bot{display:none}
.mgv-strip{list-style:none;margin:10px 0 0;padding:4px 2px 6px;display:flex;gap:8px;overflow-x:auto}
.mgv-strip[hidden]{display:none}
.mgv-strip li{flex:0 0 auto}
.mgv-strip button{width:72px;height:72px;padding:0!important;background:#fff;border:2px solid transparent}
.mgv-strip button[aria-current="true"]{border-color:#2a2622}
.mgv-strip img{width:100%;height:100%;object-fit:cover;display:block}
@media (max-width:760px){
 .mgv-in{padding:8px 12px 12px}
 .mgv-ttl{display:none}.mgv-n{margin:0 auto 0 0}
 .mgv-side{display:none}
 .mgv-t{font-size:26px}
 .mgv-cap{display:block}.mgv-hint{display:none}
 .mgv-bot{display:flex;justify-content:space-between;gap:12px;border-top:1px solid #d6d0c4;margin-top:12px;padding-top:12px}
 .mgv-bot button{flex:1;min-height:48px}
}
@media (prefers-reduced-motion:reduce){.mgv *{scroll-behavior:auto!important;transition:none!important}}

/* v2 fix (2026-11-08): keep the zoomed 1:1 image from widening the grid/dialog on narrow screens.
   Grid column and stage may shrink below image width; only .mgv-frame scrolls when zoomed. */
.mgv{overflow:hidden}
.mgv-in{grid-template-columns:minmax(0,1fr)}
.mgv-in>*{min-width:0}
.mgv-stage{min-width:0}
.mgv-frame{max-width:100%;overscroll-behavior:contain}
