:root {
  color-scheme: dark;
  background: #050505;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #050505;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.tile {
  appearance: none;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #050505;
  cursor: zoom-in;
}

.tile:focus-visible {
  position: relative;
  z-index: 1;
  outline: 3px solid #fff;
  outline-offset: -3px;
}

.tile picture,
.tile img {
  display: block;
  width: 100%;
  height: 100%;
}

.tile img {
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

.tile.is-open {
  position: fixed;
  inset: 0;
  z-index: 10;
  cursor: zoom-out;
}

.tile.is-open picture,
.tile.is-open img {
  width: 100%;
  height: 100%;
}

.tile.is-open img {
  object-fit: contain;
  background: #050505;
}

@media (max-width: 720px) {
  .gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(4, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
