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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
}

#header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: #16213e;
  border-bottom: 1px solid #0f3460;
  z-index: 1000;
  position: relative;
}

#header h1 {
  font-size: 1.25rem;
  color: #e94560;
  white-space: nowrap;
}

#filters {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex: 1;
}

#filters select,
#filters input {
  padding: 0.4rem 0.6rem;
  border: 1px solid #0f3460;
  border-radius: 4px;
  background: #1a1a2e;
  color: #e0e0e0;
  font-size: 0.875rem;
}

#filters input {
  flex: 1;
  max-width: 300px;
}

#site-count {
  font-size: 0.8rem;
  color: #888;
  white-space: nowrap;
}

#map {
  width: 100%;
  height: calc(100vh - 52px);
}

/* Detail panel */
#detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 100vw;
  height: 100vh;
  background: #16213e;
  border-left: 2px solid #0f3460;
  overflow-y: auto;
  z-index: 2000;
  transition: transform 0.3s ease;
  padding: 1.5rem;
}

#detail-panel.hidden {
  transform: translateX(100%);
}

#detail-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: #e94560;
  font-size: 1.5rem;
  cursor: pointer;
}

#detail-content h2 {
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
  color: #fff;
}

#detail-content .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

#detail-content .meta span {
  background: #0f3460;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
}

#detail-content .site-image {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 1rem;
}

#detail-content .narrative {
  line-height: 1.7;
  font-size: 0.95rem;
  color: #ccc;
}

#detail-content .narrative p {
  margin-bottom: 0.75rem;
}

#detail-content .narrative h1,
#detail-content .narrative h2,
#detail-content .narrative h3,
#detail-content .narrative h4 {
  color: #fff;
  margin: 1rem 0 0.5rem;
  font-size: 1.05rem;
}

#detail-content .narrative ul,
#detail-content .narrative ol {
  padding-left: 1.25rem;
  margin-bottom: 0.75rem;
}

#detail-content .narrative li {
  margin-bottom: 0.25rem;
}

#detail-content .narrative strong {
  color: #e0e0e0;
}

#detail-content .narrative hr {
  border: none;
  border-top: 1px solid #0f3460;
  margin: 1rem 0;
}

#detail-content .links {
  margin-top: 1rem;
  display: flex;
  gap: 0.75rem;
}

#detail-content .links a {
  color: #e94560;
  text-decoration: none;
  font-size: 0.875rem;
}

#detail-content .links a:hover {
  text-decoration: underline;
}

#detail-loading {
  color: #888;
  padding: 2rem 0;
  text-align: center;
}

/* Loading skeleton */
@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton-block {
  background: linear-gradient(90deg, #1a1a2e 25%, #243352 50%, #1a1a2e 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite ease-in-out;
  border-radius: 4px;
  margin-bottom: 0.75rem;
}

.skeleton-title {
  height: 1.6rem;
  width: 65%;
}

.skeleton-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.skeleton-tag {
  height: 1.2rem;
  width: 5rem;
  border-radius: 12px;
}

.skeleton-image {
  height: 180px;
  width: 100%;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.skeleton-line {
  height: 0.9rem;
  width: 100%;
}

.skeleton-line-short {
  width: 45%;
}

.skeleton-line-medium {
  width: 72%;
}

.narrative-error {
  color: #e94560;
  font-style: italic;
}

/* Leaflet popup override */
.leaflet-popup-content-wrapper {
  background: #16213e;
  color: #e0e0e0;
  border-radius: 8px;
}

.leaflet-popup-tip {
  background: #16213e;
}

.site-popup {
  min-width: 180px;
}

.site-popup h3 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.site-popup .popup-meta {
  font-size: 0.8rem;
  color: #aaa;
  margin-bottom: 0.4rem;
}

.site-popup button {
  background: #e94560;
  color: #fff;
  border: none;
  padding: 0.3rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
}

/* Cluster overrides */
.marker-cluster-small {
  background-color: rgba(233, 69, 96, 0.3) !important;
}
.marker-cluster-small div {
  background-color: rgba(233, 69, 96, 0.6) !important;
  color: #fff !important;
}
.marker-cluster-medium {
  background-color: rgba(233, 69, 96, 0.4) !important;
}
.marker-cluster-medium div {
  background-color: rgba(233, 69, 96, 0.7) !important;
  color: #fff !important;
}
.marker-cluster-large {
  background-color: rgba(233, 69, 96, 0.5) !important;
}
.marker-cluster-large div {
  background-color: rgba(233, 69, 96, 0.8) !important;
  color: #fff !important;
}
