/* Map layout and Leaflet-specific components. */

/* App frame: header / map row / footer fill the viewport exactly; the data plate
   scrolls internally, so long results never stretch the map or push the footer away. */
.mapshell { display: grid; grid-template-rows: auto 1fr auto; height: 100vh; }

.rail-hint {
  margin: 0 0 0 auto; max-width: 34ch;
  font-family: var(--prose); font-size: 12px; line-height: 1.4; color: var(--ink-soft);
}

.language-picker {
  display: flex; align-items: center; gap: 0.4rem; margin-left: auto;
  font-family: var(--cond); font-size: 10px; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--ink-soft);
}
.language-picker select {
  padding: 0.22rem 0.35rem; border: 1px solid var(--rule); border-radius: 2px;
  background: var(--panel); color: var(--ink); font-family: var(--mono); font-size: 11px;
}
.language-picker + .rail-hint { margin-left: 0; }

.maprow {
  display: grid;
  grid-template-columns: 1fr clamp(20rem, 28vw, 23rem);
  min-height: 0;
}

.mapcol {
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  border-right: var(--hair);
}

#map {
  flex: 1;
  position: relative;               /* anchors the cursor readout, not left to Leaflet */
  min-height: 320px;
  background: var(--panel);
  z-index: 0;                       /* keep Leaflet panes under the rail */
  overflow: hidden;                 /* a 2 km range circle is far wider than the pane */
  min-width: 0;                     /* let the grid column shrink instead of pushing */
}

.maprow .data { overflow-y: auto; }

.block-heading {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  margin-bottom: 0.55rem;
}
.info-toggle {
  display: grid; place-items: center; width: 1.6rem; height: 1.6rem; flex: 0 0 auto;
  padding: 0; border: 1px solid var(--rule-faint); border-radius: 50%;
  background: transparent; color: var(--accent); cursor: pointer;
}
.info-toggle::before {
  content: ""; width: 0.38rem; height: 0.38rem;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px); transition: transform 150ms ease;
}
.info-toggle[aria-expanded="true"]::before {
  transform: rotate(225deg) translate(-1px, -1px);
}
.info-toggle:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.info-collapsed .section-details { display: none !important; }

.block-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  cursor: pointer; list-style: none; user-select: none;
}
.block-toggle::-webkit-details-marker { display: none; }
.block-toggle::after {
  content: ""; width: 0.48rem; height: 0.48rem; flex: 0 0 auto;
  border-right: 1.5px solid var(--accent); border-bottom: 1.5px solid var(--accent);
  transform: rotate(45deg); transition: transform 150ms ease;
}
.block[open] > .block-toggle::after { transform: rotate(225deg); }
.block[open] > .block-toggle { margin-bottom: 0.65rem; }
.block-toggle:hover .plate-label { color: var(--ink); }


.maprow { overflow-x: clip; }

/* Leaflet paints its own chrome; pull it onto the page's palette */
.leaflet-container { font-family: var(--mono); font-size: 11px; background: var(--panel); }
.leaflet-bar a, .leaflet-draw-toolbar a {
  background-color: var(--panel); color: var(--ink); border-color: var(--rule-faint);
}
.leaflet-bar a:hover { background-color: var(--ground); }
.leaflet-control-attribution {
  background: color-mix(in srgb, var(--panel) 85%, transparent);
  color: var(--ink-soft); font-size: 10px;
}
.leaflet-control-attribution a { color: var(--accent); }
.leaflet-control-scale-line {
  background: color-mix(in srgb, var(--panel) 85%, transparent);
  border-color: var(--rule); color: var(--ink);
  font-family: var(--mono); font-variant-numeric: tabular-nums;
}
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--panel); color: var(--ink); border-radius: 2px;
}
.leaflet-popup-content { font-family: var(--mono); font-size: 11px; }


.upload-fields {
  display: flex; flex-direction: column; gap: 0.35rem;
  padding: 0.55rem; border: 1px solid var(--rule-faint); border-radius: 2px;
  background: color-mix(in srgb, var(--panel) 75%, var(--ground));
}
.upload-fields[hidden] { display: none; }
.upload-fields label {
  font-family: var(--cond); font-size: 10px; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-soft);
}
.upload-fields input {
  min-width: 0; width: 100%; color: var(--ink);
  font-family: var(--mono); font-size: 11px;
}
.upload-fields p {
  margin: 0; color: var(--ink-soft);
  font-family: var(--prose); font-size: 10px; line-height: 1.4;
}

.src-note {
  margin: 0; font-family: var(--prose); font-size: 12px; line-height: 1.45;
  color: var(--ink-soft);
}
.src-note.warn { color: var(--amber); }

.run {
  font-family: var(--cond); font-size: 12px; letter-spacing: 0.09em; text-transform: uppercase;
  padding: 0.5rem 0.8rem; border: 1px solid var(--accent); border-radius: 2px;
  background: var(--accent); color: var(--ground); cursor: pointer;
}
.run-ghost { background: transparent; color: var(--accent); }
.run-ghost:hover { background: var(--accent); color: var(--ground); }
.btn-row { display: flex; gap: 0.4rem; }
.btn-row .run { flex: 1; }

.run:disabled { background: transparent; color: var(--ink-soft); border-color: var(--rule-faint); cursor: not-allowed; }
.run[aria-busy="true"] { opacity: 0.6; cursor: progress; }

.analysis-progress {
  display: flex; flex-direction: column; gap: 0.35rem;
  padding: 0.55rem; border: 1px solid var(--rule-faint); border-radius: 2px;
  background: color-mix(in srgb, var(--panel) 75%, var(--ground));
}
.analysis-progress[hidden] { display: none; }
.progress-head {
  display: flex; justify-content: space-between; gap: 0.75rem;
  font-family: var(--cond); font-size: 11px; letter-spacing: 0.04em;
}
.progress-head output { color: var(--accent); font-variant-numeric: tabular-nums; }
.analysis-progress progress {
  display: block; width: 100%; height: 0.55rem; accent-color: var(--accent);
}
.analysis-progress p {
  margin: 0; color: var(--ink-soft);
  font-family: var(--mono); font-size: 10px; font-variant-numeric: tabular-nums;
}

/* which placed mosaic the heading slider drives */
.field-mosaic { filter: saturate(0.85) brightness(0.92); cursor: grab; }
.plot-active { cursor: move; }

/* one cell = one class, so let the browser show the cells; smoothing the upscale
   reinvents the blurred edge the class colouring exists to remove */
.density-overlay { image-rendering: pixelated; }

/* per-cell readout that follows the cursor over the density overlay */
.probe {
  position: absolute; z-index: 700; pointer-events: none;
  padding: 0.35rem 0.5rem; max-width: 15rem;
  border: 1px solid var(--rule); border-radius: 2px;
  background: var(--panel); color: var(--ink);
  font-family: var(--mono); font-size: 11px; line-height: 1.5;
  box-shadow: 0 1px 6px rgb(0 0 0 / 0.25);
}
.probe[hidden] { display: none; }
.probe i { color: var(--ink-soft); font-style: normal; font-size: 10px; }
.probe-flag { color: var(--amber); font-style: normal; }

.warns { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 0.45rem; }
.warns li { font-family: var(--prose); font-size: 12px; line-height: 1.45; color: var(--ink-soft); }
.warns li.synthetic { color: var(--amber); }

.hive-pin {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--ground);
  box-sizing: border-box;
}

/* hover / click card on a hive marker */
.leaflet-tooltip.hive-tip {
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--rule); border-radius: 2px;
  padding: 0; box-shadow: 0 2px 10px rgb(0 0 0 / 0.25);
}
.leaflet-tooltip.hive-tip::before { display: none; }
.leaflet-popup-content .hive-card { margin: -0.35rem -0.6rem; }

.hive-card { width: 232px; font-family: var(--mono); font-size: 11px; }
.hive-card img {
  display: block; width: 100%; height: 118px; object-fit: cover;
  border-bottom: 1px solid var(--rule-faint);
}
.hive-card-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem;
  padding: 0.45rem 0.55rem 0.15rem;
}
.hive-card-head i { color: var(--ink-soft); }
.hive-card-rows { margin: 0; padding: 0.15rem 0.55rem; }
.hive-card-species { border-top: 1px solid var(--rule-faint); }
.hive-card-rows div {
  display: flex; justify-content: space-between; gap: 0.6rem; padding: 0.1rem 0;
}
.hive-card-rows dt { color: var(--ink-soft); }
.hive-card-rows dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.hive-card-credit {
  margin: 0; padding: 0.1rem 0.55rem 0.4rem;
  font-size: 9px; color: var(--ink-soft);
}

/* balanced two-column footer on wide screens */
.foot .prose { max-width: none; columns: 2 38ch; column-gap: 3rem; margin: 0; }

@media (max-width: 900px) {
  .mapshell { height: auto; min-height: 100vh; }
  .maprow { grid-template-columns: 1fr; }
  .maprow .data { overflow-y: visible; }
  .mapcol { border-right: 0; border-bottom: var(--hair); }
  #map { min-height: 55vh; }
  .rail-hint { margin-left: 0; }
}
/* Texture imagery is decoded from lossless native PNGs; no blur/colour filters. */
.virtual-mosaic { filter: none; }
