#dialog:has(.order-photo-gallery){padding:20px;width:min(760px,calc(100% - 28px));max-height:94dvh}
#dialog:has(.order-photo-gallery) .dialog-head{margin-bottom:16px}
.order-gallery-stage{position:relative;display:flex;align-items:center;justify-content:center;min-height:160px;overflow:hidden;border-radius:16px;background:var(--soft)}
.order-gallery-image{display:block;max-width:100%;max-height:calc(90dvh - 130px);width:auto;height:auto;object-fit:contain}
.order-gallery-stage[data-photo-zoom]{touch-action:none;user-select:none;-webkit-user-select:none}
.order-gallery-stage[data-photo-zoom] .order-gallery-image{-webkit-touch-callout:none}
.order-gallery-stage[data-photo-zoom] .order-gallery-edge{z-index:1}
.order-gallery-stage[data-photo-zoom] .order-gallery-thumbnails{touch-action:pan-x}
.order-gallery-edge{position:absolute;top:0;bottom:0;width:30%;min-height:44px;padding:12px;display:flex;align-items:center;border:0;color:var(--ink);background:transparent;cursor:pointer;border-radius:0}
.order-gallery-edge.previous{left:0;justify-content:flex-start}
.order-gallery-edge.next{right:0;justify-content:flex-end}
.order-gallery-edge span{display:grid;place-items:center;width:44px;height:44px;pointer-events:none}
.order-gallery-edge svg{width:24px;height:24px;color:#fff;opacity:.35;filter:drop-shadow(0 1px 2px #0009)}
.order-gallery-edge:is(:hover,:focus-visible,:active) svg{opacity:.75}
.order-gallery-edge.next svg{transform:rotate(180deg)}
.order-gallery-edge:focus-visible{outline:3px solid var(--focus);outline-offset:-4px}
.order-gallery-count{position:absolute;top:10px;left:50%;transform:translateX(-50%);padding:3px 9px;border-radius:20px;background:var(--surface-overlay);color:var(--ink);font-size:12px;font-variant-numeric:tabular-nums;pointer-events:none}
.order-gallery-thumbnails{position:absolute;z-index:1;bottom:10px;left:50%;transform:translateX(-50%);display:flex;gap:8px;max-width:calc(100% - 20px);padding:5px;border-radius:13px;background:#0005;overflow-x:auto}
.order-gallery-thumb{display:block;flex:none;width:54px;height:54px;padding:2px;border:2px solid #fff;border-radius:10px;background:#fff;overflow:hidden;box-shadow:0 1px 5px #0005;cursor:pointer}
.order-gallery-thumb img{display:block;width:100%;height:100%;object-fit:cover;border-radius:5px;pointer-events:none}
.order-gallery-thumb[aria-current="true"]{border:3px solid var(--accent);box-shadow:0 0 0 2px #fff;}
.order-gallery-thumb:focus-visible{outline:3px solid var(--focus);outline-offset:2px}
.order-gallery-error{position:absolute;left:12px;right:12px;top:44px;text-align:center;padding:8px;border-radius:10px;background:var(--surface);color:var(--ink);font-size:14px}
.order-gallery-error[hidden]{display:none}
.large-text .order-gallery-count{font-size:16px}
.large-text .order-gallery-error{font-size:18px}
@media(max-width:650px){#dialog:has(.order-photo-gallery){padding:14px;width:calc(100% - 20px)}#dialog:has(.order-photo-gallery) .dialog-head{gap:10px;margin-bottom:12px}.order-gallery-edge{padding:6px}}
@media(max-height:500px){.order-gallery-image{max-height:calc(94dvh - 115px)}.order-gallery-stage{min-height:120px}.order-gallery-thumb{width:44px;height:44px}.order-gallery-thumbnails{bottom:6px;padding:4px}}

#dialog:has(.order-gallery-frameless){
  --order-photo-width:calc(100vw - 2 * max(10px,env(safe-area-inset-left,0px),env(safe-area-inset-right,0px)));
  --order-photo-height:calc(100dvh - 2 * max(12px,env(safe-area-inset-top,0px),env(safe-area-inset-bottom,0px)));
  width:fit-content;max-width:var(--order-photo-width);max-height:var(--order-photo-height);
  padding:0;border:0;border-radius:16px;background:transparent;box-shadow:none;overflow:hidden;
}
#dialog:has(.order-gallery-frameless) .dialog-head{position:absolute;inset:8px 8px auto auto;margin:0;z-index:2}
#dialog:has(.order-gallery-frameless) .dialog-head h2{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
#dialog:has(.order-gallery-frameless) .dialog-head .iconbtn{width:44px;height:44px;color:#fff;background:#141a20db;border:1px solid #fff9}
#dialog:has(.order-gallery-frameless) .dialog-head .iconbtn:hover{background:#141a20}
#dialog:has(.order-gallery-frameless) .dialog-head .iconbtn:focus-visible{outline:2px solid #fff;outline-offset:1px;box-shadow:0 0 0 4px #141a20}
.order-gallery-frameless .order-gallery-stage{min-height:0;border-radius:0;background:transparent}
.order-gallery-frameless .order-gallery-image{
  min-width:64px;min-height:64px;
  width:min(var(--order-photo-width),calc(var(--order-photo-height) * var(--order-photo-ratio,1)));
  max-width:var(--order-photo-width);max-height:var(--order-photo-height);
}
.order-gallery-frameless .order-gallery-edge:focus-visible{outline:2px solid #fff;box-shadow:inset 0 0 0 4px #141a20}
.order-gallery-frameless .order-gallery-thumb:focus-visible{outline-color:#fff;box-shadow:0 0 0 4px #141a20}
.order-gallery-frameless .order-gallery-error{top:60px}
