:root {
  --map-ink: #173d25;
  --map-muted: #5b6d63;
  --map-line: #dbe7dd;
  --map-paper: #f6faf7;
  --map-panel: #ffffff;
  --map-green: #16733b;
  --map-gold: #f2b825;
}

* {
  box-sizing: border-box;
}

body.cird-map-page {
  margin: 0;
  color: var(--map-ink);
  background: var(--map-paper);
}

.cird-map-page .content-wrapper {
  background: linear-gradient(180deg, #f7faf5 0%, #ffffff 42%, #edf4ee 100%);
}

.cird-map-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 520px);
  gap: 28px;
  align-items: end;
  max-width: 1220px;
  margin: 0 auto;
  padding: 62px 24px 34px;
}

.cird-map-hero span {
  display: block;
  margin-bottom: 10px;
  color: #8a6700;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.cird-map-hero h1 {
  margin: 0;
  color: var(--map-ink);
  font-family: "Roboto Slab", Georgia, serif;
  font-size: clamp(34px, 4vw, 58px);
  line-height: 1.04;
}

.cird-map-hero p {
  margin: 0;
  color: var(--map-muted);
  font-size: 17px;
  line-height: 1.65;
}

.cird-map-tool {
  display: grid;
  grid-template-columns: minmax(620px, 1fr) 320px;
  gap: 18px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px 72px;
}

.cird-map-tool.is-first {
  padding-top: 24px;
}

.map-panel,
.card {
  background: var(--map-panel);
  border: 1px solid var(--map-line);
  border-radius: 10px;
  box-shadow: 0 18px 42px rgba(17, 58, 35, .08);
}

.map-panel {
  min-height: 720px;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--map-line);
  background: #fbfdfb;
}

.topbar h2,
.card h2,
.details h3,
.topbar p {
  margin: 0;
}

.topbar h2 {
  color: var(--map-ink);
  font-family: "Roboto Slab", Georgia, serif;
  font-size: clamp(22px, 2vw, 30px);
  line-height: 1.1;
}

.topbar p,
.source-note,
.details p,
.review-list,
.detail-subtitle {
  color: var(--map-muted);
  font-size: 13px;
  line-height: 1.5;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.stat {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #d8e5db;
  border-radius: 999px;
  background: #edf6ef;
  padding: 7px 10px;
  color: var(--map-ink);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

#map {
  min-height: 620px;
  height: 100%;
  background: #dfecee;
}

.no-basemap-active #map {
  background: #ffffff;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  padding: 16px;
}

.card h2 {
  margin-bottom: 12px;
  color: var(--map-ink);
  font-size: 15px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}

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

.map-legend-list div {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  align-items: center;
  color: #2f4037;
  font-size: 13px;
  line-height: 1.35;
}

.legend-line,
.legend-fill,
.legend-office {
  display: inline-block;
}

.legend-line.provincial {
  width: 24px;
  height: 0;
  border-top: 2px solid #4f4739;
}

.legend-fill.working-area {
  width: 20px;
  height: 16px;
  border: 1px solid #4f4739;
  border-radius: 4px;
  background: linear-gradient(135deg, rgba(22,115,59,.18), rgba(242,184,37,.32));
}

.legend-office {
  width: 20px;
  height: 20px;
  border: 2px solid #9f352b;
  border-radius: 6px;
  background: #fff;
  box-shadow: inset 0 0 0 4px rgba(189,73,56,.16);
}

.legend {
  display: grid;
  gap: 8px;
}

.legend button {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--map-ink);
  padding: 7px;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.legend button:hover,
.legend button.active {
  border-color: rgba(22, 115, 59, .18);
  background: #edf6ef;
}

.swatch {
  width: 16px;
  height: 16px;
  border: 1px solid rgba(0, 0, 0, .22);
  border-radius: 4px;
}

.count {
  color: var(--map-muted);
  font-variant-numeric: tabular-nums;
}

.controls {
  display: grid;
  gap: 10px;
}

.controls label {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 14px;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--map-green);
}

button {
  border: 1px solid rgba(22, 115, 59, .22);
  border-radius: 8px;
  background: #ffffff;
  color: var(--map-ink);
  padding: 9px 11px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: #edf6ef;
}

.details h3 {
  margin-bottom: 4px;
  color: var(--map-ink);
  font-size: 18px;
}

.detail-subtitle {
  margin-bottom: 10px;
}

.record {
  padding: 10px 0;
  border-top: 1px solid #e3ece6;
  color: #2f4037;
  font-size: 13px;
}

.record strong {
  display: inline-block;
  min-width: 70px;
  color: var(--map-ink);
}

.review-list {
  margin: 0;
  padding-left: 18px;
  max-height: 180px;
  overflow: auto;
}

.source-note {
  padding: 0 4px 8px;
}

.project-notes {
  max-width: 1440px;
  margin: -36px auto 72px;
  padding: 0 24px;
}

.project-notes-intro {
  max-width: 920px;
  margin-bottom: 20px;
}

.project-notes-intro span {
  display: block;
  margin-bottom: 8px;
  color: #8a6700;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.project-notes-intro h2 {
  margin: 0 0 10px;
  color: var(--map-ink);
  font-family: "Roboto Slab", Georgia, serif;
  font-size: clamp(26px, 2.4vw, 38px);
  line-height: 1.12;
}

.project-notes-intro p {
  margin: 0;
  color: var(--map-muted);
  font-size: 15px;
  line-height: 1.65;
}

.project-note-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.project-note-grid article {
  min-height: 150px;
  padding: 18px;
  border: 1px solid var(--map-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 12px 28px rgba(17, 58, 35, .06);
}

.project-note-grid h3 {
  margin: 0 0 8px;
  color: var(--map-ink);
  font-size: 17px;
  font-weight: 900;
}

.project-note-grid p {
  margin: 0;
  color: #405248;
  font-size: 13px;
  line-height: 1.55;
}

.leaflet-popup-content {
  margin: 10px 12px;
  font-size: 13px;
}

.office-div-icon {
  background: transparent;
  border: 0;
}

.office-div-icon span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: #ffffff;
  border: 2px solid #9f352b;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(42, 35, 25, .28);
}

.office-div-icon svg {
  width: 22px;
  height: 22px;
  fill: #bd4938;
  stroke: #ffffff;
  stroke-width: .7;
}

.office-div-icon .office-lines {
  fill: none;
  stroke: #ffffff;
  stroke-width: 1.8;
  stroke-linecap: round;
}

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

  .cird-map-tool {
    padding: 0 18px 54px;
  }

  .project-notes {
    margin-top: -28px;
    padding: 0 18px;
  }

  .project-note-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cird-map-tool.is-first {
    padding-top: 18px;
  }

  .map-panel {
    min-height: 680px;
  }
}

@media (max-width: 760px) {
  .cird-map-hero {
    padding: 38px 18px 24px;
  }

  .topbar {
    flex-direction: column;
  }

  .stats {
    justify-content: flex-start;
  }

  .map-panel {
    min-height: 620px;
  }

  #map {
    min-height: 520px;
  }

  .project-note-grid {
    grid-template-columns: 1fr;
  }
}
