/* Earth Map. #em-scoped.
 *
 * css/tool-theme.css loads AFTER this file and wins every tie, so anything here that has to beat
 * one of its generic rules is written against `#tool-root #em` — two ids, which outrank all of
 * them. The generic button rule alone is (1,2,1); a one-id selector can only tie it and lose. */

#em { display: block; }
#em [hidden] { display: none !important; }   /* a display rule would otherwise beat [hidden] */

#em .em-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.9fr);
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  #em .em-grid { grid-template-columns: minmax(0, 1fr); }
}

#em .em-label {
  display: block; font-size: 11px; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase; opacity: .72; margin-bottom: 7px;
}
#em .em-hint { margin: 6px 0 0; font-size: 12.5px; line-height: 1.5; }
#em .em-hint:empty { display: none; }

/* Map column ---------------------------------------------------------------- */
#em .em-mapcol { display: flex; flex-direction: column; gap: 10px; padding: 14px; min-width: 0; }
#em .em-find { margin: 0; }
#em .em-row { display: flex; gap: 8px; }
#em .em-row input { flex: 1 1 auto; min-width: 0; }

#em .em-mapwrap { position: relative; border-radius: 10px; overflow: hidden; }
#em .em-map { width: 100%; height: 560px; background: #dde6dd; }
@media (max-width: 900px) { #em .em-map { height: 380px; } }
#em .em-nomap { margin: 0; padding: 18px; font-size: 14px; line-height: 1.55; }
#em .em-credit { margin: 0; font-size: 12px; line-height: 1.55; opacity: .85; }

/* Settings column ------------------------------------------------------------ */
#em .em-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
#em .em-field { display: block; min-width: 0; }
#em .em-field > input[type="text"] { width: 100%; box-sizing: border-box; }

#em .em-sizes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#tool-root #em button.em-size {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  padding: 10px 12px; text-align: left; line-height: 1.25; min-width: 0;
}
#tool-root #em button.em-size b { font-size: 13.5px; }
#tool-root #em button.em-size span { font-size: 12px; opacity: .75; }
#tool-root #em button.em-size[aria-pressed="true"] { outline: 2px solid currentColor; outline-offset: -2px; }
#em .em-summary { margin: 9px 0 0; font-size: 13px; line-height: 1.55; }

#em .em-opts { display: grid; gap: 10px; }
#em .em-opt {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 12rem);
  align-items: center; gap: 10px; font-size: 14px;
}
#em .em-opt select { width: 100%; }
#em .em-check { display: flex; align-items: center; gap: 9px; font-size: 14px; line-height: 1.4; }

#tool-root #em button.em-generate {
  width: 100%; padding: 13px 16px; font-size: 15px; font-weight: 800; letter-spacing: .02em;
}
#em .em-progress { display: grid; gap: 9px; }
#em .em-bar { height: 10px; border-radius: 99px; background: rgba(127, 127, 127, .25); overflow: hidden; }
#em .em-fill { height: 100%; width: 0; border-radius: 99px; background: #22c55e; transition: width .3s ease; }
#em .em-status { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
#em .em-stage { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#em .em-pct { flex: 0 0 auto; font-weight: 800; font-variant-numeric: tabular-nums; }

#tool-root #em a.em-download {
  display: block; margin-top: 10px; padding: 12px 16px; border: 2px solid currentColor;
  border-radius: 10px; text-align: center; font-weight: 800; text-decoration: none;
}
#em .em-note { margin: 10px 0 0; font-size: 13.5px; line-height: 1.55; }
#em .em-extra p { margin: 8px 0 0; font-size: 13px; line-height: 1.55; }
#em .em-note:empty, #em .em-error:empty { display: none; }
#em .em-error { margin: 10px 0 0; font-size: 13.5px; line-height: 1.55; font-weight: 600; color: #fca5a5; }
#em .em-error p { margin: 0 0 6px; }
#em .em-error ul { margin: 0 0 6px; padding-left: 18px; font-weight: 500; }
:root[data-theme="light"] #em .em-error { color: #b91c1c; }

/* Help ------------------------------------------------------------------------ */
#em .em-help { margin-top: 30px; font-size: 14.5px; line-height: 1.65; max-width: 78ch; }
#em .em-help h2 { font-size: 17px; margin: 24px 0 8px; }
#em .em-help h2:first-child { margin-top: 0; }
#em .em-help p { margin: 0 0 10px; }

/* Leaflet, defended against tool-theme.css ---------------------------------------
 * The map carries data-tnorm-skip: its colours are the tiles, and Leaflet's controls are a
 * white UI drawn over those tiles in either site theme. What still reaches it is CSS:
 *   - `[class*="-out"]`, meant for output boxes, matches leaflet-control-zoom-out and gives it
 *     padding 12px 14px, a monospace font and the dark surface colour;
 *   - `#tool-root a` paints the zoom glyphs and the attribution links site-green on white.
 * boxZoom is off in earth-map.js, so leaflet-zoom-box, which `[class*="-box"]` would turn into
 * an opaque panel, is never created. */
#tool-root #em .leaflet-container { font-family: inherit; }
#tool-root #em .leaflet-bar a {
  background: #fff; color: #111; padding: 0; margin: 0; border-radius: 0;
  font: bold 18px/30px "Lucida Console", Monaco, monospace; overflow: visible;
  border: 0; border-bottom: 1px solid #ccc;
}
#tool-root #em .leaflet-bar a:last-child { border-bottom: 0; }
#tool-root #em .leaflet-bar a:hover { background: #f4f4f4; }
#tool-root #em .leaflet-control-attribution a { color: #0a5f86; }
