/* Gallery pages: photos in columns (3 on web, 2 on phones), keeping the photo order, plus a lightbox */
:root{--g-gap:.5rem}
@media(max-width:700px){:root{--g-gap:.25rem}}

.g-head{padding:1.5rem clamp(1.25rem,5vw,4rem) 2.5rem;text-align:center}
.g-logo{display:block;width:clamp(150px,17vw,220px);margin:0 auto 1.75rem;line-height:0}
.g-logo img{display:block;width:100%;height:auto}
.g-head .back{display:inline-block;margin-bottom:1.5rem;padding:.6rem .75rem;font-size:.95rem;color:#6b766f;text-decoration:none}
.g-head .back:hover{text-decoration:underline;text-underline-offset:6px}
.g-head h1{font-size:clamp(2.25rem,5vw,3.75rem);margin-bottom:.5rem}
.g-head p{color:#6b766f}

.g-main{padding:0 clamp(.75rem,3vw,3rem) 4rem}
@media(max-width:700px){.g-main{padding:0 .25rem 3rem}}
.g-grid{display:flex;align-items:flex-start;gap:var(--g-gap)}
.g-col{flex:1 1 0;min-width:0;display:flex;flex-direction:column;gap:var(--g-gap)}
.g-item{aspect-ratio:var(--r);background:var(--blush)}
.g-btn{display:block;width:100%;height:100%;padding:0;border:0;background:none;cursor:zoom-in}
.g-btn img{display:block;width:100%;height:100%;object-fit:cover}
.g-empty{max-width:34rem;margin:2rem auto;text-align:center;color:#6b766f}

.g-lb{border:0;padding:0;max-width:none;max-height:none;width:100vw;height:100vh;background:rgba(24,18,28,.97);color:#fff}
.g-lb[open]{display:flex;align-items:center;justify-content:center}
.g-lb::backdrop{background:rgba(24,18,28,.97)}
.g-lb{overflow:hidden}
.lb-track{position:absolute;inset:0;will-change:transform}
.lb-slide{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;transform:translateX(calc(var(--o,0)*100%))}
.lb-slide img{will-change:opacity,transform;aspect-ratio:var(--r,1.5);width:min(94vw,calc(88vh*var(--r,1.5)));height:auto;background:rgba(255,255,255,.45);box-shadow:0 8px 30px rgba(0,0,0,.12)}
.g-lb .lb-slide img.ld{animation:lbThumb .3s ease}
@keyframes lbThumb{from{opacity:0}to{opacity:1}}
.g-lb img{max-width:94vw;max-height:88vh;object-fit:contain}
.g-lb button{z-index:2;position:absolute;background:none;border:0;color:#fff;font:300 2.5rem/1 var(--serif);cursor:pointer;padding:.75rem 1rem;opacity:.85}
.g-lb button:hover{opacity:1}
.lb-close{top:.5rem;right:.5rem}
.lb-prev{left:.25rem;top:50%;transform:translateY(-50%)}
.lb-next{right:.25rem;top:50%;transform:translateY(-50%)}

/* Web only: double the spacing, and the same space at the window edges as between photos */
@media(min-width:701px){:root{--g-gap:1rem}.g-main{padding:0 var(--g-gap) 4rem}}

/* Web only (same as the test site): photos fade in softly and zoom slightly on hover.
   A photo stays hidden until it has loaded AND you have scrolled to it (the script adds .in), then fades in once and stays. */
@media(min-width:701px){
  .g-btn{cursor:default}
  .g-item{overflow:hidden;background:transparent}
  .g-btn img{transition:opacity 1.6s cubic-bezier(.22,.8,.2,1),transform 1.4s cubic-bezier(.22,.8,.2,1)}
  .g-grid.reveal-on .g-item .g-btn img{opacity:0}
  .g-grid.reveal-on .g-item.in .g-btn img{opacity:1}
  @media(hover:hover){.g-btn:hover img{transform:scale(1.035)}}
}
@media(prefers-reduced-motion:reduce){
  .g-grid.reveal-on .g-item .g-btn img{opacity:1}
  .g-btn img{transition:none}
}

/* Phones only: the enlarged photo sits over a white veil (40%), and opens and closes with a soft fade */
@media(max-width:700px){
  .g-lb{background:rgba(255,255,255,.65);touch-action:pan-y}
  .g-lb::backdrop{background:transparent}
  .g-lb img{box-shadow:0 8px 30px rgba(0,0,0,.25)}
  .g-lb button{color:var(--ink);text-shadow:none}
  .g-lb[open]{animation:lbIn .45s ease backwards}
  .g-lb[open] img{animation:lbImg .7s cubic-bezier(.22,.8,.2,1) backwards}
  .g-lb.is-closing{opacity:0;transition:opacity .18s ease-out}
  .g-lb.is-closing .lb-track{transform:scale(.97);transition:transform .18s ease-out}
  @keyframes lbIn{from{opacity:0}to{opacity:1}}
  @keyframes lbImg{from{opacity:0;transform:scale(.96)}to{opacity:1;transform:none}}
}
@media(prefers-reduced-motion:reduce){.g-lb[open],.g-lb[open] img{animation:none}.lb-track,.lb-slide img{transition:none!important}.g-lb.is-closing{transition:none}}

/* Web only: logo at the left, title centred on the same line, further up the page. Phones keep their own layout. */
@media(min-width:701px){
  .g-head{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;padding:1.5rem clamp(1.25rem,3vw,3rem) 2rem;text-align:center}
  .g-head .g-logo{grid-column:1;justify-self:start;margin:0}
  .g-head h1{grid-column:2;margin:0}
}
