/* ─────────────────────────────────────────────────────────
   Wild Camping Bucket List
   Muted, atmospheric dark theme — soft blue-grey ground,
   one warm terracotta accent. Matches the photo-book cover.
   ───────────────────────────────────────────────────────── */
:root {
  --bg:        #14171b;   /* deep desaturated charcoal-blue */
  --bg-raised: #1b1f25;
  --bg-inset:  #10131720;
  --panel:     #191d23;
  --line:      #2a2f37;
  --line-soft: #23282f;

  --text:      #cdd2d8;
  --text-dim:  #8b939d;
  --text-faint:#626a74;

  --accent:      #d6885a;   /* warm terracotta */
  --accent-soft: #e0a279;
  --accent-glow: #d6885a33;

  --legal:   #7ba36f;   /* muted sage green */
  --permit:  #cBA45c;   /* muted amber */
  --grey:    #7d8790;   /* slate */
  --illegal: #b5635a;   /* muted brick red */

  --shadow: 0 10px 30px -12px #000a;
  --font: "Iowan Old Style", "Palatino Linotype", Palatino, "Georgia", serif;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
}

.app {
  display: grid;
  grid-template-columns: 360px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

.masthead {
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.masthead h1 {
  margin: 0;
  font-family: var(--font);
  font-weight: 500;
  font-size: 26px;
  letter-spacing: .3px;
  color: var(--text);
}
.masthead h1::first-letter { color: var(--accent); }
.tagline {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-faint);
  font-style: italic;
  font-family: var(--font);
}

/* Filters */
.filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line-soft);
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .9px;
  color: var(--text-faint);
}
.field select {
  appearance: none;
  background: var(--bg-raised);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 26px 8px 10px;
  font-size: 13px;
  font-family: var(--ui);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238b939d' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color .15s;
}
.field select:focus { outline: none; border-color: var(--accent); }
.checkline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  grid-column: 1 / -1;
  cursor: pointer;
}
.checkline span {
  font-size: 12.5px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-dim);
}
.checkline input {
  accent-color: var(--accent);
  width: 15px; height: 15px;
  cursor: pointer;
}

.result-count {
  margin: 0;
  padding: 12px 22px 6px;
  font-size: 11px;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* Spot list */
.spot-list {
  list-style: none;
  margin: 0;
  padding: 0 12px 12px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.spot {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 10px;
  padding: 12px 10px;
  border-radius: 9px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}
.spot:hover { background: var(--bg-raised); }
.spot.active {
  background: var(--bg-raised);
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 -1px var(--accent);
}
.spot .status-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-top: 5px;
  flex: none;
}
.spot-main { min-width: 0; }
.spot-name {
  font-family: var(--font);
  font-size: 15.5px;
  color: var(--text);
  line-height: 1.25;
}
.spot.done .spot-name { color: var(--text-dim); }
.spot.done .spot-name::after {
  content: "✓";
  margin-left: 7px;
  color: var(--legal);
  font-size: 12px;
}
.spot-meta {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--text-faint);
  letter-spacing: .2px;
}
.diff {
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 1px;
  white-space: nowrap;
}
.diff b { color: var(--accent-soft); font-weight: 400; }

.side-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 22px;
  border-top: 1px solid var(--line-soft);
  font-size: 11px;
  color: var(--text-faint);
}
.legend { display: flex; align-items: center; gap: 6px; }
.legend .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-left: 6px;
}
.dot.legal   { background: var(--legal); }
.dot.permit  { background: var(--permit); }
.dot.grey    { background: var(--grey); }
.dot.illegal { background: var(--illegal); }

/* ── Map ───────────────────────────────────────────────── */
.map-wrap { position: relative; min-width: 0; }
#map {
  position: absolute;
  inset: 0;
  background: var(--bg);
}
.leaflet-container { font-family: var(--ui); background: #0e1114; }
.leaflet-control-attribution {
  background: #0e1114cc !important;
  color: var(--text-faint) !important;
}
.leaflet-control-attribution a { color: var(--text-dim) !important; }
.leaflet-bar a {
  background: var(--panel) !important;
  color: var(--text) !important;
  border-bottom-color: var(--line) !important;
}
.leaflet-bar a:hover { background: var(--bg-raised) !important; }

/* Custom teardrop markers */
.pin {
  width: 20px; height: 20px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid #0e1114;
  box-shadow: 0 3px 6px -1px #000a;
  transition: transform .12s;
}
.pin::after {
  content: "";
  position: absolute;
  top: 5px; left: 5px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #0e1114aa;
}
.pin.legal   { background: var(--legal); }
.pin.permit  { background: var(--permit); }
.pin.grey    { background: var(--grey); }
.pin.illegal { background: var(--illegal); }
.pin.done    { opacity: .55; }
.pin-wrap.active .pin {
  transform: rotate(-45deg) scale(1.35);
  border-color: var(--accent);
  z-index: 500;
}

/* Cluster bubbles */
.cl-cluster {
  background: var(--accent-glow);
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font: 600 13px/1 var(--ui);
  box-shadow: 0 3px 10px -3px #000c;
  backdrop-filter: blur(2px);
}

/* ── Detail panel ──────────────────────────────────────── */
.detail {
  position: absolute;
  top: 14px; right: 14px; bottom: 14px;
  width: 340px;
  max-width: calc(100% - 28px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 600;
  display: flex;
  flex-direction: column;
  animation: slidein .22s ease;
}
@keyframes slidein {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: none; }
}
.detail-close {
  position: absolute;
  top: 10px; right: 12px;
  width: 30px; height: 30px;
  border: none;
  background: #0e111466;
  color: var(--text-dim);
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  transition: background .15s, color .15s;
}
.detail-close:hover { background: #0e1114; color: var(--text); }
.detail-body { overflow-y: auto; }

.d-hero {
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, var(--bg-raised), transparent);
}
.d-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 9px;
  border-radius: 20px;
  border: 1px solid currentColor;
  margin-bottom: 12px;
}
.d-status.legal   { color: var(--legal); }
.d-status.permit  { color: var(--permit); }
.d-status.grey    { color: var(--grey); }
.d-status.illegal { color: var(--illegal); }
.d-status .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.d-name {
  margin: 0;
  font-family: var(--font);
  font-weight: 500;
  font-size: 23px;
  line-height: 1.15;
  color: var(--text);
}
.d-place {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--text-faint);
  letter-spacing: .3px;
}

.d-stats {
  display: flex;
  gap: 22px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line-soft);
}
.d-stat span {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .9px;
  color: var(--text-faint);
  margin-bottom: 4px;
}
.d-stat b {
  font-family: var(--font);
  font-weight: 500;
  font-size: 16px;
  color: var(--text);
}
.d-stat .bars { letter-spacing: 2px; color: var(--accent); font-size: 15px; }
.d-stat .bars .off { color: var(--line); }

.d-notes {
  padding: 18px 22px;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.6;
  color: #b9bfc6;
}

.d-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 22px 18px;
}
.d-tags span {
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg-raised);
  border: 1px solid var(--line-soft);
  padding: 3px 9px;
  border-radius: 20px;
}

.d-actions {
  padding: 4px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 14px;
  border-radius: 9px;
  font-size: 13.5px;
  font-family: var(--ui);
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s, background .15s, color .15s;
}
.btn:hover { border-color: var(--text-faint); }
.btn-visit.done {
  border-color: var(--legal);
  color: var(--legal);
  background: #7ba36f14;
}
.btn-report {
  border-color: var(--accent);
  color: var(--accent-soft);
  background: var(--accent-glow);
}
.btn-report:hover { background: #d6885a26; border-color: var(--accent-soft); }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 46vh 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--line); }
  .detail { top: auto; left: 14px; right: 14px; bottom: 14px; width: auto; height: 62%; }
}
