/* =========================================================================
   Isla Noctura — map page. Full-bleed Leaflet below a sticky nav.
   Loaded only by map.html.
   ========================================================================= */

.map-page { overflow: hidden; }          /* the map scrolls, the page does not */
.map-page .night { display: none; }      /* the basemap IS the backdrop here */

.map-shell {
  position: relative;
  /* nav is 62px tall and sticky; fill everything under it. dvh so a phone's
     collapsing address bar does not leave a dead strip. */
  height: calc(100vh - 62px);
  height: calc(100dvh - 62px);
  width: 100%;
}

#leafmap {
  position: absolute; inset: 0;
  background: #05090F;
  outline: none;
}

/* Leaflet's own chrome, restyled for the night palette */
.leaflet-container { background: #05090F; font-family: var(--ui); }
.leaflet-control-zoom a {
  background: rgba(12,21,33,.94); color: var(--silver);
  border: 1px solid var(--line-2); border-radius: 7px !important;
  width: 32px; height: 32px; line-height: 30px; font-size: 17px;
  margin-bottom: 5px; backdrop-filter: blur(8px);
}
.leaflet-control-zoom a:hover { background: #1B2836; color: var(--moon); }
.leaflet-control-zoom { border: 0 !important; box-shadow: none !important; margin: 0 14px 74px 0 !important; }
.leaflet-bar { box-shadow: none; }

.leaflet-tooltip {
  background: rgba(9,16,26,.96); color: var(--silver);
  border: 1px solid var(--line-2); border-radius: 6px;
  box-shadow: 0 8px 24px -14px #000;
  font: 500 12.5px/1.4 var(--ui); padding: 5px 9px;
}
.leaflet-tooltip::before { display: none; }
.leaflet-tooltip .dim { color: var(--silver-mut); }

/* area-name labels drawn straight onto the map */
.poi-label {
  font: 600 10.5px/1 var(--ui);
  letter-spacing: .14em; text-transform: uppercase;
  color: rgba(232,237,247,.82);
  text-shadow: 0 1px 3px #000, 0 0 8px #000;
  white-space: nowrap; pointer-events: none;
  transform: translate(-50%, -50%);
}

/* ---------- side panel ---------- */
.map-panel {
  position: absolute; top: 14px; left: 14px; z-index: 800;
  width: 290px; max-height: calc(100% - 28px);
  display: flex; flex-direction: column;
  background: rgba(8,14,24,.93);
  border: 1px solid var(--line-2); border-radius: 12px;
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 18px 44px -22px #000;
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 15px; border-bottom: 1px solid var(--line);
}
.panel-head h1 { font-size: 20px; margin: 0; }
.panel-head p { margin: 4px 0 0; font-size: 12.4px; }
.panel-x {
  margin-left: auto; flex: none; width: 32px; height: 32px;
  display: none; place-items: center;
  background: transparent; border: 1px solid var(--line-2);
  border-radius: 7px; color: var(--silver); cursor: pointer;
}
.panel-body { padding: 13px 15px 16px; overflow-y: auto; scrollbar-width: thin; }

.panel-label {
  margin: 0 0 9px;
  font: 600 10px/1 var(--ui); letter-spacing: .16em;
  text-transform: uppercase; color: var(--silver-mut);
}
/* .panel-label sets the margin shorthand, which zeroes margin-top and so
   silently beats the .mt-m utility. Restore it explicitly, and give each
   block after the first a rule so the panel reads as sections. */
.panel-label.mt-m {
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--line);
}
.panel-note { font-size: 12.4px; margin: 6px 0 0; line-height: 1.5; }

.legend { display: flex; flex-direction: column; gap: 1px; }
.legend-row {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 7px; border-radius: 6px; cursor: pointer;
  font-size: 13.2px; color: var(--silver-dim);
  transition: background .14s;
}
.legend-row:hover { background: rgba(159,182,201,.09); color: var(--moon); }
.legend-row input { accent-color: #9FB6C9; width: 14px; height: 14px; flex: none; cursor: pointer; }
.legend-swatch {
  width: 9px; height: 9px; border-radius: 50%; flex: none;
  background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent);
}
.legend-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-count {
  font: 500 11px/1 var(--mono); color: var(--silver-mut);
  font-variant-numeric: tabular-nums; flex: none;
}

.coord {
  font: 500 12.5px/1.5 var(--mono); color: var(--moon);
  background: var(--surface-3); border: 1px solid var(--line);
  border-radius: 7px; padding: 9px 11px; margin: 0;
  overflow-x: auto; white-space: nowrap; scrollbar-width: thin;
}

.map-credit {
  position: absolute; right: 12px; bottom: 10px; z-index: 700;
  font: 500 10.5px/1.4 var(--ui); color: rgba(148,163,178,.72);
  text-shadow: 0 1px 3px #000; pointer-events: none;
  max-width: 46%; text-align: right;
}

/* ---------- phone ---------- */
@media (max-width: 820px) {
  .map-shell { height: calc(100vh - 62px); height: calc(100dvh - 62px); }
  .map-panel {
    top: 10px; left: 10px; right: 10px; width: auto;
    max-height: calc(100% - 20px);
  }
  .panel-x { display: grid; }
  .panel-body { display: none; }
  .map-panel[data-open="true"] .panel-body { display: block; }
  .map-credit { max-width: 60%; font-size: 9.5px; bottom: 8px; }
  .leaflet-control-zoom { margin: 0 10px 60px 0 !important; }
}
