:root {
  --ink: #2d3748;
  --muted: #64748b;
  --brand: #1e5a8e;
  --paper: #f7f5f1;
  --line: #e2e8f0;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
a { color: var(--brand); }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1000;
}
.brand { font-weight: 800; font-size: 20px; text-decoration: none; color: var(--brand); }
.topbar nav { display: flex; gap: 18px; align-items: center; }
.topbar nav a { text-decoration: none; font-weight: 600; color: var(--ink); }
.topbar nav a.donate {
  background: var(--brand); color: #fff; padding: 8px 14px; border-radius: 8px;
}

main { max-width: 1040px; margin: 0 auto; padding: 24px; }

.hero h1, .tour-head h1, .auth h1, .contribute h1, .place h1 { margin: 0 0 8px; }
.hero p { color: var(--muted); font-size: 17px; max-width: 60ch; }

.map { width: 100%; border: 1px solid var(--line); border-radius: var(--radius); }
.map--tall { height: 520px; margin: 18px 0; }

.cards { list-style: none; padding: 0; display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card a { display: flex; align-items: center; gap: 10px; padding: 14px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: var(--ink); }
.card-name { font-weight: 700; }
.card-meta { margin-left: auto; color: var(--muted); font-size: 13px; }
.swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; flex: none; }

.back { display: inline-block; margin-bottom: 8px; text-decoration: none; }
.tour-meta, .muted { color: var(--muted); }
.empty { color: var(--muted); font-style: italic; }

/* Auth + contribute forms */
.auth, .place { max-width: 760px; }
form input[type=email], form input[type=text], form input, form select {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px;
  width: 100%;
}
.auth form { display: flex; gap: 10px; margin-top: 14px; }
.auth form input { flex: 1; }
button {
  background: var(--brand); color: #fff; border: 0; padding: 11px 18px;
  border-radius: 8px; font-weight: 700; font-size: 15px; cursor: pointer;
}
.btn { display: inline-block; padding: 8px 14px; border-radius: 8px; background: var(--brand);
  color: #fff; text-decoration: none; font-weight: 600; border: 0; cursor: pointer; font-size: 14px; }
.btn--ghost { background: #fff; color: var(--muted); border: 1px solid var(--line); }
.notice { background: #eef6ff; border: 1px solid #cfe3f7; padding: 12px 14px; border-radius: 8px; }
.error { color: #b42318; }

.grid { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; margin: 12px 0; }
.grid label, .latlng label { display: flex; flex-direction: column; font-size: 13px;
  color: var(--muted); gap: 4px; }
.latlng { display: flex; gap: 12px; margin: 8px 0; }
.upload-form { background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 28px; }

/* Suggestions list */
.suggestions { list-style: none; padding: 0; display: grid; gap: 12px; }
.suggestion { display: flex; gap: 14px; align-items: center; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.suggestion img { width: 96px; height: 72px; object-fit: cover; border-radius: 6px; flex: none; }
.sug-body { flex: 1; }
.sug-place { font-size: 12px; font-weight: 700; color: var(--brand); margin-bottom: 2px; }
.sug-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.year { color: var(--muted); font-weight: 600; margin-left: 6px; }
.sug-actions { display: flex; gap: 8px; align-items: center; }
.sug-actions form { margin: 0; }

/* Place page */
.place-grid { display: grid; gap: 20px; grid-template-columns: 220px 1fr; align-items: start; }
.place-preview img { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); }

/* Photo popups */
.photo-popup img { width: 100%; border-radius: 6px; margin-bottom: 6px; }
.photo-popup .pp-credit, .photo-popup .pp-src { color: var(--muted); font-size: 12px; }

.site-footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 24px;
  text-align: center; color: var(--muted); font-size: 14px; background: #fff; }

@media (max-width: 640px) {
  .grid, .place-grid { grid-template-columns: 1fr; }
  .auth form { flex-direction: column; }
}

/* --- clickable thumbnails + lightbox --- */
.wg-thumb { cursor: zoom-in; }
.sug-thumb { width: 72px; height: 56px; object-fit: cover; border-radius: 4px; margin: 2px; }
.wg-lightbox {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(15, 23, 42, 0.88);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.wg-lightbox[hidden] { display: none; }
.wg-lightbox figure { margin: 0; max-width: 92vw; max-height: 92vh; text-align: center; }
.wg-lightbox img {
  max-width: 92vw; max-height: 78vh; object-fit: contain;
  border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.5); background: #fff;
}
.wg-lightbox figcaption {
  color: #f1f5f9; margin-top: 12px; font-size: 14px; line-height: 1.5; max-width: 720px;
}
.wg-lightbox figcaption .lb-place { display:block; color:#fdba74; font-weight:700; font-size:12px; }
.wg-lightbox figcaption .year { color:#cbd5e1; }
.wg-lightbox figcaption .lb-credit { color:#94a3b8; font-size:12px; margin-top:2px; }
.wg-lightbox figcaption .lb-src a { color:#7dd3fc; }
.wg-lb-close {
  position: absolute; top: 14px; right: 18px; z-index: 2001;
  background: none; border: none; color: #fff; font-size: 34px; line-height: 1;
  cursor: pointer; opacity: .8;
}
.wg-lb-close:hover { opacity: 1; }

/* --- near me view --- */
.near-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-top: 16px; }
.near-card { display: flex; gap: 12px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px; }
.near-card img { width: 96px; height: 84px; object-fit: cover; border-radius: 6px; flex: none; }
.near-body { min-width: 0; }
.near-place { font-size: 12px; font-weight: 700; color: var(--brand); margin: 3px 0 1px; }
.near-title { font-weight: 600; font-size: 14px; }
.near-meta, .near-src { color: var(--muted); font-size: 12px; margin-top: 2px; }
.near-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
  background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
.near-badge--ok { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
@media (max-width: 640px) { .near-grid { grid-template-columns: 1fr; } .map--tall { height: 360px; } }

/* --- map thumbnail pins (photo shows directly on the map) --- */
.wg-pin { background: none; border: none; }
.wg-pin-inner {
  position: relative; width: 46px; height: 46px; border-radius: 8px;
  border: 2px solid var(--ring, #1e5a8e); overflow: visible;
  box-shadow: 0 2px 6px rgba(0,0,0,.35); background: #fff; cursor: pointer;
  transition: transform .1s;
}
.wg-pin-inner:hover { transform: scale(1.12); z-index: 500; }
.wg-pin-inner img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; display: block; }
.wg-pin-badge {
  position: absolute; top: -7px; right: -7px; min-width: 18px; height: 18px;
  padding: 0 4px; border-radius: 9px; background: var(--ring, #c2410c); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
}

/* --- quick bulk-upload + place --- */
.drop { display: block; border: 2px dashed #cbd5e1; border-radius: var(--radius);
  background: #fff; padding: 26px 18px; text-align: center; color: var(--muted);
  cursor: pointer; margin: 14px 0; transition: border-color .12s, background .12s; }
.drop:hover, .drop.over { border-color: var(--brand); background: #f0f7ff; }
.drop strong { color: var(--brand); }
.drop #up-status { display: block; margin-top: 8px; font-size: 13px; }
.tray { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.tray-thumb { width: 66px; height: 52px; object-fit: cover; border-radius: 6px;
  border: 3px solid transparent; cursor: pointer; }
.tray-thumb.active { border-color: #f97316; box-shadow: 0 0 0 2px #fed7aa; }
.tray-thumb.placed { opacity: .35; cursor: default; }
.route-add { margin-left: auto; }
.route-add .btn { font-size: 13px; padding: 6px 12px; }
