*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --forest: #1a3a0a;
  --forest-light: #2d5a14;
  --gold: #c9a227;
  --cream: #f8f5ec;
  --slate: #495057;
  --muted: #6c757d;
  --border: #dee2e6;
  --bg: #f8f9fa;
  --card: #fff;
  --verified: #1a3a0a;
  --approximate: #e67e22;
}

body {
  font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  display: flex;
  flex-direction: column;
  height: 100vh;
  color: #212529;
}

/* Top nav bar */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 40px;
  background: var(--forest);
  color: #fff;
  font-size: 13px;
  flex-shrink: 0;
  z-index: 20;
}

.top-nav a {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.04em;
  transition: color 0.2s;
}

.top-nav a:hover { color: #fff; }

.top-nav .site-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: #fff;
}

/* Main layout */
.main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
#sidebar {
  width: 340px;
  height: 100%;
  overflow-y: auto;
  background: var(--bg);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

#sidebar-header {
  padding: 14px 14px 12px;
  background: var(--forest);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}

#sidebar-header h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

#sidebar-header p {
  font-size: 12px;
  opacity: 0.8;
}

#search {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 4px;
  font-size: 13px;
  margin-top: 8px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  outline: none;
}

#search::placeholder { color: rgba(255,255,255,0.5); }
#search:focus { border-color: rgba(255,255,255,0.6); background: rgba(255,255,255,0.15); }

/* Era filter chips */
#filter-chips {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.chip {
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.35);
  background: transparent;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.chip:hover { background: rgba(255,255,255,0.1); }
.chip.active { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.6); color: #fff; }

/* Site list */
#site-list {
  padding: 6px 8px;
  flex: 1;
  overflow-y: auto;
}

.site-card {
  padding: 10px 12px;
  margin: 4px 0;
  background: var(--card);
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid #e9ecef;
  transition: all 0.15s ease;
}

.site-card:hover { background: #e8f4fd; border-color: #b8daff; }

.site-card .name {
  font-weight: 600;
  font-size: 13px;
  color: #212529;
  display: flex;
  align-items: center;
  gap: 6px;
}

.site-card .location {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

.site-card .era-tag {
  display: inline-block;
  font-size: 10.5px;
  color: var(--forest);
  font-weight: 600;
  margin-top: 4px;
  letter-spacing: 0.02em;
}

.badge-approx {
  font-size: 9px;
  background: #fff3cd;
  color: #856404;
  padding: 1px 5px;
  border-radius: 8px;
  font-weight: 500;
}

.badge-img {
  font-size: 10px;
  color: #6f42c1;
}

/* Trip tracker */
.visit-btn {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #ced4da;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  color: transparent;
  transition: all 0.2s;
  margin-left: auto;
  padding: 0;
}

.visit-btn:hover { border-color: #27ae60; background: #e8f5e9; }

.visit-btn.visited {
  border-color: #27ae60;
  background: #27ae60;
  color: #fff;
}

.site-card.visited {
  border-left: 3px solid #27ae60;
  background: #f0faf3;
}

.site-card.visited:hover { background: #e0f5e7; }

.site-card .card-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.card-row .card-text { flex: 1; min-width: 0; }

/* Progress bar */
.progress-wrap {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-bar {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #27ae60;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  white-space: nowrap;
}

/* Visited filter chip */
.chip-visited {
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.35);
  background: transparent;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  margin-left: 4px;
}

.chip-visited:hover { background: rgba(255,255,255,0.1); }
.chip-visited.active { background: #27ae60; border-color: #27ae60; color: #fff; }

/* Popup visit button */
.popup-visit-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 4px;
  border: 1.5px solid #27ae60;
  background: #fff;
  color: #27ae60;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  font-family: inherit;
  transition: all 0.2s;
}

.popup-visit-btn:hover { background: #e8f5e9; }

.popup-visit-btn.visited {
  background: #27ae60;
  color: #fff;
}

/* Map */
#map { flex: 1; height: 100%; }

/* Popup styles */
.popup-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--forest);
  margin-bottom: 6px;
}

.popup-section { margin: 8px 0; }

.popup-section strong {
  font-size: 10.5px;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.popup-section p {
  font-size: 13px;
  color: #212529;
  margin-top: 2px;
  line-height: 1.5;
}

.popup-facts {
  padding-left: 16px;
  margin-top: 4px;
}

.popup-facts li {
  font-size: 12px;
  color: var(--slate);
  margin: 3px 0;
  line-height: 1.4;
}

.popup-activity {
  background: #e8f5e9;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  margin-top: 8px;
  line-height: 1.4;
}

.popup-img {
  width: 100%;
  border-radius: 4px;
  margin: 6px 0;
  cursor: pointer;
}

.popup-img:hover { opacity: 0.9; }

.popup-confidence {
  font-size: 10px;
  color: #999;
  margin-top: 6px;
  font-style: italic;
}

.popup-meta {
  font-size: 11px;
  color: #999;
  margin-top: 6px;
}

/* Lightbox */
#lightbox {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.88);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

#lightbox.show { display: flex; }
#lightbox img { max-width: 92%; max-height: 92%; object-fit: contain; border-radius: 4px; }

/* Responsive */
@media (max-width: 768px) {
  .main-layout { flex-direction: column-reverse; }

  #sidebar {
    width: 100%;
    height: 40vh;
    border-right: none;
    border-top: 1px solid var(--border);
  }

  #map { height: 60vh; }
}
