:root {
  --bg: #f3efe5;
  --bg-alt: #fffaf2;
  --panel: rgba(255, 250, 242, 0.9);
  --line: rgba(29, 66, 58, 0.14);
  --text: #1d423a;
  --muted: #4d665f;
  --accent: #0b8f72;
  --accent-2: #d86d3f;
  --accent-3: #f1b846;
  --shadow: 0 24px 60px rgba(29, 66, 58, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(216, 109, 63, 0.22), transparent 28%),
    radial-gradient(circle at bottom left, rgba(11, 143, 114, 0.18), transparent 24%),
    linear-gradient(180deg, #f9f2e8 0%, #f3efe5 52%, #ece7dd 100%);
}

.page-shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.hero,
.content-card,
.side-card,
.map-card {
  backdrop-filter: blur(10px);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero {
  border-radius: 30px;
  padding: 28px 30px;
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: 24px;
  align-items: start;
}

.hero h1,
.content-card h2,
.side-card h2 {
  margin: 0;
  font-family: "Fraunces", serif;
  line-height: 1.02;
}

.hero h1 {
  font-size: clamp(2.1rem, 4vw, 4.4rem);
  max-width: 12ch;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero-metrics,
.stats-stack {
  display: grid;
  gap: 12px;
}

.metric,
.mini-stat {
  border-radius: 18px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(29, 66, 58, 0.1);
}

.metric strong,
.mini-stat strong {
  display: block;
  font-size: 1.35rem;
  margin-top: 6px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}

.tab {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.tab:hover,
.tab.active {
  background: var(--accent);
  color: #fff;
  transform: translateY(-1px);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.panel-grid {
  display: grid;
  gap: 18px;
}

.map-grid {
  grid-template-columns: 320px 1fr;
}

.dual-grid {
  grid-template-columns: 1.2fr 0.85fr;
}

.side-card,
.content-card,
.map-card {
  border-radius: 28px;
  padding: 22px;
}

.map-card {
  padding: 0;
  overflow: hidden;
}

#map {
  height: 72vh;
  min-height: 560px;
}

label,
.inline-control {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.95rem;
  margin-top: 14px;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(29, 66, 58, 0.14);
  background: rgba(255, 255, 255, 0.92);
  padding: 12px 14px;
}

.primary-button {
  margin-top: 16px;
  border: none;
  border-radius: 14px;
  padding: 13px 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #0b6a72);
  cursor: pointer;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-head.compact {
  margin-bottom: 12px;
}

.section-head h2 {
  font-size: clamp(1.5rem, 2vw, 2.2rem);
}

.stacked-controls {
  display: grid;
  gap: 10px;
  min-width: 240px;
}

.compare-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.compare-controls select {
  min-width: 180px;
}

.table-wrap {
  max-height: 70vh;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(29, 66, 58, 0.08);
  font-size: 0.94rem;
}

th {
  position: sticky;
  top: 0;
  background: var(--bg-alt);
}

.map-note {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.leaflet-popup-content-wrapper {
  border-radius: 16px;
}

.popup-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.compact-card {
  align-self: start;
}

canvas {
  width: 100% !important;
  min-height: 280px;
}

@media (max-width: 1080px) {
  .hero,
  .map-grid,
  .dual-grid {
    grid-template-columns: 1fr;
  }

  #map {
    height: 60vh;
    min-height: 420px;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100vw - 20px, 100%);
    padding-top: 18px;
  }

  .hero,
  .side-card,
  .content-card {
    border-radius: 22px;
    padding: 18px;
  }

  .compare-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .stacked-controls {
    min-width: 0;
  }
}
