/* Public gallery — phone first, scales up to tablets, laptops and a big screen. */

.sprite { position: absolute; }
.btn.icon { padding: 0; width: 48px; min-height: 48px; }

.page {
  width: min(100%, 90rem);
  margin-inline: auto;
  padding: max(1.25rem, env(safe-area-inset-top)) clamp(1.25rem, 3vw, 2.5rem) max(3rem, env(safe-area-inset-bottom));
}

/* ---------- header ---------- */
.head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 1rem 2rem;
  margin: .4rem 0 2rem;
}
.head h1 {
  margin: 0 0 .4rem;
  font-size: clamp(2.3rem, 9vw, 4rem);
  font-weight: 800; font-stretch: 78%;
  line-height: .95; letter-spacing: -.01em;
  overflow-wrap: anywhere;
}
.sub { margin: 0; color: var(--muted); }
.share { flex: none; }

/* ---------- wall of prints ---------- */
.wall {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem 1rem;
  align-items: start;
}
@media (min-width: 640px) {
  .wall { grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 2.25rem 1.75rem; }
}
.tile {
  --pad: 7%;
  display: block; width: 100%;
  border: 0; text-align: left; cursor: zoom-in;
  rotate: var(--tilt, 0deg);
  transition: rotate .25s ease, translate .25s ease;
}
.tile:hover, .tile:focus-visible { rotate: 0deg; translate: 0 -3px; }
.tile .figcaption { font-size: 1.2rem; min-height: 2.3rem; padding-block: .35em .6em; }
@media (min-width: 640px) { .tile .figcaption { font-size: 1.35rem; } }
.tile .cap { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wall li.fresh .tile { animation: land .7s cubic-bezier(.3, 1.3, .5, 1) both; }
@keyframes land { from { translate: 0 -24px; opacity: 0; } }

.loading { color: var(--muted); }
.empty { max-width: 30rem; margin: 10vh auto 0; text-align: center; }
.empty h2 { margin: 0 0 .5rem; font-size: 1.8rem; font-weight: 800; font-stretch: 80%; line-height: 1.1; }
.empty p { margin: 0; color: var(--muted); }

/* ---------- lightbox ---------- */
.lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: var(--night); color: var(--text);
  overflow: hidden;
}
.lightbox::backdrop { background: var(--night); }
.lightbox[open] { display: grid; grid-template-rows: auto 1fr auto; }

.lb-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: max(.75rem, env(safe-area-inset-top)) 1rem .5rem;
}
.lb-pos { margin: 0; color: var(--muted); font-variant-numeric: tabular-nums; }

.lb-stage {
  display: grid; place-items: center;
  min-height: 0;
  padding: .5rem 1rem;
  touch-action: pan-y;
}
.lb-print {
  --pad: .8rem;
  max-width: 100%;
  rotate: -.6deg;
  transition: opacity .2s ease, translate .2s ease;
}
.lb-print.leaving { opacity: 0; }
.lb-print.leaving.to-left { translate: -24px 0; }
.lb-print.leaving.to-right { translate: 24px 0; }
.lb-print .shot { aspect-ratio: auto; background: transparent; }
.lb-print .shot img {
  width: auto; height: auto;
  max-width: calc(100vw - 3.6rem);
  max-height: calc(100dvh - 15rem);
  object-fit: contain;
}
.lb-print figcaption {
  max-width: 0; min-width: 100%;
  min-height: 0;
  padding: .5em .1em .65em;
  font-size: clamp(1.5rem, 5vw, 2.4rem);
}
.lb-print figcaption:has(.cap:empty):has(.by:empty) { min-height: 1.6rem; }

.lb-nav {
  display: flex; justify-content: center; gap: 1.5rem;
  padding: .5rem 1rem max(1rem, env(safe-area-inset-bottom));
}

@media (min-width: 900px) {
  .lb-stage { padding-inline: 6rem; }
  .lb-print { --pad: 1.1rem; }
  .lb-print .shot img { max-width: calc(100vw - 15rem); max-height: calc(100dvh - 13rem); }
  .lb-nav { position: absolute; inset: 50% 1.5rem auto; translate: 0 -50%; justify-content: space-between; padding: 0; pointer-events: none; }
  .lb-nav .btn { pointer-events: auto; width: 56px; min-height: 56px; }
  .lightbox[open] { grid-template-rows: auto 1fr; }
}
