/* ============================================================================
   photo-lightbox.css — the flat enlarger for photographs (.ex-lb).

   SHARED by portfolio/index.html (the "Exhibition views" mosaic) and
   portfolio/the-unfolding.html (the opening photographs), with
   pictures/photo-lightbox.js, which builds the dialog. Change it here once.

   The works have their own immersive frame viewer (.gallery in index.html):
   these photos are already of real rooms, so they get a plain dark enlarger
   with zoom/pan, prev/next, a count and a caption. Tokens come from the page
   (--serif, --sans, --on-dark), with fallbacks.
   ============================================================================ */

body.ex-lb-open{overflow:hidden;}
.ex-lb{width:100vw;max-width:none;height:100dvh;max-height:none;margin:0;padding:0;border:0;background:rgba(14,13,10,0.98);color:var(--on-dark,#ECE9E0);overflow:hidden;}
.ex-lb:not([open]){display:none;}
.ex-lb::backdrop{background:rgba(7,6,4,0.88);}
.ex-lb-shell{min-height:100dvh;padding:clamp(16px,3vw,34px);display:grid;grid-template-columns:minmax(46px,6vw) minmax(0,1fr) minmax(46px,6vw);grid-template-rows:auto minmax(0,1fr);gap:14px;align-items:center;}
.ex-lb-figure{grid-column:2;grid-row:1 / span 2;margin:0;width:100%;height:100%;min-height:0;display:grid;grid-template-rows:minmax(0,1fr) auto;place-items:center;gap:clamp(14px,2vh,22px);position:relative;z-index:1;}
.ex-lb-stage{position:relative;max-width:100%;max-height:calc(100dvh - clamp(150px,20vh,210px));display:grid;place-items:center;overflow:hidden;background:#0b0a08;touch-action:none;cursor:zoom-in;}
.ex-lb-stage.is-detail{cursor:grab;}
.ex-lb-stage.is-dragging{cursor:grabbing;}
.ex-lb-image{max-width:100%;max-height:calc(100dvh - clamp(150px,20vh,210px));object-fit:contain;background:#0b0a08;transform:translate3d(var(--pan-x,0px),var(--pan-y,0px),0) scale(var(--detail-scale,1));transition:transform .22s cubic-bezier(.16,1,.3,1);will-change:transform;user-select:none;-webkit-user-drag:none;}
.ex-lb-caption{width:min(100%,760px);display:grid;grid-template-columns:auto minmax(0,1fr);gap:18px;align-items:baseline;font-family:var(--sans,system-ui,sans-serif);}
.ex-lb-count{font-size:11px;font-weight:600;letter-spacing:0.08em;color:#8AA3D0;white-space:nowrap;font-variant-numeric:tabular-nums;}
.ex-lb-title{min-width:0;font-family:var(--serif,Georgia,serif);font-size:clamp(19px,1.9vw,26px);line-height:1.14;color:var(--on-dark,#ECE9E0);}
.ex-lb-btn{appearance:none;border:1px solid rgba(236,233,224,0.32);background:rgba(236,233,224,0.06);color:var(--on-dark,#ECE9E0);font-family:var(--sans,system-ui,sans-serif);display:grid;place-items:center;padding:0;cursor:pointer;transition:background .2s ease,border-color .2s ease,color .2s ease,transform .2s ease;}
.ex-lb-btn:hover{background:rgba(236,233,224,0.14);border-color:rgba(236,233,224,0.55);}
.ex-lb-btn:active{transform:scale(0.96);}
.ex-lb-btn:focus-visible{outline:3px solid #8AA3D0;outline-offset:4px;}
.ex-lb-tools{grid-column:3;grid-row:1;justify-self:end;align-self:start;display:flex;gap:10px;position:relative;z-index:3;}
.ex-lb-close{width:42px;height:42px;border-radius:50%;font-size:28px;line-height:1;}
.ex-lb-inspect{position:absolute;top:12px;right:12px;z-index:4;width:44px;height:44px;border-radius:50%;background:rgba(14,13,10,0.74);border-color:rgba(236,233,224,0.42);color:rgba(236,233,224,0.92);}
.ex-lb-inspect svg{width:20px;height:20px;display:block;stroke:currentColor;stroke-width:1.9;fill:none;stroke-linecap:round;stroke-linejoin:round;}
.ex-lb-inspect .inspect-minus{opacity:0;}
.ex-lb.is-detail .ex-lb-inspect{background:rgba(138,163,208,0.22);border-color:rgba(138,163,208,0.82);color:#DCE6F7;}
.ex-lb.is-detail .ex-lb-inspect .inspect-plus{opacity:0;}
.ex-lb.is-detail .ex-lb-inspect .inspect-minus{opacity:1;}
.ex-lb.is-detail .ex-lb-stage{width:min(100%,980px);height:calc(100dvh - clamp(120px,16vh,180px));max-height:none;}
.ex-lb.is-detail .ex-lb-image{max-width:100%;max-height:100%;}
.ex-lb-nav{width:46px;height:64px;border-radius:999px;font-size:24px;position:relative;z-index:3;}
.ex-lb-prev{grid-column:1;grid-row:2;justify-self:start;}
.ex-lb-next{grid-column:3;grid-row:2;justify-self:end;}
/* No magnifier ({ inspect: false }): the left and right halves of the photo turn
   the page, and the cursor is the same round arrow as the buttons beside it. */
.ex-lb-zone{display:none;}
.ex-lb.no-inspect .ex-lb-inspect{display:none;}
.ex-lb.no-inspect .ex-lb-stage{cursor:default;}
.ex-lb.no-inspect .ex-lb-zone{display:block;position:absolute;top:0;bottom:0;z-index:2;width:50%;margin:0;padding:0;border:0;background:none;appearance:none;-webkit-appearance:none;-webkit-tap-highlight-color:transparent;}
.ex-lb.no-inspect .ex-lb-zone[hidden]{display:none;}
.ex-lb-zone-prev{left:0;cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Ccircle cx='20' cy='20' r='18.5' fill='rgba(14,13,10,0.62)' stroke='rgba(236,233,224,0.6)'/%3E%3Cpath d='M23 13l-7 7 7 7' fill='none' stroke='%23ECE9E0' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 20 20,w-resize;}
.ex-lb-zone-next{right:0;cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Ccircle cx='20' cy='20' r='18.5' fill='rgba(14,13,10,0.62)' stroke='rgba(236,233,224,0.6)'/%3E%3Cpath d='M17 13l7 7-7 7' fill='none' stroke='%23ECE9E0' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 20 20,e-resize;}

/* Without a caption on show (create(photos, {captions:false})) the count sits alone, centred under the photo. */
.ex-lb-caption:has(.ex-lb-sr){grid-template-columns:auto;justify-content:center;}
.ex-lb-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;}
.ex-lb[open] .ex-lb-figure{animation:ex-lb-in .24s cubic-bezier(.16,1,.3,1);}
@keyframes ex-lb-in{from{opacity:0;transform:translateY(10px) scale(0.985);}to{opacity:1;transform:translateY(0) scale(1);}}

@media (max-width:720px){
  .ex-lb-shell{grid-template-columns:1fr 1fr;grid-template-rows:auto minmax(0,1fr) auto;padding:14px;gap:12px;}
  .ex-lb-tools{grid-column:1 / -1;grid-row:1;gap:8px;}
  .ex-lb-figure{grid-column:1 / -1;grid-row:2;}
  .ex-lb-stage,.ex-lb-image{max-height:calc(100dvh - 230px);}
  .ex-lb-inspect{top:10px;right:10px;}
  .ex-lb.is-detail .ex-lb-stage{width:100%;height:clamp(320px,calc(100dvh - 260px),620px);}
  .ex-lb-caption{grid-template-columns:1fr;gap:5px;text-align:left;}
  .ex-lb-nav{grid-row:3;width:50px;height:44px;}
  .ex-lb-prev{grid-column:1;justify-self:start;}
  .ex-lb-next{grid-column:2;justify-self:end;}
}

@media (prefers-reduced-motion: reduce){
  .ex-lb[open] .ex-lb-figure{animation:none;}
  .ex-lb-image{transition:none;}
}
