:root {
  --ink: #080808;
  --surface: #101010;
  --line: #222;
  --paper: #ece8e0;
  --muted: #8a8278;
  --gold: #c4a052;
  --gold-soft: #dbc07a;
  --church: #c4a052;
  --mosque: #5b8def;
  --font-heading: "Newsreader", ui-serif, Georgia, serif;
  --font-body: "Source Sans 3", ui-sans-serif, system-ui, sans-serif;
  --top-h: auto;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  background: var(--ink);
  color: var(--paper);
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.kicker {
  margin: 0 0 0.2rem;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.top {
  z-index: 1000;
  display: grid;
  gap: 1rem;
  padding: 0.9rem 1rem 1rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #0c0c0c, #090909);
}

@media (min-width: 960px) {
  .top {
    grid-template-columns: minmax(12rem, 1fr) minmax(20rem, 2.2fr) minmax(12rem, 1fr);
    align-items: end;
    gap: 1.25rem;
    padding: 1rem 1.5rem 1.15rem;
  }
}

.top__brand h1 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.score {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 0.65rem;
  align-items: center;
  min-width: 0;
}

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

.score__side--mosque {
  text-align: right;
}

.score__label {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.score__num {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.score__side--church .score__num {
  color: var(--church);
}

.score__side--mosque .score__num {
  color: var(--mosque);
}

.score__mid {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: center;
  text-align: center;
}

.score__status {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: var(--paper);
}

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

.score__bar {
  display: flex;
  width: 100%;
  height: 0.55rem;
  overflow: hidden;
  border-radius: 999px;
  background: #1a1a1a;
}

.score__fill {
  height: 100%;
}

.score__fill--church {
  background: var(--church);
}

.score__fill--mosque {
  background: var(--mosque);
}

.top__search input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: var(--paper);
  font: inherit;
}

.top__search input:focus {
  outline: 1px solid var(--gold);
  border-color: var(--gold);
}

.growth {
  margin: 0.45rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

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

#map {
  width: 100%;
  height: 100%;
  background: #0a0a0a;
}

.panel {
  position: absolute;
  z-index: 1100;
  top: 1rem;
  right: 1rem;
  width: min(20rem, calc(100% - 2rem));
  padding: 1.1rem 1.15rem 1.2rem;
  border: 1px solid var(--line);
  background: rgba(12, 12, 12, 0.94);
  backdrop-filter: blur(8px);
}

.panel[hidden] {
  display: none;
}

.panel__close {
  position: absolute;
  top: 0.35rem;
  right: 0.5rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.panel h2 {
  margin: 0 1.5rem 0.85rem 0;
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 500;
}

.stats {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem 1rem;
  margin: 0;
}

.stats dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.stats dd {
  margin: 0;
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stats dd.church {
  color: var(--church);
}

.stats dd.mosque {
  color: var(--mosque);
}

.foot {
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--muted);
}

.foot a {
  color: var(--gold);
}

.sources {
  margin-top: 0.5rem;
  max-width: 56rem;
  line-height: 1.5;
}

.sources p {
  margin: 0.35rem 0;
}

/* Leaflet dark tweaks */
.leaflet-container {
  background: #0a0a0a;
  font: inherit;
}

.leaflet-control-attribution {
  background: rgba(0, 0, 0, 0.65) !important;
  color: #777 !important;
  max-width: 60%;
}

.leaflet-control-attribution a {
  color: #999 !important;
}

.state-icon {
  display: flex;
  gap: 0.2rem;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55rem;
  height: 1.55rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  color: #080808;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.badge--church {
  background: var(--church);
}

.badge--mosque {
  background: var(--mosque);
  color: #fff;
}

.state-label {
  padding: 0.15rem 0.35rem;
  border-radius: 2px;
  background: rgba(8, 8, 8, 0.75);
  color: var(--paper);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none;
}
