/* =========================================================
   Base page styles
========================================================= */

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
}

body {
  background: #ffffff;
  color: #231f20;
  font-family: Arial, Helvetica, sans-serif;
  overflow-x: hidden;
}

.page {
  width: 100%;
  margin: 0;
  padding: 0;
}


/* =========================================================
   Introduction
========================================================= */

.intro {
  width: min(850px, calc(100% - 32px));
  margin: 0 0 18px;
}

.intro h2 {
  margin: 0;
  font-size: clamp(1rem, 2.5vw, 2rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.intro p {
  margin: 12px 0 0;
  max-width: 760px;
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  line-height: 1.5;
}


/* =========================================================
   Map container
========================================================= */

.map-shell {
  position: relative;
  width: 100%;
  height: min(720px, 80vh);
  min-height: 520px;
  overflow: hidden;
  border-top: 1px solid #d7d7d7;
  border-bottom: 1px solid #d7d7d7;
  border-right: 0;
  border-left: 0;
  border-radius: 0;
  background: #eef2f3;
}

#map {
  width: 100%;
  height: 100%;
}


/* =========================================================
   Legend
========================================================= */

.legend {
  position: absolute;
  z-index: 2;
  top: 16px;
  left: 16px;
  width: min(260px, calc(100% - 32px));
  padding: 13px 14px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(3px);
}

.legend h2 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  line-height: 1.2;
}

.legend-section + .legend-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(35, 31, 32, 0.18);
}

.legend-size-section h2 {
  margin-bottom: 12px;
}

.size-legend-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.size-legend-item {
  display: flex;
  align-items: center;
  min-height: 30px;
  gap: 10px;
}

.size-legend-symbol {
  flex: 0 0 auto;
  display: inline-block;
  border: 1.3px solid #ffffff;
  border-radius: 50%;
  background: #777777;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.32);
  opacity: 0.84;
}

.size-legend-label {
  font-size: 0.86rem;
  line-height: 1.2;
}

.legend-note {
  margin: 10px 0 0;
  color: #666666;
  font-size: 0.72rem;
  line-height: 1.35;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 8px;
  font-size: 0.86rem;
  line-height: 1.25;
}

.legend-dot {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border: 1px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
}


/* =========================================================
   Loading/status message
========================================================= */

.map-status {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  padding: 8px 12px;
  border-radius: 4px;
  background: rgba(35, 31, 32, 0.88);
  color: #ffffff;
  font-size: 0.82rem;
  white-space: nowrap;
}

.map-status.is-hidden {
  display: none;
}


/* =========================================================
   Popup
========================================================= */

.mapboxgl-popup {
  max-width: 330px !important;
}

.mapboxgl-popup-content {
  padding: 14px 16px;
  color: #231f20;
  font-size: 0.88rem;
  line-height: 1.4;
}

.popup-title {
  margin: 0 0 9px;
  font-size: 1rem;
  line-height: 1.25;
}

.popup-row {
  margin: 5px 0;
}

.popup-label {
  font-weight: 700;
}


/* =========================================================
   Mapbox controls
========================================================= */

.mapboxgl-ctrl-group {
  border-radius: 5px;
}


/* =========================================================
   Footer
========================================================= */

.map-footer {
  width: 100%;
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
}

.source-note {
  margin: 0;
  color: #666666;
  font-size: 0.78rem;
  line-height: 1.4;
  max-width: 75%;
}

.newsroom-logo {
  width: 100px;
  height: auto;
  display: block;
  flex-shrink: 0;
}


/* =========================================================
   Mobile adjustments
========================================================= */

@media (max-width: 700px) {
  .page {
    width: 100%;
    padding: 18px 0 0;
  }

  .intro {
    width: 100%;
    padding: 0 16px;
  }

  .map-shell {
    width: 100%;
    height: 72vh;
    min-height: 500px;
  }

  .legend {
    top: 10px;
    left: 10px;
    width: min(235px, calc(100% - 64px));
    padding: 11px 12px;
  }

  .map-status {
    max-width: calc(100% - 32px);
    white-space: normal;
    text-align: center;
  }

  .map-footer {
    padding-bottom: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .source-note {
    max-width: 100%;
    padding: 0;
  }

  .newsroom-logo {
    width: 90px;
    align-self: flex-end;
  }
}