@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --ink: #1c1815;
  --ink-soft: #2a2420;
  --card: #241f1b;
  --paper: #f4efe6;
  --paper-dim: #cfc6b8;
  --amber: #c9932e;
  --amber-bright: #e3ab3f;
  --amber-dim: #7a5e26;
  --danger: #b3543f;
  --line: rgba(244, 239, 230, 0.1);
  --radius: 3px;
  --font-display: 'Fraunces', serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  min-height: 100vh;
}

a { color: inherit; }

.wordmark {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.5rem;
  letter-spacing: 0.01em;
  margin: 0;
  color: var(--paper);
}

/* ---------- Topbar ---------- */
.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--ink-soft);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.topbar-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--paper-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.reel-dot { color: var(--amber-dim); }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.btn-primary {
  background: var(--amber);
  color: #1c1815;
}
.btn-primary:hover { background: var(--amber-bright); }
.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--paper-dim);
}
.btn-ghost:hover { border-color: var(--amber-dim); color: var(--paper); }
.btn-danger {
  background: transparent;
  border-color: rgba(179, 84, 63, 0.5);
  color: var(--danger);
}
.btn-danger:hover { background: rgba(179, 84, 63, 0.12); }

/* ---------- Layout ---------- */
.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

/* ---------- Dropzone ---------- */
.dropzone {
  border: 1.5px dashed var(--amber-dim);
  border-radius: 6px;
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--amber-bright);
  background: rgba(201, 147, 46, 0.06);
}
.safelight {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 16px 4px rgba(227, 171, 63, 0.55);
  margin: 0 auto 14px;
}
.dropzone-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 0 0 4px;
}
.dropzone-sub {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--paper-dim);
  margin: 0;
  letter-spacing: 0.02em;
}

/* ---------- Upload queue ---------- */
.upload-queue {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 24px;
}
.uq-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--paper-dim);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.uq-bar {
  height: 3px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 6px;
}
.uq-bar-fill {
  height: 100%;
  background: var(--amber);
  width: 0%;
  transition: width 0.15s ease;
}
.uq-item.error .uq-bar-fill { background: var(--danger); }
.uq-status { white-space: nowrap; }

/* ---------- Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 4px;
}
.tile {
  margin: 0;
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  cursor: pointer;
  background: var(--card);
  border-radius: var(--radius);
}
.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease, filter 0.25s ease;
}
.tile:hover img {
  transform: scale(1.04);
}
.tile::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px var(--line);
  pointer-events: none;
}
.tile figcaption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 20px 10px 8px;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--paper);
  opacity: 0;
  transition: opacity 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tile:hover figcaption { opacity: 1; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--paper-dim);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 6, 0.94);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox[hidden] {
  display: none;
}
.lb-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 92vw;
  max-height: 90vh;
}
.lb-content img {
  max-width: 92vw;
  max-height: 76vh;
  object-fit: contain;
  border-radius: 2px;
}
.lb-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--paper-dim);
  flex-wrap: wrap;
  justify-content: center;
}
.lb-close, .lb-nav {
  position: absolute;
  background: transparent;
  border: none;
  color: var(--paper);
  font-size: 2rem;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s ease;
  line-height: 1;
}
.lb-close:hover, .lb-nav:hover { opacity: 1; }
.lb-close { top: 20px; right: 28px; font-size: 2.2rem; }
.lb-prev { left: 20px; top: 50%; transform: translateY(-50%); font-size: 3rem; }
.lb-next { right: 20px; top: 50%; transform: translateY(-50%); font-size: 3rem; }

/* ---------- Auth pages ---------- */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--ink);
  padding: 20px;
}
.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 40px 32px;
  text-align: center;
}
.auth-card .wordmark { margin-bottom: 4px; }
.lede {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--paper-dim);
  margin: 0 0 28px;
}
.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}
.auth-card label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--paper-dim);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-card input {
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--ink);
  color: var(--paper);
}
.auth-card input:focus {
  outline: none;
  border-color: var(--amber);
}
.auth-card .btn { justify-content: center; margin-top: 4px; }
.form-error {
  background: rgba(179, 84, 63, 0.12);
  border: 1px solid rgba(179, 84, 63, 0.4);
  color: #e0a494;
  font-size: 0.8rem;
  padding: 10px 12px;
  border-radius: var(--radius);
  margin: 0 0 20px;
}
.fine-print {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--paper-dim);
}
.fine-print code {
  color: var(--amber);
}

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

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

@media (max-width: 560px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .auth-card { padding: 32px 24px; }
}
