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

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --border: #2e2e2e;
  --text: #e8e8e8;
  --text-muted: #888888;
  --accent: #4a90d9;
  --changed: #e8521a;
  --font: 'Georgia', serif;
  --mono: 'Menlo', 'Monaco', monospace;
  --max-w: 1200px;
}

html { scroll-behavior: smooth; }

.site-logo-corner {
  display: block;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1rem 2.5rem 0;
}

.site-logo-corner img {
  display: block;
  width: 45px;
  height: auto;
}

@media (min-width: 900px) {
  .site-logo-corner img {
    width: 65px;
  }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
}


/* ── 1. Intro split ───────────────────────────────────────────────── */

.intro-split {
  display: flex;
  align-items: center;
  gap: 4rem;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1rem 2.5rem 4rem 2.5rem;
  min-height: 60vh;
}

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

.intro-text h1 {
  font-size: 2rem;
  font-weight: normal;
  letter-spacing: 0.01em;
  line-height: 1.25;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.intro-subtitle {
  font-size: 1rem;
  font-weight: normal;
  color: var(--text);
  line-height: 1.6;
  letter-spacing: 0.01em;
}

.intro-map-col {
  flex: 0 0 500px;
  max-width: 500px;
}


/* ── 2. Scroll split ──────────────────────────────────────────────── */

.scroll-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  column-gap: 3rem;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2.5rem;
  align-items: start;
}

.scroll-text {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  padding-top: 3rem;
  padding-bottom: 3rem;
}

.scroll-text h2 {
  font-size: 1.3rem;
  font-weight: normal;
  color: var(--text);
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  letter-spacing: 0.01em;
}

.scroll-text h2:first-child { margin-top: 0; }

.scroll-text p {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 1rem;
}

.scroll-text em { font-style: italic; color: var(--text); }

.year-list {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  line-height: 1.9;
  padding: 0.5rem 0;
}

.scroll-map-col {
  grid-column: 2;
  grid-row: 1 / 3;  /* span article text and about rows */
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.map-controls {
  flex-shrink: 0;
  padding-bottom: 0.75rem;
}

.scroll-map-col .map-container {
  flex: 1;
  min-height: 0;
}

.scroll-map-col .map {
  height: 100%;
}


/* ── 3. About section ─────────────────────────────────────────────── */

.about-section {
  border-top: 1px solid var(--border);
  padding: 4rem 2.5rem;
}

.about-section {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  padding-bottom: 4rem;
}

.about-content {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.about-logo {
  display: block;
  max-width: 160px;
  height: auto;
  margin-bottom: 1.5rem;
}

.about-content p {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 1rem;
}

.about-content h3 {
  font-size: 1rem;
  font-weight: normal;
  color: var(--text);
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

.about-content ul {
  list-style: none;
  padding: 0;
}

.about-content ul li {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.8;
  padding-left: 1rem;
  position: relative;
}

.about-content ul li::before {
  content: '–';
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

.about-link {
  color: var(--accent);
  text-decoration: none;
}

.about-link:hover { text-decoration: underline; }


/* ── Slider map components ────────────────────────────────────────── */

.ward-img-wrap {
  position: relative;
  display: block;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

#ward-img {
  display: block;
  width: 100%;
  height: auto;
}

.slider-legend {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 0.5rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
  font-size: 1rem;
}

.slider-legend .swatch {
  width: 16px;
  height: 16px;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.year-display {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  min-width: 2.5rem;
}

#year-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 2px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

#year-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #b2e2dd;
  cursor: pointer;
  transition: background 0.15s;
}

#year-slider::-webkit-slider-thumb:hover { background: #cceae7; }


/* ── Interactive map components ───────────────────────────────────── */

.map-container {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.map {
  width: 100%;
  height: 560px;
}

.ward-year-select {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.ward-year-select select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  outline: none;
}

.ward-year-select select:focus { border-color: var(--accent); }

.search-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  margin-bottom: 0;
}

#address-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  outline: none;
  transition: border-color 0.15s;
}

#address-input:focus { border-color: var(--accent); }
#address-input::placeholder { color: var(--text-muted); }

#search-btn {
  background: var(--accent);
  border: none;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  transition: background 0.15s;
  white-space: nowrap;
}

#search-btn:hover { background: #6aaee8; }

.search-error {
  color: var(--changed);
  font-family: var(--mono);
  font-size: 0.8rem;
}

.map-legend {
  position: absolute;
  bottom: 1.5rem;
  right: 1rem;
  background: rgba(15,15,15,0.92);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.75rem 1rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  min-width: 180px;
}

.legend-title {
  color: var(--text);
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend-line {
  display: inline-block;
  width: 20px;
  height: 2px;
  background: #cccccc;
  flex-shrink: 0;
  align-self: center;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15,15,15,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  pointer-events: none;
  transition: opacity 0.3s;
}

.loading-overlay.hidden { opacity: 0; }

.hex-tooltip {
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.7;
  color: var(--text);
}

.hex-tooltip strong {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--accent);
  font-size: 0.8rem;
}

.hex-tooltip .ward-segment { color: var(--text-muted); }
.hex-tooltip .ward-segment span { color: var(--text); }

.maplibregl-popup-content {
  background: rgba(20,20,20,0.97) !important;
  border: 1px solid var(--border) !important;
  border-radius: 5px !important;
  padding: 0.65rem 0.85rem !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5) !important;
}

.maplibregl-popup-tip { display: none; }


/* ── Mobile ───────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .intro-split {
    flex-direction: column;
    gap: 2rem;
    padding: 2.5rem 1.5rem;
    min-height: unset;
  }

  .intro-text h1 {
    text-align: center;
  }

  .intro-map-col {
    flex: none;
    width: 100%;
    max-width: 500px;
    align-self: center;
  }

  .scroll-split {
    display: flex;
    flex-direction: column;
    padding: 0 1.5rem;
    gap: 0;
  }

  .scroll-text {
    order: 1;
    padding-bottom: 2.5rem;
  }

  .scroll-map-col {
    order: 2;
    position: static;
    height: 70vh;
    width: 100%;
    padding-top: 0;
  }

  .scroll-map-col .map {
    height: 100%;
  }

  .about-section {
    order: 3;
    padding-bottom: 3rem;
  }
}
