/* =================================================================
   More work gallery (work.html). Uses the tokens from styles.css.
   ================================================================= */
.gallery-page { background: var(--bg); }
.gallery__navlinks { display: flex; align-items: center; gap: 24px; }
.gallery__back { color: var(--bone); }

/* One screen on large displays: header, title row, collage filling the rest */
.gallery {
  display: flex; flex-direction: column;
  padding: calc(var(--nav-h) + clamp(16px, 3vh, 32px)) 0 clamp(16px, 3vh, 28px);
}
.gallery__head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 32px; flex-wrap: wrap;
}
.gallery__title {
  font: 300 clamp(34px, min(4vw, 6.6vh), 64px)/1.05 var(--font-display); letter-spacing: var(--track-tight);
  margin-top: 8px;
}
.gallery__tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.gallery__stage { margin-top: clamp(14px, 2.6vh, 28px); width: 100%; }

@media (min-width: 900px) and (min-height: 560px) {
  .gallery { height: 100vh; height: 100svh; }
  .gallery__stage { flex: 1 1 auto; min-height: 0; }
}

/* ---------- Collage ---------- */
.collage { display: flex; flex-direction: column; gap: var(--gap, 10px); }
.collage__row { display: flex; gap: var(--gap, 10px); min-height: 0; }
.tile {
  position: relative; display: block; min-width: 0; height: 100%; padding: 0;
  overflow: hidden; border-radius: 10px; background: var(--bg-2); cursor: zoom-in;
  opacity: 1; transform: none;
  transition: opacity 360ms var(--ease-out) var(--d, 0ms), transform 360ms var(--ease-out) var(--d, 0ms);
}
.tile img, .tile video {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 500ms var(--ease-out), filter 300ms var(--ease-out);
}
.tile:focus-visible { outline: 2px solid var(--bone); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) {
  .tile:hover img, .tile:hover video { transform: scale(1.03); }
}
.tile:active { transform: scale(0.985); transition-duration: 120ms; transition-delay: 0ms; }

/* Video tile: small play mark so it reads as a video */
.tile__play {
  position: absolute; left: 12px; bottom: 12px; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(14, 13, 11, 0.6); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  pointer-events: none;
}
.tile__play::after {
  content: ""; position: absolute; left: 13px; top: 10px;
  border-style: solid; border-width: 7px 0 7px 11px; border-color: transparent transparent transparent var(--bone);
}

/* Category change: tiles step in, a few ms apart */
.collage.is-leaving .tile { opacity: 0; transition-duration: 140ms; transition-delay: 0ms; }
.collage.is-entering .tile { opacity: 0; transform: translateY(10px); transition: none; }

/* ---------- Lightbox ---------- */
.lightbox {
  width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: rgba(8, 7, 6, 0.96); color: var(--bone);
}
.lightbox[open] { animation: lb-in 200ms var(--ease-out); }
@keyframes lb-in { from { opacity: 0; } }
.lightbox::backdrop { background: transparent; }
.lightbox__media {
  position: absolute; inset: 64px 72px 56px; display: flex; align-items: center; justify-content: center;
  touch-action: pan-y;
}
.lightbox__item {
  display: block; max-width: 100%; max-height: 100%; min-width: 0; min-height: 0;
  width: auto; height: auto; object-fit: contain;
  border-radius: 8px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.lightbox[open] .lightbox__item { animation: lb-item 260ms var(--ease-out); }
.lightbox__media.is-swap .lightbox__item { animation: lb-item 220ms var(--ease-out); }
@keyframes lb-item { from { opacity: 0; transform: scale(0.97); } }
.lightbox__count {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  font: 500 11px/1 var(--font-display); letter-spacing: var(--track-label); color: rgba(242, 239, 234, 0.7);
}
.lightbox__btn {
  position: absolute; width: 48px; height: 48px; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--hairline-strong); color: var(--bone);
  background: rgba(14, 13, 11, 0.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: background-color 160ms var(--ease-out), transform 120ms var(--ease-out);
}
.lightbox__btn:active { transform: scale(0.94); }
@media (hover: hover) { .lightbox__btn:hover { background: rgba(242, 239, 234, 0.12); } }
.lightbox__btn:focus-visible { outline: 2px solid var(--bone); outline-offset: 3px; }
.lightbox__btn svg { width: 16px; height: 16px; }
.lightbox__close { top: 12px; right: 12px; font-size: 28px; line-height: 1; }
.lightbox__prev { left: 12px; top: 50%; margin-top: -24px; }
.lightbox__next { right: 12px; top: 50%; margin-top: -24px; }
html.lb-open { overflow: hidden; }

/* ---------- Phones and tablets: collage scrolls, controls move to the bottom ---------- */
@media (max-width: 899px), (max-height: 559px) {
  .gallery { padding-bottom: 40px; }
  .gallery__head { align-items: flex-start; flex-direction: column; }
  .gallery__tabs { flex-wrap: nowrap; gap: 6px; }
  .gallery__tab { padding: 0 12px; height: 40px; font-size: 10px; white-space: nowrap; }
  .tile { border-radius: 8px; }
  .lightbox__media { inset: 56px 8px 84px; }
  .lightbox__prev, .lightbox__next { top: auto; bottom: 16px; margin-top: 0; }
  .lightbox__prev { left: calc(50% - 64px); }
  .lightbox__next { right: calc(50% - 64px); }
  .lightbox__count { top: 30px; bottom: auto; left: 20px; transform: none; }
}
@media (max-width: 560px) {
  .gallery__cta { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .tile, .tile img, .tile video { transition: none; }
  .lightbox[open], .lightbox[open] .lightbox__item, .lightbox__media.is-swap .lightbox__item { animation: none; }
}
