/* FREE SAILING — class-map.css — styles for assets/js/class-map.js only.
   Scoped entirely under .cm-root so this file can be linked from any page,
   including class-map.html once ownership of that file is resolved, without
   touching that page's own CSS. */

.cm-root {
  position: relative;
  width: 100%;
  height: var(--cm-h, 560px);
  min-height: 320px;
  border-radius: 14px;
  overflow: hidden;
  background: #eef3f8;             /* visible the instant the tile fetch starts */
  border: 1px solid rgba(2,43,131,.10);
  box-shadow: 0 1px 2px rgba(2,43,131,.05), 0 10px 26px rgba(2,43,131,.08);
}
.cm-canvas { position: absolute; inset: 0; }
.cm-canvas .maplibregl-map { width: 100%; height: 100%; }

/* MapLibre's own control chrome, restyled lightly to sit inside the site's
   rounded-card language instead of its stock square buttons. */
.cm-root .maplibregl-ctrl-top-right { top: 12px; right: 12px; }
.cm-root .maplibregl-ctrl-group {
  border-radius: 10px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(2,43,131,.08), 0 6px 16px rgba(2,43,131,.10);
  border: 1px solid rgba(2,43,131,.08);
}

/* ── layer toggles + category chips, top-left ─────────────────────────── */
.cm-controls {
  position: absolute; top: 12px; left: 12px; z-index: 5;
  display: flex; flex-direction: column; gap: 8px;
  max-width: min(240px, calc(100% - 24px));
}
.cm-toggles, .cm-cats {
  background: rgba(255,255,255,.94); backdrop-filter: blur(6px);
  border: 1px solid rgba(2,43,131,.10); border-radius: 12px;
  padding: 8px 10px; box-shadow: 0 1px 2px rgba(2,43,131,.06), 0 8px 20px rgba(2,43,131,.08);
  display: flex; flex-direction: column; gap: 6px;
}
.cm-toggle, .cm-cat {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 500; color: #22314f; cursor: pointer;
  user-select: none; line-height: 1.3;
}
.cm-toggle input, .cm-cat input {
  width: 15px; height: 15px; margin: 0; accent-color: #022B83; cursor: pointer;
}
.cm-sw {
  width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto;
  box-shadow: 0 0 0 1.5px rgba(255,255,255,.9), 0 0 0 2.5px rgba(2,43,131,.14);
}

/* ── legend, bottom-left ───────────────────────────────────────────────── */
.cm-legend {
  position: absolute; left: 12px; bottom: 12px; z-index: 5;
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.92); border: 1px solid rgba(2,43,131,.10);
  border-radius: 10px; padding: 6px 10px; font-size: 11.5px; color: #5a6b8c;
  box-shadow: 0 1px 2px rgba(2,43,131,.06);
}
.cm-legend-h { font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: 10px; color: #8a97b3; }
.cm-legend-ring {
  width: 14px; height: 14px; border-radius: 50%; flex: 0 0 auto;
  border: 1.5px dashed rgba(2,43,131,.5); background: rgba(2,43,131,.08);
}
.cm-legend-note { white-space: nowrap; }

/* ── attribution, bottom-right (own control, not MapLibre's compact one —
   the tile-sources skill: OSM attribution must sit at normal visual
   prominence, not tucked behind a toggle) ────────────────────────────── */
.cm-attr {
  position: absolute; right: 10px; bottom: 8px; z-index: 5;
  font-size: 10.5px; color: rgba(20,30,50,.55);
  background: rgba(255,255,255,.7); padding: 1px 6px; border-radius: 6px;
}
.cm-attr a { color: inherit; text-decoration: underline; }

/* ── the sparse-class / load-failure empty state ──────────────────────── */
.cm-empty {
  position: absolute; inset: 0; z-index: 4;
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 24px; pointer-events: none;
}
.cm-empty p {
  max-width: 34ch; font-size: 14px; color: #5a6b8c; line-height: 1.5;
  background: rgba(255,255,255,.88); padding: 10px 16px; border-radius: 10px;
  box-shadow: 0 1px 2px rgba(2,43,131,.06);
}
.cm-root-empty { background: #eef3f8; }

/* ── the click-through card popup ─────────────────────────────────────── */
.cm-root .maplibregl-popup-content {
  border-radius: 12px; padding: 14px 16px; box-shadow: 0 8px 28px rgba(2,43,131,.18);
  font-family: inherit;
}
.cm-card-cat { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 3px; }
.cm-card h3 { font-size: 15px; font-weight: 700; color: #14203a; margin: 0 0 2px; line-height: 1.25; }
.cm-card-org { font-size: 12.5px; color: #445068; margin: 0 0 4px; }
.cm-card-where { font-size: 12px; color: #7683a0; margin: 0 0 6px; }
.cm-card-boats { font-size: 12px; color: #0F6E4F; font-weight: 600; margin: 0 0 6px; }
.cm-card-ev { font-size: 12.5px; color: #33415e; font-style: italic; line-height: 1.4; margin: 0 0 6px; }
.cm-card-prec { font-size: 10.5px; color: #8a97b3; margin: 0 0 8px; }
.cm-card-links { display: flex; flex-direction: column; gap: 3px; }
.cm-card-links a { font-size: 12.5px; color: #022B83; font-weight: 600; text-decoration: none; }
.cm-card-links a:hover { text-decoration: underline; }

/* ── the BROAD state: no positions, but the country reach is real ────── */
.cm-empty-broad p { max-width: 46ch; }
.cm-empty-list {
  margin-top: 8px !important; font-size: 12.5px !important; color: #6b7999 !important;
  line-height: 1.6;
}
/* ── the EVIDENCE state: the map stands down rather than show an empty world.
   The basemap is dimmed and desaturated so it reads as backdrop, not as a
   map inviting you to look for something that is not on it. ───────────── */
.cm-root-standdown .cm-canvas { filter: grayscale(0.8) opacity(0.45); }
.cm-root-standdown .cm-controls,
.cm-root-standdown .cm-legend { display: none; }
.cm-empty-evidence p { max-width: 40ch; font-size: 14.5px; }

/* ── unmapped evidence: real, named, never pinned ─────────────────────── */
.cm-unmapped {
  margin-top: 14px; padding: 14px 16px; border-radius: 12px;
  background: #f6f8fc; border: 1px solid rgba(2,43,131,.08);
}
.cm-um-lead { font-size: 12.5px; color: #6b7999; margin: 0 0 10px; line-height: 1.4; }
.cm-um-group + .cm-um-group { margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(2,43,131,.07); }
.cm-um-group h4 {
  margin: 0 0 6px; font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: #3a4867; display: flex; align-items: center; gap: 8px;
}
.cm-um-tag {
  font-size: 10px; font-weight: 500; text-transform: none; letter-spacing: 0;
  color: #9aa5bd; background: #fff; border: 1px solid rgba(2,43,131,.08);
  border-radius: 999px; padding: 1px 8px;
}
.cm-um-group ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.cm-um-group li { font-size: 13px; color: #22314f; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.cm-um-name { font-weight: 600; }
.cm-um-where { font-size: 12px; color: #8a97b3; }
.cm-um-group li a { font-size: 12px; color: #022B83; text-decoration: none; }
.cm-um-group li a:hover { text-decoration: underline; }

/* ── mobile ────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .cm-root { height: var(--cm-h-mobile, 420px); border-radius: 10px; }
  .cm-controls { max-width: calc(100% - 20px); }
  .cm-toggles, .cm-cats { padding: 7px 9px; }
  .cm-toggle, .cm-cat { font-size: 12.5px; }
  .cm-root .maplibregl-ctrl-top-right { top: 8px; right: 8px; }
}
