/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Noto Sans', 'Google Sans', sans-serif;
  background: #efefef;
  color: #2a2a2a;
  height: 100vh;
  overflow: hidden;
}

.dname { font-variant: small-caps; }

/* ── App shell ────────────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ── Top bar ──────────────────────────────────────────────────────────────── */
#topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0 1.5rem;
  height: 52px;
  background: #fff;
  border-bottom: 1px solid #ddd;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

#back-link {
  color: #555;
  text-decoration: none;
  font-size: 0.85rem;
  white-space: nowrap;
  flex-shrink: 0;
}
#back-link:hover { color: #111; }

#topbar-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a1a;
  letter-spacing: 0.01em;
}

#topbar-hint {
  margin-left: auto;
  font-size: 0.8rem;
  color: #999;
  white-space: nowrap;
}

/* ── Main layout ──────────────────────────────────────────────────────────── */
#main {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* ── Map panel ────────────────────────────────────────────────────────────── */
#map-panel {
  flex: 1;
  position: relative;
  background: #efefef;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#us-map {
  display: block;
  width: 90%;
  max-height: 90%;
}

/* State paths */
.us-map-state {
  fill: #c4c4c4;
  stroke: none;
  transition: fill 0.12s ease;
  cursor: pointer;
}

.us-map-state:hover {
  fill: #a8a8a8;
}

.us-map-state.active {
  fill: #888 !important;
}

/* ── Tooltip ──────────────────────────────────────────────────────────────── */
#map-tooltip {
  position: absolute;
  background: rgba(30, 30, 30, 0.88);
  color: #f0f0f0;
  font-size: 0.78rem;
  padding: 0.35rem 0.7rem;
  border-radius: 4px;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.12s ease;
  z-index: 5;
}

/* ── Legend ───────────────────────────────────────────────────────────────── */
#legend {
  position: absolute;
  bottom: 1.2rem;
  left: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: #555;
  background: rgba(255,255,255,0.85);
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  border: 1px solid #ccc;
}

#legend-bar {
  width: 90px;
  height: 10px;
  border-radius: 3px;
  background: linear-gradient(to right, #d5d5d5, #4a4a4a);
  border: 1px solid #bbb;
}

/* ── Sidebar (absolute overlay on the right) ──────────────────────────────── */
#sidebar {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 0;
  background: #fff;
  border-left: 0 solid #ddd;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.28s ease, border-left-width 0.1s ease,
              box-shadow 0.28s ease;
  z-index: 10;
}

#sidebar.open {
  width: 280px;
  border-left-width: 1px;
  box-shadow: -6px 0 20px rgba(0,0,0,0.08);
}

/* ── Sidebar header ───────────────────────────────────────────────────────── */
#sidebar-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

#sidebar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.1rem 1.1rem 0.75rem;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

#sidebar-state-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: 0.01em;
}

#sidebar-count {
  font-size: 0.78rem;
  color: #888;
  margin-top: 0.2rem;
}

#sidebar-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #aaa;
  font-size: 0.85rem;
  padding: 0.2rem 0.3rem;
  border-radius: 3px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 0.1rem;
}
#sidebar-close:hover { color: #333; background: #f0f0f0; }

/* ── Search bar ───────────────────────────────────────────────────────────── */
#sidebar-search-wrap {
  padding: 0.65rem 1.1rem;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

#sidebar-search {
  width: 100%;
  padding: 0.45rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 0.82rem;
  background: #f9f9f9;
  color: #333;
  outline: none;
  transition: border-color 0.15s;
}
#sidebar-search:focus {
  border-color: #999;
  background: #fff;
}

/* ── Landmark list ────────────────────────────────────────────────────────── */
#landmarks-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.9rem;
}

/* Scrollbar */
#landmarks-list::-webkit-scrollbar { width: 5px; }
#landmarks-list::-webkit-scrollbar-track { background: transparent; }
#landmarks-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

.landmark-item {
  padding: 0.7rem 0.8rem;
  margin-bottom: 0.5rem;
  border: 1px solid #e8e8e8;
  border-radius: 5px;
  background: #fafafa;
  transition: background 0.12s, border-color 0.12s;
  cursor: default;
}

.landmark-item:hover {
  background: #f2f2f2;
  border-color: #ccc;
}

.landmark-name {
  font-size: 0.87rem;
  font-weight: 600;
  color: #1e1e1e;
  line-height: 1.35;
  margin-bottom: 0.35rem;
}

.landmark-category {
  display: inline-block;
  background: #e4e4e4;
  color: #444;
  font-size: 0.7rem;
  padding: 0.15rem 0.55rem;
  border-radius: 3px;
  margin-bottom: 0.4rem;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.landmark-wiki {
  font-size: 0.75rem;
  color: #777;
  margin-top: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.landmark-coords {
  font-size: 0.72rem;
  color: #aaa;
  margin-top: 0.15rem;
  font-variant-numeric: tabular-nums;
}

.no-results {
  text-align: center;
  color: #bbb;
  font-size: 0.85rem;
  padding: 2rem 0;
}

/* ── Loading spinner ──────────────────────────────────────────────────────── */
#loading-overlay {
  position: absolute;
  inset: 0;
  background: #e8e8e8;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  transition: opacity 0.3s;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #ccc;
  border-top-color: #666;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  body { overflow: auto; }
  #app { height: auto; }
  #map-panel { height: 60vw; min-height: 240px; }
  #sidebar.open { width: 100%; box-shadow: none; }
}
