/* ---------- Theme variables ---------- */
:root{
  --brand: #007D1C;
  --brand-dark: #006316;
  --brand-light: #19a13a;

  --bg: #f6f7f8;
  --text: #1f2937;

  --header-h: 52px;
  --footer-h: 40px;

  --card: #ffffff;
  --shadow: 0 6px 16px rgba(0,0,0,0.12);
  --soft-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* System fonts for crisp UI */
html, body{
  margin:0; padding:0;
  height:100%;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: var(--bg);
}

/* ---------- Header ---------- */
#header{
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 1px rgba(0,0,0,0.2);
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  box-shadow: var(--shadow);
  z-index: 1000;
}

#header p{ margin:0; font-size: 1.05rem; }

/* ---------- Map ---------- */
#map{
  position: absolute;
  top: var(--header-h);
  left: 0; right: 0;
  bottom: var(--footer-h);
  background: #eef2f7;
}

/* Make Leaflet tiles & controls feel a bit crisper */
.leaflet-container{
  font: 14px/1.3 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* ---------- Footer ---------- */
#footer{
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--footer-h);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 100%);
  box-shadow: 0 -4px 12px rgba(0,0,0,0.12);
  font-size: 12.5px;
  padding: 0 10px;
  z-index: 1000;
}

#footer p{ margin:0; }

/* ---------- Terrain shading + toggle ---------- */
/* Exaggerate hillshade appearance over basemap */
.leaflet-tile.hillshade-tiles{
  mix-blend-mode: multiply;
  filter: contrast(1.3) brightness(0.95) saturate(0.85);
}

.terrain-toggle a{
  width: 34px; height: 34px; line-height: 34px; text-align: center;
  font-size: 16px; font-weight: 700;
}
.terrain-toggle a.active{
  background: var(--brand);
  color: #fff;
}

/* Tint toggle button styling */
.tint-toggle a{
  width: 34px; height: 34px; line-height: 34px; text-align: center;
  font-size: 16px; font-weight: 700;
}
.tint-toggle a.active{
  background: var(--brand);
  color: #fff;
}

/* ---------- Legend (bottom-right, minimizable) ---------- */
.map-legend{
  background: #fff;
  color: var(--text);
  border-radius: 6px;
  box-shadow: var(--soft-shadow);
  overflow: hidden;
  margin-bottom: 6px; /* keep a gap above the minimap */
  min-width: 180px;
}
.map-legend .legend-title{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  border: 0;
  background: #f3f4f6;
  color: var(--text);
  font: 600 13px/1.2 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  padding: 6px 8px;
  cursor: pointer;
}
.map-legend .legend-title:focus{ outline: 2px solid var(--brand-light); outline-offset: 1px; }
.map-legend .legend-title .legend-toggle{ font-size: 16px; line-height: 1; }
.map-legend .legend-body{ padding: 6px 8px; }
.map-legend.minimized .legend-body{ display: none; }
.map-legend .legend-row{ display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.map-legend .legend-text{ font-size: 12.5px; }
.map-legend .swatch{ display: inline-block; width: 18px; height: 14px; border-radius: 3px; border: 2px solid rgba(0,0,0,0.2); box-sizing: border-box; }
.map-legend .swatch-point{ width: 12px; height: 12px; border-radius: 50%; border: 2px solid rgba(0,0,0,0.15); }
.map-legend .swatch-line{ height: 4px; border-radius: 2px; border: 0; }
.map-legend .swatch-line.multi{ background: linear-gradient(90deg, #e11d48 0%, #f59e0b 25%, #10b981 50%, #3b82f6 75%, #8b5cf6 100%); }

/* Small, tidy coordinate popup */
.coord-popup .leaflet-popup-content-wrapper{ padding: 2px 4px; }
.coord-popup .leaflet-popup-content{
  margin: 4px 6px;
  font-size: 12.5px;
  line-height: 1.35;
}

/* ---------- Popup image framing ---------- */
.leaflet-popup{ max-width: 600px; }
.leaflet-popup-content .popup-wrap{ max-width: 460px; }
.leaflet-popup-content .popup-photos{ margin-top: 6px; }
.leaflet-popup-content .popup-photos img{
  display: block;
  width: 100%;
  max-width: 440px;
  height: auto;
  background: #fff;
  border: 3px solid #ffffff;           /* inner white frame */
  box-shadow: 0 0 0 1px rgba(0,0,0,0.12), 0 6px 16px rgba(0,0,0,0.18); /* outer frame/shadow */
  border-radius: 6px;
  cursor: zoom-in;
}
.leaflet-popup-content .popup-photos.grid{
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.leaflet-popup-content .popup-photos.grid img{
  max-width: 100%;
  height: 180px;             /* uniform height for grid */
  object-fit: cover;         /* crop to fit nicely in frame */
}

/* ---------- 360 popup embed (responsive) ---------- */
.leaflet-popup-content .pano-embed{
  width: min(85vw, 520px);
  aspect-ratio: 16 / 9;
  height: auto;
  background: #111;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--soft-shadow);
  margin: 0 auto;           /* center within popup content */
  position: relative;       /* anchor pannellum internals */
  border: 10px solid #fff;  /* bigger white frame */
  box-sizing: border-box;   /* keep total width within popup */
}
.leaflet-popup-content .pano-meta{
  margin-top: 6px;
  font-size: 12.5px;
  line-height: 1.35;
  color: #555;
  width: min(85vw, 520px);
  margin-left: auto;
  margin-right: auto;
}

/* ---------- Image viewer modal ---------- */
#img-modal{
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}
#img-box{
  position: relative;
  max-width: min(95vw, 1200px);
  max-height: min(85vh, 900px);
  background: #000;
  border-radius: 6px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
#img-view{
  display: block;
  max-width: 100%;
  max-height: 85vh;
}
#img-title{
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 10px 12px;
  color: #fff;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.55) 85%);
  font-size: 13px;
  line-height: 1.35;
  text-shadow: 0 1px 1px rgba(0,0,0,0.6);
  max-height: 40%;
  overflow: auto;
}
#img-close{
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: 0;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 4px;
  cursor: pointer;
  z-index: 10;
}
#img-close:hover{ background: rgba(0,0,0,0.75); }



/* (Removed old 360 inline popup styles: pano-popup*, pano-leaflet-popup, basemap-tint-overlay) */
