:root {
  --bg: #efe8dc;
  --ink: #1f2831;
  --muted: #5f6b72;
  --panel: rgba(255, 251, 245, 0.86);
  --line: rgba(31, 40, 49, 0.11);
  --teal: #0f766e;
  --teal-deep: #0a4f59;
  --amber: #bd7b14;
  --plum: #8e3f56;
  --sky: #2077a3;
  --shadow: 0 22px 60px rgba(66, 47, 24, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Manrope", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(32, 119, 163, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.16), transparent 32%),
    linear-gradient(180deg, #f7f1e7 0%, #eee3d2 100%);
}

body::before {
  position: fixed;
  inset: 0;
  content: "";
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.22) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.56), transparent 72%);
}

.page-shell {
  width: min(1500px, calc(100% - 32px));
  margin: 22px auto 36px;
}

.hero,
.filters-card,
.map-panel,
.list-panel,
.details-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 22px;
  padding: 28px 30px;
  border-radius: var(--radius-xl);
}

.eyebrow,
.panel-kicker,
.stat-label,
.mini-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.73rem;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 10px;
  color: var(--teal);
  font-weight: 700;
}

.hero h1,
.filters-card h2,
.map-panel h2,
.list-panel h2,
.details-panel h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  line-height: 0.95;
}

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

.hero-text,
.panel-note,
.rail-note,
.empty-state,
.detail-note,
.result-subtitle,
.detail-subtitle {
  color: var(--muted);
}

.hero-text {
  margin: 12px 0 0;
  max-width: 70ch;
  line-height: 1.6;
}

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

.stat-card {
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(31, 40, 49, 0.08);
}

.stat-card strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
}

.stat-label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
}

.stat-card.accent {
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.98), rgba(10, 79, 89, 0.96));
  color: #f5fbfa;
}

.stat-card.accent .stat-label {
  color: rgba(245, 251, 250, 0.78);
}

.filters-card,
.map-panel,
.list-panel,
.details-panel {
  border-radius: var(--radius-xl);
}

.filters-card {
  margin-top: 18px;
  padding: 20px 22px;
}

.filters-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(4, minmax(170px, 1fr));
  gap: 14px;
  align-items: end;
}

.filter-block {
  display: grid;
  gap: 8px;
}

.filter-block span,
.search-field span {
  font-size: 0.9rem;
  font-weight: 700;
}

.search-field input,
.filter-block select {
  width: 100%;
  min-width: 0;
  padding: 14px 15px;
  border-radius: 14px;
  border: 1px solid rgba(31, 40, 49, 0.12);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font: inherit;
}

.search-field input:focus,
.filter-block select:focus {
  outline: 2px solid rgba(32, 119, 163, 0.22);
  border-color: rgba(32, 119, 163, 0.52);
}

.chip-row,
.legend,
.badge-row,
.link-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-chip,
.legend-item,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid rgba(31, 40, 49, 0.1);
  background: rgba(255, 255, 255, 0.74);
}

.filter-chip {
  padding: 10px 14px;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.filter-chip.is-active {
  background: rgba(15, 118, 110, 0.14);
  border-color: rgba(15, 118, 110, 0.36);
  color: var(--teal-deep);
}

.legend-item,
.badge {
  padding: 8px 12px;
  font-size: 0.88rem;
}

.badge.type-school {
  background: rgba(32, 119, 163, 0.12);
  color: #145272;
}

.badge.type-nursery {
  background: rgba(189, 123, 20, 0.14);
  color: #7b500d;
}

.badge.type-nursery-school {
  background: rgba(142, 63, 86, 0.12);
  color: #6b2e40;
}

.filters-actions,
.panel-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.filters-actions {
  margin-top: 16px;
  align-items: center;
}

.reset-button,
.link-button {
  border: 0;
  border-radius: 999px;
  padding: 11px 15px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.reset-button {
  background: var(--teal-deep);
  color: #f8fbfb;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.78fr) minmax(320px, 0.9fr);
  gap: 20px;
  margin-top: 20px;
  align-items: start;
}

.map-panel,
.list-panel,
.details-panel {
  padding: 22px;
}

#map {
  height: 760px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(31, 40, 49, 0.08);
}

.legend {
  margin-top: 14px;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.swatch-school {
  background: var(--sky);
}

.swatch-nursery {
  background: var(--amber);
}

.results-list {
  display: grid;
  gap: 12px;
  max-height: 860px;
  overflow: auto;
  padding-right: 4px;
}

.result-card {
  width: 100%;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(31, 40, 49, 0.08);
  background: rgba(255, 255, 255, 0.7);
  text-align: left;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.result-card:hover,
.result-card:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(15, 118, 110, 0.34);
  box-shadow: 0 16px 32px rgba(31, 40, 49, 0.08);
  outline: none;
}

.result-card.is-active {
  border-color: rgba(15, 118, 110, 0.48);
  background: linear-gradient(180deg, rgba(15, 118, 110, 0.1), rgba(255, 255, 255, 0.78));
}

.result-title,
.details-title,
.popup-title {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

.result-title {
  font-size: 1.1rem;
}

.result-subtitle,
.detail-subtitle {
  margin: 6px 0 0;
  font-size: 0.92rem;
}

.mini-label {
  color: var(--muted);
}

.result-meta {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.92rem;
  color: var(--ink);
}

.details-content {
  display: grid;
  gap: 16px;
}

.details-panel {
  position: sticky;
  top: 16px;
}

.details-card {
  display: grid;
  gap: 16px;
}

.details-title {
  font-size: 1.65rem;
}

.facts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.fact-box {
  padding: 12px 13px;
  border-radius: 16px;
  border: 1px solid rgba(31, 40, 49, 0.08);
  background: rgba(255, 255, 255, 0.68);
}

.fact-box strong {
  display: block;
  margin-top: 4px;
  font-size: 1rem;
}

.detail-section {
  display: grid;
  gap: 10px;
}

.detail-section h3 {
  margin: 0;
  font-size: 0.98rem;
}

.detail-list {
  display: grid;
  gap: 10px;
}

.detail-row {
  display: grid;
  gap: 3px;
}

.detail-row span:first-child {
  color: var(--muted);
  font-size: 0.83rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(32, 119, 163, 0.1);
  color: #155777;
  text-decoration: none;
}

.empty-state {
  padding: 28px 18px;
  border-radius: 18px;
  border: 1px dashed rgba(31, 40, 49, 0.18);
  background: rgba(255, 255, 255, 0.44);
  line-height: 1.6;
}

.school-marker {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 6px 18px rgba(31, 40, 49, 0.22);
}

.school-marker.type-school {
  background: var(--sky);
}

.school-marker.type-nursery {
  background: var(--amber);
}

.school-marker.type-nursery-school {
  background: var(--plum);
}

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

.leaflet-popup-content {
  margin: 14px 16px;
}

.popup-title {
  font-size: 1rem;
}

.popup-text {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

@media (max-width: 1200px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .details-panel {
    position: static;
  }

  .filters-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    max-width: none;
  }

  .filters-grid {
    grid-template-columns: 1fr;
  }

  #map {
    height: 520px;
  }

  .facts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 100%);
    margin: 10px auto 24px;
  }

  .hero,
  .map-panel,
  .filters-card,
  .list-panel,
  .details-panel {
    padding: 18px;
    border-radius: 22px;
  }

  .hero h1 {
    font-size: clamp(2.2rem, 12vw, 3.6rem);
  }

  #map {
    height: 420px;
    border-radius: 18px;
  }

  .filters-actions {
    flex-direction: column;
    align-items: flex-start;
  }
}
