/* Shutterbench Gallery — client-facing template.
   Neutral canvas; --accent is the photographer's brand color (set by gallery.js). */
:root {
  --accent: #b48c5a;
  --bg: #ffffff;
  --ink: #1c1a17;
  --ink-soft: #6b665e;
  --line: rgba(28, 26, 23, 0.12);
  --row-h: 240px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
button, input { font: inherit; }

/* ---- lock screen ---- */
#lock {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
#lock-form {
  width: min(360px, 100%);
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 2.5rem 2rem;
}
#lock-form h1 { margin: 0 0 0.25rem; font-size: 1.5rem; font-weight: 600; }
#lock-form p { color: var(--ink-soft); margin: 0.25rem 0 1.25rem; }
#lock-pw {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 0.75rem;
}
.remember { display: block; color: var(--ink-soft); font-size: 0.875rem; margin-bottom: 1rem; }
#lock-form button[type='submit'] {
  width: 100%;
  padding: 0.65rem;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
#lock-msg { color: #c0392b; min-height: 1.5em; margin: 0.75rem 0 0; }
#lock-form.shake { animation: shake 0.3s; }
@keyframes shake {
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ---- header ---- */
#hdr { text-align: center; padding: 3.5rem 1.5rem 2rem; }
#hdr-logo { max-height: 56px; max-width: 200px; margin-bottom: 1rem; }
#hdr h1 { margin: 0; font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 600; letter-spacing: 0.01em; }
#hdr-count { color: var(--ink-soft); margin: 0.35rem 0 1.25rem; font-size: 0.9rem; letter-spacing: 0.08em; text-transform: uppercase; }
#hdr-actions { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }
#hdr-actions button {
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  cursor: pointer;
}
#hdr-actions button:hover { border-color: var(--accent); color: var(--accent); }
#zip-status { color: var(--ink-soft); font-size: 0.875rem; }

/* ---- justified grid (flex-grow = aspect ratio, no JS layout) ---- */
#grid { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 4px 4px; }
#grid .ph {
  position: relative;
  margin: 0;
  flex-grow: calc(var(--ar) * 100);
  flex-basis: calc(var(--row-h) * var(--ar));
  aspect-ratio: var(--ar);
  max-height: calc(var(--row-h) * 1.8);
  overflow: hidden;
  cursor: zoom-in;
  background: #f1efec;
}
#grid .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
#grid::after { content: ''; flex-grow: 1e4; } /* stop last row stretching */
.fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 0;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  border-radius: 999px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0;
  transition: opacity 0.15s;
}
.ph:hover .fav-btn, .fav-btn.on { opacity: 1; }
.fav-btn.on { background: var(--accent); }
@media (hover: none) { .fav-btn { opacity: 1; } }
@media (max-width: 600px) { :root { --row-h: 140px; } }

/* ---- favorites bar ---- */
#favbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0.7rem 1rem;
  background: var(--ink);
  color: #fff;
  font-size: 0.9rem;
}
#favbar button, #favbar a {
  color: #fff;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  cursor: pointer;
  text-decoration: none;
}
#favbar button:hover, #favbar a:hover { border-color: var(--accent); color: var(--accent); }
body.has-favbar { padding-bottom: 64px; }

/* ---- lightbox ---- */
#lb {
  border: 0;
  padding: 0;
  background: transparent;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
}
#lb::backdrop { background: rgba(10, 9, 8, 0.96); }
#lb-img {
  position: absolute;
  inset: 0;
  margin: auto;
  max-width: 100vw;
  max-height: calc(100dvh - 64px);
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}
#lb button {
  position: absolute;
  z-index: 2;
  background: none;
  border: 0;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
}
#lb-close { top: 10px; right: 14px; font-size: 2rem; }
#lb-prev, #lb-next { top: 50%; transform: translateY(-50%); font-size: 3rem; padding: 1rem; }
#lb-prev { left: 6px; }
#lb-next { right: 6px; }
#lb-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  padding: 0.9rem;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
}
#lb-bar button, #lb-bar a { position: static; color: inherit; text-decoration: none; border: 1px solid rgba(255,255,255,0.3); border-radius: 999px; padding: 0.25rem 0.8rem; }
#lb-bar .on { color: var(--accent); border-color: var(--accent); }

/* ---- footer ---- */
#foot { text-align: center; padding: 3rem 1rem 2.5rem; color: var(--ink-soft); font-size: 0.9rem; }
#foot a { color: inherit; }
#foot-contact { color: var(--accent) !important; text-decoration: none; margin-right: 1.5rem; }
#foot-trial { opacity: 0.7; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
