/* The gallery: a grid of photos and one photo at a time, full screen.
   Loaded by /gallery and the admin. */
.gal__bar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px 16px;margin:0 0 18px}
.gal__count{margin:0;font-weight:700;color:var(--ink-2,#4A5E4F);font-size:15px}
.gal__add{cursor:pointer}
.gal__add.is-busy{opacity:.7;pointer-events:none}
.gal__note{margin:-6px 0 16px;font-size:14.5px;font-weight:600;color:var(--green,#24592B)}
.gal__note--bad{color:#A3311F}

.gal__grid{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
@media(min-width:640px){.gal__grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}}
@media(min-width:1024px){.gal__grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}}
.gal__item{position:relative;display:block;width:100%;aspect-ratio:1;padding:0;border:0;border-radius:18px;overflow:hidden;cursor:zoom-in;
  background:#E6EBE2;-webkit-tap-highlight-color:transparent;isolation:isolate}
.gal__item img{position:relative;display:block;width:100%;height:100%;object-fit:cover;opacity:0;
  transition:opacity .45s ease,transform .5s var(--e,ease)}
.gal__item.is-in img{opacity:1}
@media(hover:hover){.gal__item:hover img{transform:scale(1.04)}}
/* until the photo lands: its own colours, blurred, or a soft shine */
.gal__tiny{position:absolute;inset:-12%;width:124%;height:124%;filter:blur(14px) saturate(1.1);transform:scale(1.02)}
.gal__item:not(.has-tiny):not(.is-in){background:linear-gradient(100deg,#E6EBE2 40%,#F1F4EE 50%,#E6EBE2 60%) 0 0/200% 100%;
  animation:galshine 1.4s linear infinite}
.gal__more{grid-column:1/-1;height:1px}
.gal__item:focus-visible{outline:3px solid var(--leaf,#3E9E58);outline-offset:3px}

.gal__load{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
@media(min-width:640px){.gal__load{grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}}
.gal__load i{display:block;aspect-ratio:1;border-radius:18px;background:linear-gradient(100deg,#E6EBE2 40%,#F1F4EE 50%,#E6EBE2 60%) 0 0/200% 100%;
  animation:galshine 1.4s linear infinite}
@keyframes galshine{to{background-position:-200% 0}}

/* one photo */
.glb{position:fixed;inset:0;z-index:1000;display:none;background:rgba(2,18,5,.95);color:#fff;
  padding:max(12px,env(safe-area-inset-top)) 12px max(12px,env(safe-area-inset-bottom))}
.glb.on{display:flex;flex-direction:column}
html.glb-open{overflow:hidden}
.glb__top{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:48px}
.glb__meta{margin:0;font-size:14px;font-weight:600;color:rgba(255,255,255,.75)}
.glb__acts{display:flex;gap:8px}
.glb__btn{display:inline-flex;align-items:center;gap:8px;min-height:44px;min-width:44px;justify-content:center;padding:0 12px;
  border:0;border-radius:999px;background:rgba(255,255,255,.12);color:#fff;font:inherit;font-weight:700;font-size:14px;cursor:pointer}
.glb__btn .icon{width:18px;height:18px}
.glb__btn:hover{background:rgba(255,255,255,.2)}
.glb__rm{background:rgba(220,70,50,.22)}
.glb__rm:hover{background:rgba(220,70,50,.36)}
.glb__fig{flex:1;display:flex;align-items:center;justify-content:center;margin:8px 0;min-height:0}
.glb__fig img{max-width:100%;max-height:100%;object-fit:contain;border-radius:14px;user-select:none}
.glb__err{margin:0 0 8px;text-align:center;font-weight:600;color:#FFB4A6}
.glb__nav{position:absolute;top:50%;transform:translateY(-50%);width:48px;height:48px;border:0;border-radius:50%;
  display:grid;place-items:center;background:rgba(255,255,255,.14);color:#fff;cursor:pointer}
.glb__nav .icon{width:22px;height:22px}
.glb__nav:hover{background:rgba(255,255,255,.24)}
.glb__prev{left:12px}
.glb__next{right:12px}
@media(max-width:640px){.glb__nav{display:none}}
.glb .icon{fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
@media(prefers-reduced-motion:reduce){.gal__item img{transition:none}.gal__load i,.gal__item:not(.is-in){animation:none}}
.glb [hidden]{display:none!important}

/* ---------- photos on their way up ----------
   Each one sits at the front of the grid as its own preview, dimmed, with a
   ring that fills as it goes; a bar under the button shows the whole batch. */
.gal__spin{width:18px;height:18px;flex:none;border-radius:50%;border:2.5px solid rgba(255,255,255,.35);border-top-color:#fff;animation:galspin .8s linear infinite}
@keyframes galspin{to{transform:rotate(360deg)}}
.gal__add.is-busy{opacity:1}
.gal__up-bar{margin:-6px 0 16px}
.gal__up-track{height:8px;border-radius:999px;background:#E6EBE2;overflow:hidden}
.gal__up-track i{position:relative;display:block;height:100%;width:0;border-radius:inherit;overflow:hidden;
  background:linear-gradient(90deg,#3E9E58,#FFD84D);transition:width .35s cubic-bezier(.2,.8,.2,1)}
.gal__up-track i::after{content:"";position:absolute;inset:0;background:linear-gradient(100deg,transparent 30%,rgba(255,255,255,.55) 50%,transparent 70%) 0 0/200% 100%;
  animation:galshine 1.2s linear infinite}
.gal__up-note{margin:8px 0 0;font-size:13.5px;font-weight:600;color:var(--ink-2,#4A5E4F)}

.gal__up{position:relative;aspect-ratio:1;border-radius:18px;overflow:hidden;background:#E6EBE2;animation:galin .45s cubic-bezier(.2,.8,.2,1) both}
.gal__up:nth-child(2){animation-delay:.05s}.gal__up:nth-child(3){animation-delay:.1s}.gal__up:nth-child(4){animation-delay:.15s}
@keyframes galin{from{opacity:0;transform:scale(.92)}to{opacity:1;transform:none}}
.gal__up-pic{position:absolute;inset:0}
.gal__up-pic img{width:100%;height:100%;object-fit:cover;filter:blur(2px) saturate(.8);transform:scale(1.06);transition:filter .6s ease,transform .6s ease}
/* a band of light passing over while it works */
.gal__up-pic::after{content:"";position:absolute;inset:0;background:linear-gradient(100deg,transparent 35%,rgba(255,255,255,.35) 50%,transparent 65%) 0 0/250% 100%;
  animation:galshine 1.6s linear infinite}
.gal__up-veil{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;
  background:rgba(3,42,9,.48);color:#fff;transition:background .5s ease}
.gal__ring{position:relative;display:grid;place-items:center;width:58px;height:58px}
.gal__ring svg:first-child{position:absolute;inset:0;width:100%;height:100%;transform:rotate(-90deg)}
.gal__ring-bg{fill:rgba(3,42,9,.35);stroke:rgba(255,255,255,.25);stroke-width:4}
.gal__ring-fg{fill:none;stroke:#FFD84D;stroke-width:4;stroke-linecap:round;transition:stroke-dashoffset .3s linear,stroke .3s ease}
.gal__ring-pct{position:relative;font-size:13px;font-weight:800;font-variant-numeric:tabular-nums}
.gal__ring-ok,.gal__ring-bad{position:absolute;width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;opacity:0;transform:scale(.4);
  transition:opacity .25s ease,transform .35s cubic-bezier(.3,1.6,.5,1)}
.gal__up-lbl{font-size:13px;font-weight:700;text-shadow:0 1px 6px rgba(0,0,0,.35)}
/* waiting its turn: the ring rests, no light passing */
.gal__up.is-wait .gal__ring-fg{stroke-dasharray:22 200 !important;animation:galspin 1.4s linear infinite;transform-origin:26px 26px}
.gal__up.is-wait .gal__ring-pct{opacity:0}
.gal__up.is-wait .gal__up-pic::after{animation:none}
/* in: the picture clears and a tick pops in */
.gal__up.is-done .gal__up-veil{background:rgba(3,42,9,.18)}
.gal__up.is-done .gal__up-pic img{filter:none;transform:none}
.gal__up.is-done .gal__up-pic::after{animation:none;opacity:0}
.gal__up.is-done .gal__ring-fg{stroke:#7FD18F}
.gal__up.is-done .gal__ring-pct{opacity:0}
.gal__up.is-done .gal__ring-ok{opacity:1;transform:none}
/* did not go */
.gal__up.is-bad .gal__up-veil{background:rgba(120,30,20,.55)}
.gal__up.is-bad .gal__up-pic::after{animation:none}
.gal__up.is-bad .gal__ring-fg{stroke:#FFB4A6}
.gal__up.is-bad .gal__ring-pct{opacity:0}
.gal__up.is-bad .gal__ring-bad{opacity:1;transform:none}
@media(prefers-reduced-motion:reduce){
  .gal__spin,.gal__up,.gal__up-pic::after,.gal__up-track i::after,.gal__up.is-wait .gal__ring-fg{animation:none}
}
