/* ============================================================
   RESET
============================================================ */

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

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

html {
  overflow-x: hidden;
}

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


/* ============================================================
   PAGE STRUCTURE
============================================================ */

.page {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}


/* ============================================================
   TITLE AND SUBTITLE
============================================================ */

.intro {
  width: 100%;
  margin: 0;
  padding: 5px 20px 22px;
}

h1 {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  color: #17251f;
  font-size: clamp(1rem, 2.5vw, 2.8rem);
  font-weight: 750;
  letter-spacing: -0.04em;
  line-height: 1.02;
}

.subtitle {
  width: 100%;
  max-width: none;
  margin: 16px 0 0;
  padding: 0;
  color: #53615c;
  font-size: clamp(1rem, 1.8vw, 1.18rem);
  line-height: 1.55;
}


/* ============================================================
   CONTROLS
============================================================ */

.controls {
  width: 100%;
  margin: 0;
  padding: 0 20px 14px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 14px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-group label {
  color: #34413c;
  font-size: 0.82rem;
  font-weight: 700;
}

.control-group select {
  min-width: 220px;
  min-height: 42px;
  padding: 9px 36px 9px 12px;
  border: 1px solid #adb9b4;
  border-radius: 4px;
  background: #ffffff;
  color: #1f2933;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
}

.control-group select:focus {
  outline: 3px solid rgba(46, 125, 98, 0.25);
  outline-offset: 2px;
}


/* ============================================================
   FULL-WIDTH MAP
============================================================ */

.map-wrapper {
  position: relative;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

#map {
  display: block;
  width: 100%;

  /*
    JavaScript updates this variable according to the
    available viewport height.
  */
  height: var(--map-height, 600px);

  min-height: 360px;
  margin: 0;
  padding: 0;
  border-top: 1px solid #d9e0dd;
  border-bottom: 1px solid #d9e0dd;
}

#map .mapboxgl-canvas-container,
#map .mapboxgl-canvas {
  width: 100% !important;
  height: 100% !important;
}


/* ============================================================
   LEGEND
============================================================ */

.legend {
  position: absolute;
  z-index: 2;
  top: 18px;
  left: 18px;
  width: 220px;
  padding: 15px;
  border: 1px solid rgba(68, 84, 77, 0.2);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 3px 14px rgba(21, 35, 29, 0.15);
}

.legend-section + .legend-section {
  margin-top: 17px;
  padding-top: 15px;
  border-top: 1px solid #dce3e0;
}

.legend h2 {
  margin: 0 0 10px;
  color: #24352e;
  font-size: 0.83rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-transform: uppercase;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 8px;
  color: #3b4944;
  font-size: 0.82rem;
  line-height: 1.3;
}

.legend-color {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  border: 1px solid rgba(0, 0, 0, 0.35);
  border-radius: 50%;
}

.legend-color.crop-production {
  background: #2e8b57;
}

.legend-color.greenhouse {
  background: #006400;
}

.legend-color.grazing {
  background: #8b5a2b;
}

.legend-color.habitat {
  background: #7FC0FA;
}


/* ============================================================
   SIZE LEGEND
============================================================ */

.size-legend {
  padding-bottom: 3px;
}

.size-legend-row {
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #3b4944;
  font-size: 0.8rem;
}

.size-symbol {
  flex: 0 0 auto;
  border: 1.5px solid #34413c;
  border-radius: 50%;
  background: rgba(98, 137, 122, 0.28);
}

.size-symbol-small {
  width: 8px;
  height: 8px;
  margin-left: 8px;
  margin-right: 8px;
}

.size-symbol-medium {
  width: 16px;
  height: 16px;
  margin-left: 4px;
  margin-right: 4px;
}

.size-symbol-large {
  width: 25px;
  height: 25px;
}


/* ============================================================
   PROJECT COUNT
============================================================ */

.project-count {
  position: absolute;
  z-index: 2;
  right: 18px;
  bottom: 28px;
  padding: 9px 12px;
  border: 1px solid rgba(68, 84, 77, 0.2);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 3px 14px rgba(21, 35, 29, 0.12);
  color: #30433b;
  font-size: 0.82rem;
  font-weight: 700;
}


/* ============================================================
   MAPBOX POPUP
============================================================ */

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

.mapboxgl-popup-content {
  padding: 0;
  border-radius: 5px;
  box-shadow: 0 5px 22px rgba(18, 30, 25, 0.25);
}

.popup {
  min-width: 260px;
}

.popup-header {
  padding: 14px 16px 12px;
  border-bottom: 1px solid #dfe5e2;
  background: #f7f9f8;
}

.popup-activity {
  display: inline-block;
  margin-bottom: 6px;
  color: #527064;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
}

.popup h3 {
  margin: 0;
  color: #18251f;
  font-size: 1.08rem;
  line-height: 1.25;
}

.popup-body {
  padding: 12px 16px 15px;
}

.popup-row {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid #edf0ee;
  font-size: 0.78rem;
  line-height: 1.35;
}

.popup-row:last-child {
  border-bottom: 0;
}

.popup-label {
  color: #617069;
  font-weight: 700;
}

.popup-value {
  color: #25352f;
  overflow-wrap: anywhere;
}

.location-note {
  margin: 10px 0 0;
  color: #738079;
  font-size: 0.7rem;
  font-style: italic;
  line-height: 1.35;
}


/* ============================================================
   MAPBOX CONTROLS
============================================================ */

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

.mapboxgl-ctrl-attrib {
  font-size: 10px;
}


/* ============================================================
   FOOTER
============================================================ */

.footer {
  position: relative;
  z-index: 1;
  width: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: #ffffff;
}

.footer-left {
  min-width: 0;
  flex: 1 1 auto;
}

.footer-left p {
  margin: 0;
  color: #6c7974;
  font-size: 0.75rem;
  line-height: 1.45;
}

.footer-right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.vcij-logo {
  display: block;
  width: 100px;
  max-width: 100%;
  height: auto;
}


/* ============================================================
   TABLET AND MOBILE
============================================================ */

@media (max-width: 700px) {
  .intro {
    width: 100%;
    padding: 24px 14px 18px;
  }

  h1 {
    width: 100%;
    max-width: none;
  }

  .subtitle {
    width: 100%;
    max-width: none;
    margin-top: 12px;
  }

  .controls {
    width: 100%;
    margin: 0;
    padding: 0 2px 5px;
    align-items: stretch;
  }

  .control-group {
    width: 100%;
    flex: 1 1 auto;
  }

  .control-group select {
    width: 100%;
    min-width: 0;
  }

  #map {
    min-height: 420px;
  }

  .legend {
    top: 10px;
    left: 10px;
    width: 190px;
    padding: 12px;
  }

  .legend-section + .legend-section {
    margin-top: 12px;
    padding-top: 12px;
  }

  .project-count {
    right: 10px;
    bottom: 30px;
  }

  .footer {
    padding: 12px 14px 16px;
    gap: 16px;
  }

  .vcij-logo {
    width: 90px;
  }
}


/* ============================================================
   SMALL MOBILE
============================================================ */

@media (max-width: 480px) {
  .intro {
    padding-right: 12px;
  }

  .controls {
    padding-right: 12px;
    padding-left: 12px;
    flex-direction: column;
  }

  #map {
    min-height: 400px;
  }

  .legend {
    width: 178px;
  }

  .legend-item,
  .size-legend-row {
    font-size: 0.75rem;
  }

  .project-count {
    max-width: 160px;
    text-align: center;
  }

  .footer {
    padding: 12px;
    align-items: flex-end;
    gap: 10px;
  }

  .footer-left p {
    font-size: 0.7rem;
  }

  .vcij-logo {
    width: 78px;
  }
}