/* Theme tokens — overridable per-project at runtime via CSS custom props
   set in app.js after fetching /api/projects/by-id/<projectId>. */
:root {
  color-scheme: dark;
  --bg: #121212;
  --surface: #181818;
  --surface-hover: #1E1E1E;
  --border: #282828;
  --primary: #00FFCC;
  --primary-dim: #00CC99;
  --primary-glow: rgba(0, 255, 204, 0.3);
  --text: #FFFFFF;
  --text-secondary: #8888AA;
  --text-muted: #555577;
  --danger: #FF4466;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-glow: 0 0 20px var(--primary-glow);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --tile-aspect: 10/15;
  --logo-max: 240px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-brand: var(--font-sans);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100vh; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  padding: 0 16px 24px;
}
::selection { background: var(--primary); color: var(--bg); }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 0;
  margin-bottom: 16px;
}
.brand { display: flex; align-items: center; gap: 16px; }
.logo { max-height: 56px; max-width: var(--logo-max); height: auto; }
.title {
  font-family: var(--font-brand);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 18px;
  margin: 0;
}

.btn {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font: inherit;
  cursor: pointer;
  transition: background 0.12s var(--ease-smooth), border-color 0.12s var(--ease-smooth);
}
.btn:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--primary);
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(0.97); transition-duration: 0.05s; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  max-width: 1200px;
  margin: 0 auto;
}
@media (min-width: 600px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
}

.tile {
  aspect-ratio: var(--tile-aspect);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s var(--ease-smooth),
              border-color 0.18s var(--ease-smooth),
              box-shadow 0.18s var(--ease-smooth);
}
.tile:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}
.tile img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
}

.pager {
  display: flex; justify-content: center; align-items: center;
  gap: 14px;
  padding: 24px 0;
  color: var(--text-secondary);
}
.page-info { font: 12px/1 monospace; letter-spacing: 0.12em; text-transform: uppercase; }

.empty {
  text-align: center;
  padding: 64px 16px;
  color: var(--text-secondary);
}
.empty h2 { margin: 0 0 8px; font-weight: 500; }

.error {
  background: var(--surface);
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin: 16px auto;
  max-width: 720px;
  text-align: center;
}

/* --- Lightbox --- */
.lightbox {
  border: none; padding: 0; margin: auto;
  background: transparent;
  max-width: 95vw; max-height: 95vh;
  width: 95vw;
}
.lightbox::backdrop { background: rgba(0, 0, 0, 0.85); }
.lightbox[open] { display: block; }

.lightbox-grid {
  display: grid;
  grid-template-columns: 1fr;
  background: var(--bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}
@media (min-width: 720px) {
  .lightbox-grid { grid-template-columns: 1fr 320px; }
}

.lightbox-photo {
  background: #000;
  aspect-ratio: var(--tile-aspect);
  display: flex; align-items: center; justify-content: center;
}
.lightbox-photo img {
  width: 100%; height: 100%; object-fit: contain;
  display: block;
}

.lightbox-qr {
  background: #fff;
  color: #111;
  padding: 24px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  gap: 16px;
}
.lightbox-qr h3 {
  margin: 0;
  font-weight: 500;
  font-size: 16px;
  letter-spacing: 0.04em;
}
.qr-frame {
  width: 200px; height: 200px;
  display: grid; place-items: center;
}
.qr-frame img, .qr-frame canvas { width: 200px; height: 200px; image-rendering: pixelated; }
.qr-url {
  font: 11px/1.4 monospace;
  color: #555;
  word-break: break-all;
  max-width: 220px;
  margin: 0;
}

.lightbox-close {
  position: absolute; top: 8px; right: 8px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: grid; place-items: center;
  z-index: 10;
}
.lightbox-close:hover { background: var(--surface); }

/* Loading shimmer for tiles before image loads */
.tile.loading {
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-hover) 50%, var(--surface) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
