:root {
  --ink:    #191f27;
  --board:  #222a34;
  --edge:   #38424f;
  --paper:  #e9e6e0;
  --muted:  #8d97a5;
  --brass:  #c9a227;

  --gap: 6px;
  --pad: clamp(14px, 3vw, 28px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

/* --- the gate ---------------------------------------------------------- */
.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--pad);
}
.gate-inner { text-align: center; max-width: 34ch; }
.gate-note { color: var(--muted); margin: 0 0 1.6rem; }
.gate-error {
  margin-top: 1.4rem; color: #e0a3a3;
  font-size: 0.9rem; line-height: 1.4;
}

/* The wordmark is the one place with real typographic weight. */
.wordmark {
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-weight: 400;
  font-size: clamp(2.6rem, 9vw, 4.2rem);
  letter-spacing: 0.02em;
  margin: 0 0 0.4rem;
}
.wordmark-sm { font-size: 1.35rem; margin: 0; }

/* --- top bar ----------------------------------------------------------- */
.bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding: var(--pad) var(--pad) 0;
}
.bar-right { display: flex; gap: 0.5rem; align-items: center; }

/* --- month navigation: the album's organising unit ---------------------- */
.months {
  display: flex; align-items: baseline; justify-content: center;
  gap: 0.75rem;
  padding: clamp(1.5rem, 5vw, 3rem) var(--pad) clamp(1rem, 3vw, 1.75rem);
}
.month {
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-weight: 400;
  font-size: clamp(1.6rem, 6vw, 2.6rem);
  margin: 0;
  min-width: 9ch; text-align: center;
}
.month-step {
  background: none; border: 0; color: var(--muted);
  font-size: 1.8rem; line-height: 1; cursor: pointer;
  padding: 0.2rem 0.5rem; border-radius: 3px;
}
.month-step:hover { color: var(--brass); }

/* --- grid: contact-sheet density, photos edge to edge ------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(110px, 22vw, 190px), 1fr));
  gap: var(--gap);
  padding: 0 var(--pad) 3rem;
}
.cell {
  position: relative; aspect-ratio: 1;
  border: 0; padding: 0; margin: 0;
  background: var(--board); cursor: pointer; overflow: hidden;
}
.cell img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  opacity: 0; transition: opacity 160ms ease-out;
}
.cell img.ready { opacity: 1; }

.empty {
  color: var(--muted);
  text-align: center;
  padding: 3rem var(--pad);
  margin: 0;
}
.error { color: #e0a3a3; }

/* --- upload progress ---------------------------------------------------- */
.uploads {
  list-style: none; margin: 0 auto 1.5rem; padding: 0 var(--pad);
  max-width: 60ch; font-size: 0.9rem; color: var(--muted);
}
.uploads li {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.35rem 0; border-bottom: 1px solid var(--edge);
}
.uploads li.failed { color: #e0a3a3; }
.uploads li.done { color: var(--brass); }

/* --- buttons ------------------------------------------------------------ */
.btn {
  display: inline-block;
  font: inherit; font-size: 0.9rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--edge); border-radius: 3px;
  background: var(--board); color: var(--paper);
  cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--brass); }
.btn-primary {
  background: var(--brass); border-color: var(--brass); color: #1b1608;
  font-weight: 600; padding: 0.6rem 1.6rem;
}
.btn-quiet { background: none; }
.btn-wide { display: block; margin: 0 auto 4rem; }

/* --- viewer ------------------------------------------------------------- */
.viewer {
  border: 0; padding: 0; max-width: 100vw; max-height: 100dvh;
  background: var(--ink); color: var(--paper);
}
.viewer::backdrop { background: rgba(10, 13, 17, 0.94); }
.viewer img {
  display: block; max-width: 96vw; max-height: 84dvh;
  margin: 0 auto; object-fit: contain;
}
.viewer-bar {
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 0.75rem; padding: 0.9rem;
}
.viewer-meta { color: var(--muted); font-size: 0.85rem; }

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