/* On-demand gallery dialog. No gallery thumbnails appear in the document flow. */
.photo-viewer{box-sizing:border-box;position:fixed;--viewer-frame-inset:14px;--panel-outline:linear-gradient(135deg,#ffbdd5,#c9a1fb 55%,#ffd179);background:linear-gradient(#171923,#171923) padding-box,var(--panel-outline) border-box;color:var(--paper);border:7px solid transparent;border-radius:24px;padding:0;width:min(95vw,1120px);height:min(92dvh,930px);max-height:92dvh;box-shadow:0 36px 100px rgba(0,0,0,.65)}
.photo-viewer::backdrop{background:rgba(5,7,12,.9);backdrop-filter:blur(8px)}
.viewer-inner{height:100%;min-height:0;display:flex;flex-direction:column;gap:12px;padding:26px}
.viewer-header{display:flex;justify-content:space-between;align-items:flex-start;gap:18px;flex:none}
.viewer-heading{min-width:0}
.viewer-header h2{font:700 clamp(29px,3.5vw,44px)/1.05 var(--display-font);letter-spacing:-.035em;margin:6px 0 4px}
/* The heading receives initial programmatic dialog focus for screen readers.
   It is not in the Tab order, so no visible focus ring is needed here. */
#viewer-title:focus{outline:none}
.viewer-header p{margin:0;color:#bcc3d3;font-size:13px;line-height:1.55}
.viewer-close,.viewer-back{color:var(--paper);cursor:pointer;font:600 12px/1.2 var(--mono-font);border:2px solid var(--action-border,#e3bfe0);border-radius:8px;background:var(--action-fill,linear-gradient(135deg,#73506b,#51456b,#2f5167));padding:12px 16px;transition:background .2s,border-color .2s}
.viewer-close:hover,.viewer-back:hover{border-color:var(--action-border-hover,#ffda8e);background:var(--action-fill-hover,linear-gradient(135deg,#93657f,#695484,#397085))}
.viewer-back{margin-bottom:4px;padding:8px 12px}
.viewer-grid{min-height:0;overflow-y:auto;align-content:start;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin-top:12px;padding:2px 4px 16px 1px;flex:1}
.gallery-album{appearance:none;display:flex;flex-direction:column;align-self:start;cursor:pointer;text-align:left;color:var(--paper);font:inherit;background:var(--action-fill,linear-gradient(135deg,#73506b,#51456b,#2f5167));border:2px solid var(--action-border,#e3bfe0);border-radius:12px;padding:0;overflow:hidden;transition:transform .2s,border-color .2s,background .2s}
.gallery-album:hover{transform:translateY(-3px);border-color:var(--action-border-hover,#ffda8e);background:var(--action-fill-hover,linear-gradient(135deg,#93657f,#695484,#397085))}
.gallery-album:focus-visible,.viewer-close:focus-visible,.viewer-back:focus-visible,.viewer-step:focus-visible{outline:3px solid var(--yellow);outline-offset:3px}
.gallery-album-image{width:100%;height:auto;aspect-ratio:1/1;display:block;object-fit:cover;background:#373743}
.gallery-album-body{padding:12px 13px 14px;display:grid;gap:4px}
.gallery-album-body strong{font:700 clamp(16px,1.7vw,21px)/1.18 var(--display-font)}
.gallery-album-body small{font-size:12px;color:#c4c4d0;line-height:1.5}
.gallery-empty{grid-column:1/-1;color:#bfc4d3;margin:20px 0;font-size:16px}
.viewer-photo-stage{min-height:0;flex:1;display:grid;grid-template-columns:54px minmax(0,1fr) 54px;align-items:center;gap:13px}
.viewer-figure{min-width:0;min-height:0;height:100%;margin:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px}
.viewer-figure img{display:block;max-height:100%;height:auto;min-height:0;max-width:100%;object-fit:contain;border-radius:5px}
.viewer-figure figcaption{font-size:14px;color:#d2d0db;text-align:center;flex:none}
.viewer-step{display:grid;place-content:center;height:68px;width:52px;border:2px solid var(--action-border,#e3bfe0);border-radius:10px;background:var(--action-fill,linear-gradient(135deg,#73506b,#51456b,#2f5167));color:var(--paper);font:500 52px/1 var(--display-font);cursor:pointer;transition:background .2s,border-color .2s}
.viewer-step:hover:not(:disabled){background:var(--action-fill-hover,linear-gradient(135deg,#93657f,#695484,#397085));border-color:var(--action-border-hover,#ffda8e)}
.viewer-step:disabled{opacity:.23;cursor:default}
.viewer-count{flex:none;font:500 12px var(--mono-font);color:#bdc2d2;text-align:center;min-height:18px;margin:0}
.photo-viewer [hidden]{display:none!important}
/* Match the 5px rounded frames used by the information panels on tablets and phones. */
@media(max-width:1080px){.photo-viewer{border-width:5px;border-radius:20px;--viewer-frame-inset:10px}}
@media(max-width:960px){.viewer-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:640px){.photo-viewer{width:98vw;height:94dvh;max-height:94dvh;border-radius:20px}.viewer-inner{padding:16px;gap:9px}.viewer-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.viewer-header h2{font-size:30px}.viewer-photo-stage{grid-template-columns:35px minmax(0,1fr) 35px;gap:5px}.viewer-step{width:34px;height:58px;font-size:36px}.gallery-album-body{padding:10px 9px}.gallery-album-body strong{font-size:16px}.viewer-close{padding:9px 10px}}
@media(max-width:350px){.viewer-grid{grid-template-columns:1fr}}
@media(prefers-reduced-motion:reduce){.gallery-album{transition:none}.gallery-album:hover{transform:none}}

/* Gallery grids fit their content; the full-photo view uses the larger dialog. */
.photo-viewer[data-view="grid"]{height:auto;max-height:92dvh}
.photo-viewer[data-view="grid"] .viewer-inner{height:auto;max-height:calc(92dvh - var(--viewer-frame-inset))}
.photo-viewer[data-view="grid"] .viewer-grid{flex:initial;max-height:calc(92dvh - 170px);overflow-y:auto}
@media(max-width:640px){.photo-viewer[data-view="grid"]{max-height:94dvh}.photo-viewer[data-view="grid"] .viewer-inner{max-height:calc(94dvh - var(--viewer-frame-inset))}.photo-viewer[data-view="grid"] .viewer-grid{max-height:calc(94dvh - 145px)}}


/* Never shrink grid rows to fit a max-height dialog: scroll instead.
   Otherwise fully-sized thumbnails overlap the following rows. */
.viewer-grid{grid-auto-rows:max-content;align-items:start}
.gallery-album{min-height:0}
