/* The private gallery: the password page and the darkroom. Builds on
   tokens.css and name.css; js/gallery.js develops the prints, runs the
   viewer and the slideshow. */

.gallery .site-header { position: relative; }
.gallery .hero-name { font-size: clamp(4.25rem, 19vw, 15rem); }

/* ---------- the password page ---------- */

.login-main {
  min-height: calc(100svh - 80px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px var(--gutter) 96px;
}
.login-sub { margin-top: clamp(14px, 2vw, 24px); color: var(--muted); }
.login-form {
  display: flex;
  gap: 10px;
  margin-top: 28px;
  max-width: 28rem;
}
.login-form input {
  flex: 1;
  min-width: 0;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text);
  font: inherit;
}
.login-form input:focus { outline: none; border-color: var(--sage); box-shadow: 0 0 0 1px var(--sage); }
.login-form button {
  padding: 12px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--sage);
  color: var(--bg);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.login-form button:hover { background: var(--sage-hi); }
.login-error { margin-top: 14px; color: var(--error); }

/* ---------- the darkroom ---------- */

.gallery-hero {
  display: flex;
  align-items: flex-end;
  min-height: 62svh;
  padding: 40px var(--gutter) clamp(40px, 7vw, 72px);
}
.gallery-hero .hero-name { cursor: pointer; }
.gallery-hero.is-empty .hero-name { cursor: default; }
.gallery-count { margin-top: clamp(14px, 2vw, 24px); color: var(--muted); }

/* Keyboard users get a visible button when they tab to it (space works
   too); everyone else clicks the word. */
.launch-link {
  margin-top: 16px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.launch-link:focus-visible { position: static; opacity: 1; pointer-events: auto; display: block; }
.launch-link[hidden] { display: none; }

/* Columns that keep each photo's own shape. */
.prints {
  list-style: none;
  margin: 0;
  padding: 0 var(--gutter);
  columns: 3 280px;
  column-gap: clamp(10px, 1.6vw, 20px);
}
.print { break-inside: avoid; margin-bottom: clamp(10px, 1.6vw, 20px); }
.print-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #000;
  cursor: zoom-in;
  overflow: hidden;
  border-radius: 2px;
}
.print-open img {
  width: 100%;
  height: auto;
  aspect-ratio: var(--ratio, auto);
  /* undeveloped: black paper */
  filter: brightness(0);
  transition: transform 0.6s var(--ease);
}
.print-open:hover img { transform: scale(1.015); }
.print-open:focus-visible { outline: 2px solid var(--sage-hi); outline-offset: 3px; }

/* Developing: up out of the black under a red safelight, then into
   colour, the way a print comes up in the tray. */
.print.is-developing img { animation: develop 2.8s cubic-bezier(0.3, 0.05, 0.2, 1) forwards; }
.print.is-developed img { filter: none; }
@keyframes develop {
  0%   { filter: brightness(0) sepia(1) saturate(4) hue-rotate(-50deg); }
  30%  { filter: brightness(0.32) sepia(1) saturate(4) hue-rotate(-50deg) contrast(1.2); }
  62%  { filter: brightness(0.8) sepia(0.5) saturate(1.8) hue-rotate(-20deg) contrast(1.1); }
  100% { filter: none; }
}

.prints-empty {
  padding: 0 var(--gutter) 40px;
  color: var(--muted);
  max-width: 36rem;
}

/* ---------- the viewer ---------- */

html.viewer-open,
html.viewer-open body,
html.slideshow-on,
html.slideshow-on body { overflow: hidden; }
.viewer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 56px);
  background: rgba(2, 4, 3, 0.97);
}
.viewer[hidden] { display: none; }
.viewer-img {
  max-width: 100%;
  max-height: calc(100dvh - 120px);
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}
.viewer-img.is-in { opacity: 1; }
.viewer-count {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.viewer-btn,
.viewer-close {
  position: absolute;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: rgba(2, 4, 3, 0.6);
  color: var(--text);
  font: inherit;
  font-size: 1.25rem;
  cursor: pointer;
}
.viewer-btn:hover,
.viewer-close:hover { color: var(--sage-hi); border-color: var(--sage); }
.viewer-btn:focus-visible,
.viewer-close:focus-visible { outline: 2px solid var(--sage-hi); outline-offset: 3px; }
.viewer-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.viewer-next { right: 16px; top: 50%; transform: translateY(-50%); }
.viewer-close { top: 16px; right: 16px; }

/* ---------- space mode: the slideshow ---------- */

.slideshow {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #000;
  cursor: none;
  overflow: hidden;
}
.slideshow[hidden] { display: none; }
.slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 1.6s ease;
}
/* each develops in the same way as a print, then drifts very slowly */
.slide.is-in { opacity: 1; animation: develop 3s cubic-bezier(0.3, 0.05, 0.2, 1) both; }
.slide.is-drifting { animation: develop 3s cubic-bezier(0.3, 0.05, 0.2, 1) both, drift 9s linear both; }
@keyframes drift {
  from { transform: scale(1); }
  to { transform: scale(1.05); }
}
.slide-count,
.slide-hint {
  position: absolute;
  bottom: 18px;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  color: rgba(207, 203, 191, 0.5);
}
.slide-count { left: var(--gutter); }
.slide-hint { right: var(--gutter); }

@media (max-width: 560px) {
  .login-form { flex-direction: column; }
  .viewer-btn { top: auto; bottom: 12px; transform: none; }
  .viewer-count { bottom: 28px; }
}
