/* Gallery page (photos.html and every photo share page /p/NNN.html) */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Space Mono', monospace;
  background: #130f0b;
  color: #888;
  font-size: 14px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  padding: 64px 48px 96px;
}

/* STICKY HEADER — nav + sub-nav + filters freeze at top while scrolling */
.sticky-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #130f0b;
  margin: -64px -48px 0;   /* bleed to body edges */
  padding: 48px 48px 20px;
}

/* NAV */
.nav { margin-bottom: 16px; font-size: 13px; }
.nav a { color: #666; text-decoration: none; }
.nav a:hover, .nav a.active { color: #aaa; }
.nav-sep { margin: 0 10px; color: #3a3a3a; }

/* SUB-NAV */
.sub-nav {
  text-align: center;
  font-size: 12px;
  margin-bottom: 20px;
  color: #3a3a3a;
}
.sub-nav a { color: #555; text-decoration: none; transition: color 0.15s ease; }
.sub-nav a:hover, .sub-nav a.active { color: #999; }
.sub-nav .sub-sep { margin: 0 10px; color: #2e2e2e; }

/* FILTER BAR — right-aligned selects */
.filter-bar {
  display: flex;
  flex-wrap: wrap;          /* never push past the viewport on narrow screens */
  justify-content: flex-end;
  gap: 16px;
  margin-bottom: 0;
  max-width: 100%;
}

.filter-select {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  color: #777;
  background: #130f0b;
  border: none;
  border-bottom: 1px solid #2a2a2a;
  padding: 2px 18px 2px 0;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='4' viewBox='0 0 7 4'%3E%3Cpath d='M0 0l3.5 4L7 0z' fill='%23444'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 2px center;
  background-size: 7px 4px;
  transition: border-color 0.15s ease, color 0.15s ease;
  min-width: 0;             /* allow shrinking inside the flex row */
  max-width: 100%;
  text-overflow: ellipsis;
}

.filter-select:hover  { color: #aaa; border-bottom-color: #555; }
.filter-select:focus  { color: #aaa; border-bottom-color: #555; }
.filter-select option { background: #1a1512; color: #888; }
.filter-select.hidden { display: none; }

/* MASONRY GRID */
.photo-grid { position: relative; }

.photo-item {
  position: absolute;
  top: 0; left: 0;
  overflow: hidden;
  cursor: pointer;
  contain: layout paint;
}

/* Each box is sized from the photo's known aspect ratio before the image
   arrives, so nothing moves as images load. The box colour is the photo's
   average colour, shown until the image fades in. */
.photo-item img {
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.4s ease;
}
.photo-item img.loaded { opacity: 1; }

.photo-item:hover img { transform: scale(1.05); }

/* EMPTY STATE */
.empty { color: #555; font-size: 13px; margin-top: 48px; }

@media (max-width: 800px) {
  body { padding: 48px 24px 80px; }
  /* The header bleeds to the body edges via negative margins — those have to
     match the mobile body padding (24px), or the header hangs 24px past each
     side and the whole page gets a horizontal scroll. */
  .sticky-header { margin: -48px -24px 0; padding: 48px 24px 20px; }
  .filter-bar {
    justify-content: flex-start;
    column-gap: 14px;
    row-gap: 10px;
  }
  /* Long city names ("great sand dunes national park") were widening the
     row past the viewport and giving the whole page a horizontal scroll. */
  .filter-select { max-width: 46vw; }
}
