/* KiFF gallery. Loaded only on gallery.html, after style.css. */

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin: 0;
  padding: 0 0 2.5rem;
  list-style: none;
}
.tile {
  display: block;
  width: 100%;
  padding: 0;
  background: #000;
  border: 1px solid var(--line);
  cursor: pointer;
  line-height: 0;
}
.tile img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.tile:hover, .tile:focus-visible { border-color: var(--gold); }
.tile:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

@media (min-width: 760px) {
  .grid { grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
}

.viewer {
  width: 100vw; max-width: 100vw;
  height: 100dvh; max-height: 100dvh;
  margin: 0; padding: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.96);
  color: var(--white);
}
.viewer::backdrop { background: #000; }
.viewer[open] { display: grid; place-items: center; }
.viewer img {
  max-width: 100vw;
  max-height: 100dvh;
  width: auto; height: auto;
  object-fit: contain;
}
.v-btn {
  position: absolute;
  width: 3rem; height: 3rem;
  display: grid; place-items: center;
  padding: 0;
  font: inherit; font-size: 1.8rem; line-height: 1;
  color: var(--white);
  background: rgba(10, 10, 10, 0.7);
  border: 1px solid var(--line);
  cursor: pointer;
}
.v-btn:hover, .v-btn:focus-visible { border-color: var(--gold); color: var(--gold); }
.v-prev { left: 0.5rem; top: 50%; transform: translateY(-50%); }
.v-next { right: 0.5rem; top: 50%; transform: translateY(-50%); }
.v-close { right: 0.5rem; top: calc(0.5rem + env(safe-area-inset-top, 0px)); }
.v-count {
  position: absolute;
  left: 0.75rem; bottom: calc(0.6rem + env(safe-area-inset-bottom, 0px));
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem; color: var(--dim);
  background: rgba(10, 10, 10, 0.7);
}
