/* Photo Gallery — a private exhibition. Photos presented as matted prints
   on a darkroom wall, with brass hardware and museum-style plaques. */

:root {
  color-scheme: dark;
  --bg: #0f0e0c;
  --bg-raised: #151310;
  --surface: #1a1815;
  --line: #2a2722;
  --ink: #ede6da;
  --ink-dim: #9b9385;
  --ink-faint: #6f6a5f;
  --brass: #c9a86a;
  --brass-bright: #e0c58a;
  --shadow: rgba(0, 0, 0, 0.55);
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Schibsted Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background:
    radial-gradient(1100px 700px at 50% -8%, rgba(201, 168, 106, 0.06), transparent 60%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

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

.skip-link {
  position: fixed;
  top: -80px;
  left: 16px;
  z-index: 2000;
  padding: 10px 18px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  font-size: 14px;
  border-radius: 999px;
  text-decoration: none;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 16px; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brass);
}

/* Login */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-form {
  width: 100%;
  max-width: 420px;
  padding: 48px 44px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 30px 80px var(--shadow);
}

.login-form h1 {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 10px 0 12px;
  text-wrap: balance;
}

.subtitle {
  color: var(--ink-dim);
  font-size: 15px;
  margin-bottom: 30px;
  text-wrap: pretty;
}

.login-form .error {
  color: #e8a59b;
  font-size: 14px;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: rgba(232, 165, 155, 0.08);
  border: 1px solid rgba(232, 165, 155, 0.25);
  border-radius: 10px;
}

.field-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 8px;
}

.login-form input[type="password"] {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  margin-bottom: 20px;
  transition: border-color 0.2s ease;
}
.login-form input[type="password"]:focus { border-color: var(--brass); }
.login-form input[type="password"]::placeholder { color: var(--ink-faint); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  background: none;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--brass-bright); color: var(--bg); }
.btn-primary:disabled { opacity: 0.55; cursor: default; }

.btn-ghost { border-color: var(--line); color: var(--ink-dim); }
.btn-ghost:hover { border-color: var(--brass); color: var(--brass-bright); }

.btn-block { width: 100%; padding: 14px; font-size: 15px; font-weight: 600; }

/* Gallery */
.gallery-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 28px 80px;
}

.gallery-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding-bottom: 24px;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--line);
}

.brand h1 {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-top: 6px;
  text-wrap: balance;
}
.brand h1::after {
  content: "";
  display: block;
  width: 56px;
  height: 3px;
  margin-top: 14px;
  border-radius: 2px;
  background: var(--brass);
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.gallery-count {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.header-actions {
  display: flex;
  gap: 10px;
}

/* Photo grid — masonry of matted prints (tiles positioned by app.js) */
.photo-grid {
  position: relative;
}

.photo-grid.masonry .photo-item {
  position: absolute;
  top: 0;
  left: 0;
}

.photo-item {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-body);
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.photo-mat {
  position: relative;
  display: block;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  transition: border-color 0.25s ease;
}

.photo-thumb {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
}

.photo-glow {
  position: absolute;
  inset: 8px;
  border-radius: 2px;
  background: radial-gradient(120% 120% at 50% 30%, rgba(224, 197, 138, 0), rgba(224, 197, 138, 0.16) 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.photo-item:hover .photo-mat,
.photo-item:focus-visible .photo-mat {
  border-color: var(--brass);
}

.photo-item:hover .photo-glow,
.photo-item:focus-visible .photo-glow {
  opacity: 1;
}

.photo-item:hover .plaque-index,
.photo-item:focus-visible .plaque-index {
  color: var(--brass-bright);
}

.photo-plaque {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  margin-top: 10px;
  padding: 0 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
}

.plaque-index {
  color: var(--brass);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.plaque-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 90px 20px;
}
.empty-state p:first-child {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
}
.empty-hint {
  margin-top: 14px;
  color: var(--ink-dim);
  font-size: 15px;
  text-wrap: pretty;
}
.empty-state code {
  font-family: var(--font-mono);
  color: var(--brass);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: 6px;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(10, 9, 8, 0.94);
  backdrop-filter: blur(6px);
  overscroll-behavior: contain;
  cursor: zoom-out;
}

.lightbox.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  animation: lightbox-in 0.25s ease;
}

@keyframes lightbox-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-img {
  max-width: min(90vw, 1200px);
  max-height: 82vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: img-in 0.3s ease;
}

@keyframes img-in {
  from { opacity: 0; transform: scale(0.985); }
  to { opacity: 1; transform: scale(1); }
}

.lightbox-btn {
  position: absolute;
  z-index: 2;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(237, 230, 218, 0.16);
  border-radius: 50%;
  background: rgba(21, 19, 16, 0.6);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.lightbox-btn:hover {
  background: rgba(21, 19, 16, 0.9);
  border-color: var(--brass);
  color: var(--brass-bright);
}

.lightbox-close { top: 22px; right: 22px; font-size: 30px; }
.lightbox-prev { left: 22px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 22px; top: 50%; transform: translateY(-50%); }

.lightbox-caption {
  margin-top: 20px;
  max-width: 90vw;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Responsive */
@media (max-width: 860px) {
  .gallery-wrap { padding: 26px 16px 60px; }
  .gallery-header { flex-direction: column; align-items: flex-start; gap: 20px; }
  .brand h1 { font-size: 32px; }
  .header-meta { width: 100%; justify-content: space-between; }
  .photo-mat { padding: 6px; }
  .photo-glow { inset: 6px; }
  .login-form { padding: 36px 26px; }
  .lightbox-close { top: 14px; right: 14px; }
  .lightbox-prev { left: 12px; }
  .lightbox-next { right: 12px; }
}

/* Accessibility: disable motion for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
