@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&display=swap');

:root {
  --bg: #141312;
  --bg-elevated: #1c1a18;
  --bg-input: #201d1a;
  --ink: #f0ece6;
  --ink-dim: #a89f92;
  --line: #322d28;
  --brass: #b8935f;
  --brass-dim: #8a6d47;
  --danger: #c96a4f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
}

a { color: inherit; }

.eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass);
  font-weight: 600;
}

/* ---------- Centered auth card (login / admin login) ---------- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 40px 36px;
}

.auth-card .display {
  font-size: 1.9rem;
  margin-top: 6px;
  margin-bottom: 28px;
}

label {
  display: block;
  font-size: 0.82rem;
  color: var(--ink-dim);
  margin-bottom: 6px;
  margin-top: 18px;
}
label:first-of-type { margin-top: 0; }

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 11px 13px;
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink);
  font-size: 0.95rem;
  font-family: inherit;
}
input:focus {
  outline: none;
  border-color: var(--brass-dim);
}

button, .btn {
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 3px;
  border: 1px solid transparent;
  padding: 11px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--brass);
  color: #191512;
  width: 100%;
  margin-top: 26px;
}
.btn-primary:hover { background: #c7a06d; }

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

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--line);
}

.error-msg {
  background: rgba(201, 106, 79, 0.12);
  border: 1px solid rgba(201, 106, 79, 0.4);
  color: #e0a08c;
  font-size: 0.85rem;
  padding: 10px 13px;
  border-radius: 3px;
  margin-top: 18px;
}

.hint {
  color: var(--ink-dim);
  font-size: 0.82rem;
  margin-top: 22px;
  line-height: 1.5;
}
.hint a { color: var(--brass); text-decoration: none; }

/* ---------- Top bar (gallery + admin pages) ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  background: rgba(20, 19, 18, 0.88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.topbar .display { font-size: 1.3rem; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.count-pill {
  font-size: 0.82rem;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 6px 14px;
}
.count-pill strong { color: var(--brass); font-weight: 600; }

/* ---------- Photo grid ---------- */
.grid-wrap { padding: 28px 32px 80px; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.photo-tile {
  position: relative;
  border-radius: 3px;
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  cursor: pointer;
}

.photo-tile img {
  width: 100%;
  height: 260px;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}
.photo-tile:hover img { transform: scale(1.03); }

/* Signature selection mark: a proof-loupe brass corner frame, not a heart. */
.photo-tile.selected::before,
.photo-tile.selected::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2px solid var(--brass);
  z-index: 2;
}
.photo-tile.selected::before {
  top: 8px; left: 8px;
  border-right: none; border-bottom: none;
}
.photo-tile.selected::after {
  bottom: 8px; right: 8px;
  border-left: none; border-top: none;
}

.photo-tile .select-tag {
  position: absolute;
  top: 10px; right: 10px;
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--brass);
  background: rgba(20, 19, 18, 0.75);
  padding: 4px 8px;
  border-radius: 20px;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.photo-tile.selected .select-tag { opacity: 1; }

.photo-tile .filename-tag {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 22px 10px 8px;
  font-size: 0.72rem;
  color: var(--ink-dim);
  background: linear-gradient(to top, rgba(20,19,18,0.85), transparent);
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 9, 8, 0.94);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 40px;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 2px;
}
.lightbox-controls {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
}
.lightbox-close {
  position: absolute;
  top: 24px; right: 32px;
  font-size: 1.6rem;
  color: var(--ink-dim);
  background: none;
  border: none;
  cursor: pointer;
}

/* ---------- Admin dashboard ---------- */
.page-wrap { padding: 40px 32px 80px; max-width: 960px; margin: 0 auto; }

.gallery-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 24px;
}

.gallery-row {
  background: var(--bg-elevated);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
}
.gallery-row:hover { background: #221f1b; }

.gallery-row .name { font-family: 'Fraunces', serif; font-size: 1.05rem; }
.gallery-row .meta { color: var(--ink-dim); font-size: 0.8rem; margin-top: 3px; }

.new-gallery-form {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 24px 26px;
  margin-top: 32px;
}
.form-row { display: flex; gap: 14px; }
.form-row > div { flex: 1; }

.upload-form {
  background: var(--bg-elevated);
  border: 1px dashed var(--line);
  border-radius: 4px;
  padding: 22px 26px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-photo-tile { position: relative; }
.admin-photo-tile .delete-btn {
  position: absolute;
  top: 8px; left: 8px;
  font-size: 0.7rem;
  background: rgba(20,19,18,0.8);
  color: var(--danger);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 4px 9px;
  z-index: 3;
}

.back-link {
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 0.85rem;
}
.back-link:hover { color: var(--brass); }

.empty-state {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 60px 20px;
  text-align: center;
  color: var(--ink-dim);
  margin-top: 24px;
}
