/* sts-map.css — scoped styles for the embeddable Save the Sand map component.
   All rules are namespaced to .sts-map so they can be dropped into any page
   without polluting host styles. */

.sts-map {
  display: block;
  width: 100%;
  font-family: "DM Sans", sans-serif;
  color: #1C2B1A;
  line-height: 1.5;
}

/* ---------- Stats band ---------- */
.sts-map-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: #3D5C38;
  margin: 0 0 0;
}
.sts-map-stat {
  background: #2D4429;
  color: rgba(250, 250, 247, 0.88);
  padding: 26px 22px;
}
.sts-map-stat-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: #C4A35A;
  margin-bottom: 12px;
}
.sts-map-stat-value {
  font-family: "Cormorant Garamond", serif;
  font-weight: 300;
  font-size: 40px;
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  color: rgba(250, 250, 247, 0.95);
}
.sts-map-stat-unit {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: rgba(250, 250, 247, 0.55);
}

/* ---------- Map canvas ---------- */
.sts-map-canvas-wrap {
  position: relative;
  width: 100%;
  background: #F2EDE4;
}
.sts-map-canvas {
  width: 100%;
  height: 100%;
  min-height: 360px;
}

/* ---------- In-view live stats bar (bottom of canvas) ---------- */
.sts-map-inview {
  position: absolute;
  left: 18px;
  bottom: 36px;
  z-index: 2;
  background: rgba(28, 43, 26, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: rgba(250, 250, 247, 0.88);
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.04em;
  border: 1px solid rgba(196, 163, 90, 0.30);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 4px;
  align-items: baseline;
  max-width: calc(100% - 36px);
  transition: opacity 0.2s ease;
}
.sts-map-inview-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #C4A35A;
  margin-right: 4px;
}
.sts-map-inview-val {
  font-weight: 500;
  color: #FAFAF7;
}
.sts-map-inview-empty {
  font-style: italic;
  color: rgba(250, 250, 247, 0.45);
}

/* ---------- Layer controls (top-left overlay) ---------- */
.sts-map-controls {
  position: absolute;
  top: 18px;
  left: 18px;
  background: rgba(250, 250, 247, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 16px 20px;
  border: 1px solid #B8A88A;
  box-shadow: 0 4px 18px rgba(28, 43, 26, 0.10);
  max-width: 240px;
  z-index: 2;
}
.sts-map-controls h4 {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: #C4A35A;
  margin: 0 0 12px 0;
}
.sts-map-jumpto {
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(184, 168, 138, 0.40);
}
.sts-map-jumpto select {
  width: 100%;
  font-family: "DM Sans", sans-serif;
  font-size: 12px;
  color: #1C2B1A;
  background: #FAFAF7;
  border: 1px solid rgba(184, 168, 138, 0.60);
  padding: 7px 10px;
  cursor: pointer;
  letter-spacing: 0.02em;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%231C2B1A' stroke-width='1.4' fill='none'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}
.sts-map-jumpto select:focus {
  outline: none;
  border-color: #C4A35A;
  box-shadow: 0 0 0 2px rgba(196, 163, 90, 0.20);
}
.sts-map-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  font-size: 13px;
  color: #1C2B1A;
  cursor: pointer;
  border-bottom: 1px solid rgba(184, 168, 138, 0.30);
}
.sts-map-toggle:last-child {
  border-bottom: none;
}
.sts-map-toggle input[type=checkbox] {
  cursor: pointer;
  accent-color: #1C2B1A;
  margin: 0;
}
.sts-map-swatch {
  width: 14px;
  height: 14px;
  display: inline-block;
  border: 1px solid rgba(28, 43, 26, 0.30);
  flex-shrink: 0;
}
.sts-map-swatch--catchment { background: transparent; border: 3px solid #1C2B1A; }
.sts-map-swatch--river { background: #3D7BA8; border-top: 2px solid #2A5A82; height: 4px; align-self: center; border-left: none; border-right: none; border-bottom: none; }
.sts-map-swatch--ta { background: rgba(45, 68, 41, 0.18); border: 1.5px solid #2D4429; }
.sts-map-swatch--phase { background: rgba(196, 163, 90, 0.65); }
.sts-map-swatch--phase1 { background: rgba(196, 163, 90, 0.65); } /* legacy */
.sts-map-swatch--nursery { background: #C4A35A; border: 1.5px solid #1C2B1A; border-radius: 50%; }
.sts-map-swatch--lc { background: #E91E89; border: 1.5px solid #FAFAF7; box-shadow: 0 0 0 0.5px rgba(28,43,26,0.4); border-radius: 50%; }

.sts-map-toggle-meta {
  color: #7A8C78;
  font-style: italic;
  font-size: 11px;
}

/* ---------- TA grouped controls ---------- */
.sts-map-group {
  border-bottom: 1px solid rgba(184, 168, 138, 0.30);
  padding-bottom: 4px;
  margin-bottom: 4px;
}
.sts-map-group:last-child {
  border-bottom: none;
}
.sts-map-toggle--master {
  border-bottom: none;
  font-weight: 500;
}
.sts-map-subgroup {
  margin-left: 24px;
  padding-left: 12px;
  border-left: 1px solid rgba(184, 168, 138, 0.45);
}
.sts-map-toggle--sub {
  padding: 4px 0;
  font-size: 12px;
  color: #4A5C48;
  border-bottom: none;
}
.sts-map-toggle--sub input[type=checkbox] {
  width: 12px;
  height: 12px;
}

/* ---------- Popups ---------- */
.sts-map-popup .maplibregl-popup-content {
  font-family: "DM Sans", sans-serif;
  background: #FAFAF7;
  border: 1px solid #B8A88A;
  border-radius: 0;
  padding: 16px 20px;
  box-shadow: 0 6px 22px rgba(28, 43, 26, 0.18);
}
.sts-map-popup .maplibregl-popup-tip {
  display: none;
}
.sts-map-popup .maplibregl-popup-close-button {
  font-size: 18px;
  color: #4A5C48;
  padding: 4px 8px;
}
.sts-map-popup-kicker {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: #C4A35A;
  margin-bottom: 8px;
}
.sts-map-popup-title {
  font-family: "Cormorant Garamond", serif;
  font-weight: 400;
  font-size: 20px;
  color: #1C2B1A;
  margin-bottom: 4px;
  line-height: 1.2;
}
.sts-map-popup-meta {
  font-size: 12px;
  color: #4A5C48;
  letter-spacing: 0.04em;
  margin-top: 4px;
}
.sts-map-popup-stats {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(184, 168, 138, 0.30);
  font-size: 12px;
  color: #4A5C48;
  letter-spacing: 0.03em;
  display: grid;
  gap: 4px;
}
.sts-map-popup-stat-val {
  font-weight: 500;
  color: #1C2B1A;
}
.sts-map-popup-stat-unit {
  color: #7A8C78;
}
.sts-map-popup-pending {
  color: #BA7517;
}
.sts-map-popup-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  background: rgba(233, 30, 137, 0.10);
  border: 1px solid rgba(233, 30, 137, 0.30);
  color: #B91464;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.sts-map-popup-outcome {
  margin-top: 10px;
  padding: 8px 10px;
  background: rgba(196, 163, 90, 0.08);
  border-left: 2px solid #C4A35A;
  font-size: 12px;
  color: #1C2B1A;
  line-height: 1.5;
}
.sts-map-popup-desc {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(184, 168, 138, 0.30);
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 14px;
  color: #4A5C48;
  line-height: 1.45;
}
.sts-map-popup-link {
  margin-top: 10px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.sts-map-popup-link a {
  color: #C4A35A;
  text-decoration: none;
  border-bottom: 1px solid rgba(196, 163, 90, 0.4);
  padding-bottom: 2px;
}
.sts-map-popup-link a:hover {
  color: #1C2B1A;
  border-bottom-color: #1C2B1A;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .sts-map-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .sts-map-stat-value {
    font-size: 32px;
  }
  .sts-map-controls {
    top: 12px;
    left: 12px;
    right: 12px;
    max-width: none;
    padding: 12px 14px;
  }
  .sts-map-inview {
    left: 12px;
    right: 12px;
    bottom: 28px;
    font-size: 11px;
    max-width: none;
    padding: 7px 12px;
  }
}
