/* Neutral, read-only photo viewing shared with the owner's preview. */
.photo-gallery-trigger{cursor:zoom-in}
.photo-gallery-trigger:focus-visible,.photo-gallery-thumb:focus-visible{outline:2px solid var(--muted);outline-offset:4px}
.photo-gallery-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}
.photo-gallery-grid .photo-gallery-item{margin:0;min-width:0}
.photo-gallery-thumb{display:block;width:100%;padding:0;border:0;background:var(--soft);cursor:zoom-in;aspect-ratio:4/3;overflow:hidden}
.photo-gallery-thumb img{display:block;width:100%;height:100%;max-height:none;object-fit:cover}
.photo-gallery-item video{display:block;width:100%;aspect-ratio:4/3;max-height:none;object-fit:contain;background:#202020}
.photo-gallery-item figcaption{font:10px/1.7 var(--sans);color:var(--muted);margin-top:8px;overflow-wrap:anywhere;white-space:pre-line}
.photo-gallery-item .photo-gallery-copy{display:grid;row-gap:17px;white-space:normal}
.photo-gallery-item .photo-gallery-item-title,.photo-gallery-item .photo-gallery-item-excerpt{margin:0;font:inherit;white-space:pre-line}
.photo-gallery-item .photo-gallery-item-excerpt{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;line-clamp:3;overflow:hidden;white-space:normal}
.photo-gallery-item figcaption[hidden],.photo-gallery-item figcaption [hidden]{display:none!important}
/* Each photograph's complete story is distinct from its image-only zoom viewer. */
.photo-story-dialog{box-sizing:border-box;width:min(960px,calc(100vw - 32px));max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);padding:25px;border:1px solid var(--line);background:var(--paper);color:var(--ink);overflow:auto;overscroll-behavior:contain}
.photo-story-dialog::backdrop{background:#181818b3;backdrop-filter:blur(3px)}
.photo-story-top,.photo-story-controls{display:flex;align-items:center;justify-content:space-between;gap:16px}
.photo-story-top{margin-bottom:22px}
.photo-story-count{font:10px var(--mono);color:var(--muted)}
.photo-story-dialog button{box-sizing:border-box;font:11px var(--sans);min-height:44px;border:1px solid var(--line);padding:8px 14px;background:transparent;color:var(--ink);cursor:pointer}
.photo-story-dialog button:disabled{opacity:.4;cursor:default}
.photo-story-dialog button:focus-visible{outline:2px solid var(--muted);outline-offset:3px}
.photo-story-layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.05fr);gap:40px;align-items:start}
.photo-story-layout.no-copy{grid-template-columns:minmax(0,1fr)}
.photo-story-figure{min-width:0;margin:0}
.photo-story-dialog .photo-story-full{display:block;width:100%;padding:0;min-height:0;border:0;cursor:zoom-in}
.photo-story-dialog .photo-story-image{display:block;width:auto;height:auto;max-width:100%;max-height:65dvh;margin:0 auto;object-fit:contain;dynamic-range-limit:standard}
.photo-story-copy{min-width:0;padding:20px 10px 10px 0}
.photo-story-title{font:normal 34px/1.5 var(--serif);margin:0 0 25px;overflow-wrap:anywhere;white-space:pre-line}
.photo-story-caption{font:13px/2.1 var(--sans);margin:0;color:var(--muted);overflow-wrap:anywhere;white-space:pre-line}
.photo-story-controls{margin-top:22px}
.photo-story-dialog [hidden]{display:none!important}
/* The image-only viewer is one solid canvas. Controls float above the photograph;
   its focused stage must never paint a focus outline or panel edge. */
.photo-lightbox{box-sizing:border-box;position:fixed;inset:0;width:100vw;height:100vh;height:100dvh;max-width:none;max-height:none;margin:0;padding:0;border:0;border-radius:0;outline:0;background:#202020;color:#f5f5f5;overflow:hidden;box-shadow:none;transform:none;overscroll-behavior:none}
.photo-lightbox[open]{display:block;animation:none}
.photo-lightbox::backdrop{background:#202020;backdrop-filter:none;-webkit-backdrop-filter:none}
.photo-lightbox-top{position:absolute;z-index:2;top:max(12px,env(safe-area-inset-top));left:max(16px,env(safe-area-inset-left));right:max(12px,env(safe-area-inset-right));display:flex;align-items:center;justify-content:space-between;gap:16px;pointer-events:none}
.photo-lightbox-top .photo-lightbox-count{font:10px var(--mono);color:#ededed;font-variant-numeric:tabular-nums;text-shadow:0 1px 4px #000}
.photo-lightbox-actions{display:flex;align-items:center;gap:8px;margin-left:auto}
.photo-lightbox button{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;flex:none;width:44px;height:44px;min-height:44px;padding:10px;border:0;border-radius:50%;background:#151515b3;color:#f5f5f5;cursor:pointer;pointer-events:auto;touch-action:manipulation;-webkit-tap-highlight-color:transparent}
.photo-lightbox button svg{display:block;width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}
.photo-lightbox button:disabled{opacity:.32;cursor:default}
.photo-lightbox button:focus{outline:none}
.photo-lightbox button:focus-visible{outline:2px solid #f5f5f5;outline-offset:3px}
.photo-lightbox-controls{position:absolute;z-index:2;inset:50% max(12px,env(safe-area-inset-right)) auto max(12px,env(safe-area-inset-left));display:flex;align-items:center;justify-content:space-between;gap:16px;transform:translateY(-50%);pointer-events:none}
.photo-lightbox-stage{position:absolute;inset:0;min-width:0;min-height:0;width:100%;height:100%;margin:0;padding:0;border:0;outline:0;background:#202020;overflow:hidden;touch-action:none;overscroll-behavior:none;cursor:zoom-in;isolation:auto;transform:none;will-change:auto;user-select:none;-webkit-user-select:none}
.photo-lightbox-stage:focus,.photo-lightbox-stage:focus-visible{outline:none;box-shadow:none}
.photo-lightbox-stage[data-zoomed=true]{cursor:grab}
.photo-lightbox-stage[data-dragging=true]{cursor:grabbing}
/* Width and intrinsic auto height already preserve the source ratio. Avoid an
   additional contain paint rectangle: Safari can flatten its pixels on resize. */
.photo-lightbox .photo-lightbox-image{position:absolute;left:0;top:0;display:block;height:auto;min-width:0;min-height:0;max-width:none;max-height:none;aspect-ratio:auto;margin:0;padding:0;border:0;outline:0;object-fit:fill;transform:none;transition:none;animation:none;will-change:auto;backface-visibility:visible;-webkit-backface-visibility:visible;user-select:none;-webkit-user-select:none;-webkit-user-drag:none}
.photo-lightbox-status{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;margin:0;padding:64px 20px;font:12px/1.7 var(--sans);color:#dedede;text-align:center;pointer-events:none}
.photo-lightbox [hidden]{display:none!important}
body[data-dialog-open]{overflow:hidden}
/* Progressive HDR enhancement: the full viewer keeps the original image and its gain map. */
.photo-gallery-thumb img{dynamic-range-limit:standard}
.photo-lightbox .photo-lightbox-image{dynamic-range-limit:no-limit}
@media(max-width:760px){
  .photo-gallery-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
  .photo-lightbox-top{left:max(12px,env(safe-area-inset-left))}
  .photo-lightbox-controls{left:max(8px,env(safe-area-inset-left));right:max(8px,env(safe-area-inset-right))}
  .photo-story-dialog{width:calc(100vw - 16px);max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px);padding:18px}
  .photo-story-layout{grid-template-columns:minmax(0,1fr);gap:15px}
  .photo-story-dialog .photo-story-image{max-height:52dvh}
  .photo-story-copy{padding:10px 0}
  .photo-story-title{font-size:28px;margin:0 0 20px}
  .photo-story-caption{font-size:12px}
}
