:root {
  --ink: #1c1917;
  --paper: #faf7f0;
  --panel: #ffffff;
  --accent: #1e3a8a;
  --muted: #78716c;
  --border: #e7e0d3;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: Georgia, 'Times New Roman', serif;
  color: var(--ink);
  background: var(--paper);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--ink);
  color: var(--paper);
}

.header-inner h1 {
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: 0.02em;
}

.tagline {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  font-style: italic;
  color: #d6cdb8;
}

.panel-toggle {
  display: none;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.9rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

.side-panel {
  width: 320px;
  flex-shrink: 0;
  overflow-y: auto;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 1rem 1.1rem 2rem;
}

.panel-section {
  margin-bottom: 1.5rem;
}

.time-section {
  background: #f5f1e6;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem 0.9rem;
}

.time-section h2 { border-bottom-color: #b45309; }

.time-controls { font-family: -apple-system, 'Segoe UI', sans-serif; }

#time-slider {
  width: 100%;
  accent-color: #b45309;
  margin: 0.4rem 0 0.2rem;
  cursor: pointer;
}

.time-readout {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.3rem;
}

.time-year {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.time-era {
  font-size: 0.85rem;
  font-weight: 600;
  color: #b45309;
}

.time-desc {
  font-size: 0.82rem;
  line-height: 1.45;
  margin: 0.3rem 0;
  color: var(--ink);
}

.time-sources {
  font-size: 0.72rem;
  margin: 0.2rem 0 0;
  color: var(--muted);
}

.time-sources a { color: var(--accent); }

.panel-section h2 {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 0.5rem;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.3rem;
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
  margin: 0.4rem 0;
  font-family: -apple-system, 'Segoe UI', sans-serif;
}

.era-list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.era-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.3rem 0.4rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: -apple-system, 'Segoe UI', sans-serif;
  font-size: 0.85rem;
}

.era-row:hover { background: #f5f1e6; }

.era-row input { accent-color: var(--accent); }

.era-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.25);
}

.era-label { flex: 1; }

.era-count {
  color: var(--muted);
  font-size: 0.75rem;
}

.shading-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: -apple-system, 'Segoe UI', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  margin-bottom: 0.5rem;
}

.shading-toggle input { accent-color: var(--accent); }

.legend {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: -apple-system, 'Segoe UI', sans-serif;
  font-size: 0.8rem;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

.swatch {
  width: 22px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.3);
}

.map-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
}

#map {
  position: absolute;
  inset: 0;
}

.leaflet-popup-content { font-family: Georgia, serif; }

.popup-kind {
  display: inline-block;
  font-family: -apple-system, 'Segoe UI', sans-serif;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #ede9dc;
  border-radius: 4px;
  padding: 0.1rem 0.45rem;
  margin-bottom: 0.35rem;
}

.popup-title {
  font-size: 1.05rem;
  margin: 0 0 0.15rem;
}

.popup-era {
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
  margin: 0 0 0.45rem;
  font-family: -apple-system, 'Segoe UI', sans-serif;
}

.popup-summary {
  font-size: 0.88rem;
  line-height: 1.45;
  margin: 0 0 0.6rem;
}

.popup-wiki {
  font-family: -apple-system, 'Segoe UI', sans-serif;
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.popup-wiki:hover { text-decoration: underline; }

.app-footer {
  padding: 0.5rem 1.25rem;
  font-size: 0.72rem;
  color: var(--muted);
  font-family: -apple-system, 'Segoe UI', sans-serif;
  border-top: 1px solid var(--border);
  background: var(--paper);
}

.app-footer p { margin: 0; }

@media (max-width: 820px) {
  .layout { flex-direction: column; }

  .side-panel {
    width: 100%;
    max-height: 45vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .side-panel.collapsed { display: none; }

  .panel-toggle { display: block; }

  .map-wrap { min-height: 55vh; }
}

/* Beyond-the-map list (sites with no single mappable location) */
.offmap-list { display: flex; flex-direction: column; gap: 0.9rem; }

.offmap-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
  background: var(--paper);
}

.offmap-head { display: flex; align-items: center; gap: 0.5rem; }

.offmap-name { font-weight: 700; font-size: 0.9rem; }

.offmap-date {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0.25rem 0 0.4rem;
}

.offmap-summary {
  font-size: 0.82rem;
  line-height: 1.45;
  margin: 0 0 0.5rem;
}
