:root {
  color-scheme: light;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  background: #f7f6f2;
  color: #1d1c19;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: #f7f6f2;
}

body.viewer-open {
  overflow: hidden;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.site-header {
  display: flex;
  align-items: center;
  min-height: 6.25rem;
  padding: 2rem clamp(1rem, 2.5vw, 3rem) 1.25rem;
}

.site-header a {
  color: #1d1c19;
  font-size: clamp(0.95rem, 1.8vw, 1.2rem);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.22em;
  text-decoration: none;
  text-transform: uppercase;
}

.gallery {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  overflow: hidden;
}

.gallery-row {
  display: flex;
  gap: 2px;
  width: 100%;
  overflow: hidden;
}

.photo {
  position: relative;
  display: block;
  min-width: 0;
  height: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #e9e7e1;
  cursor: zoom-in;
}

.photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 180ms ease;
}

.photo img:not(.loaded) {
  opacity: 0;
}

.photo:focus-visible {
  z-index: 1;
  outline: 2px solid #1d1c19;
  outline-offset: -3px;
}

.status {
  margin: 2rem 1rem;
  color: #69655e;
  font-size: 0.9rem;
  text-align: center;
}

.status[hidden] {
  display: none;
}

.viewer[hidden] {
  display: none;
}

.viewer {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  grid-template-columns: clamp(2.75rem, 7vw, 5rem) minmax(0, 1fr) clamp(2.75rem, 7vw, 5rem);
  align-items: center;
  background: rgba(247, 246, 242, 0.97);
  touch-action: pan-y;
}

.viewer figure {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  width: 100%;
  height: 100dvh;
  margin: 0;
  padding: clamp(3.5rem, 7vh, 5rem) 0 1rem;
}

.viewer figure img {
  align-self: center;
  justify-self: center;
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 7rem);
  object-fit: contain;
}

.viewer figcaption {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 2rem;
  gap: 1.25rem;
  color: #69655e;
  font-size: 0.78rem;
}

.viewer figcaption a {
  color: #1d1c19;
  text-underline-offset: 0.2em;
}

.viewer button {
  border: 0;
  color: #1d1c19;
  background: transparent;
  cursor: pointer;
}

.viewer-close {
  position: absolute;
  z-index: 2;
  top: max(0.75rem, env(safe-area-inset-top));
  right: max(0.75rem, env(safe-area-inset-right));
  width: 3rem;
  height: 3rem;
  font-size: 2rem;
  font-weight: 200;
  line-height: 1;
}

.viewer-previous,
.viewer-next {
  align-self: stretch;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 200;
}

.viewer button:focus-visible,
.viewer figcaption a:focus-visible {
  outline: 2px solid #1d1c19;
  outline-offset: 2px;
}

@media (max-width: 767px) {
  .site-header {
    min-height: 4.65rem;
    padding: 1.25rem 0.75rem 0.85rem;
  }

  .gallery,
  .gallery-row {
    gap: 1px;
  }

  .viewer {
    grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem;
  }

  .viewer figure {
    padding-top: calc(3.5rem + env(safe-area-inset-top));
    padding-bottom: max(0.65rem, env(safe-area-inset-bottom));
  }

  .viewer figcaption {
    flex-direction: column;
    gap: 0.3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .photo img {
    transition: none;
  }
}
