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

body {
  margin: 0;
  overflow: hidden;
}

#gallery, .slides, .slide {
  position: fixed;
  inset: 0;
}

#gallery {
  touch-action: none;
  -webkit-touch-callout: none;
}

.slide {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  opacity: 0;
  transition: opacity 1.5s ease-in-out;
}

.slide.visible { opacity: 1; }

.frame {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.photo {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
  animation: drift 8s ease-in-out both;
}

@keyframes drift {
  from { transform: translate(var(--x0), var(--y0)) scale(var(--s0)); }
  to { transform: translate(var(--x1), var(--y1)) scale(var(--s1)); }
}

.navigation {
  position: absolute;
  inset-block: 0;
  width: 50%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.previous { left: 0; }
.next { right: 0; }

.navigation:focus-visible, .contact:focus-visible {
  outline: 1px solid white;
  outline-offset: -4px;
}

.contact {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  color: #eee;
  background: rgb(24 24 24 / 50%);
  opacity: .7;
  transition: opacity .2s;
}

.contact[href]:hover, .contact:focus-visible { opacity: 1; }
.contact svg { width: 21px; height: 21px; }

.categories {
  position: fixed;
  z-index: 1;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  color: #eee;
}

.category-toggle {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgb(24 24 24 / 60%);
  color: inherit;
  cursor: pointer;
}

.category-toggle svg { width: 21px; height: 21px; }

#category-list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: min(230px, calc(100vw - 32px));
  max-height: calc(100vh - 128px);
  max-height: max(0px, calc(100dvh - 128px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
  overflow: auto;
  overscroll-behavior: contain;
  padding: 5px;
  border: 1px solid rgb(255 255 255 / 13%);
  border-radius: 10px;
  background: rgb(24 24 24 / 90%);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgb(0 0 0 / 22%);
}

#category-list button {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: 400 .9rem/1.35 system-ui, sans-serif;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}

#category-list button[aria-current="true"],
#category-list button:hover,
.category-toggle:hover { background: rgb(70 70 70 / 65%); }

.categories button:focus-visible {
  outline: 1px solid #eee;
  outline-offset: -2px;
}

@media (prefers-reduced-motion: reduce) {
  .photo { animation: none; }
  .slide, .contact { transition: none; }
}
