/* River map (/rivermap/). Light only, like the rest of the site.
 *
 * Colours were checked with the dataviz palette validator against a light map
 * background (#f2efe9):
 *   level  - diverging around a neutral "normal": low orange, normal grey,
 *            high blue, very high dark blue; "no history" is a hollow ring, so
 *            it never reads as a colour of its own
 *   temp   - four bins, cold blue to warm red, one ramp per arm
 * Since 1 October 2026 the map draws every station as one plain dot; these
 * colours remain for the Low / Normal / High labels in station cards and in
 * the text below the map, always next to their word. */
/* On :root, not .rm: the swatches in the text below the map use them too. */
:root {
  --rm-low: #eb6834;
  --rm-normal: #a8a59c;
  --rm-high: #2a78d6;
  --rm-vhigh: #104281;
  --rm-none: #98a2b3;
  --rm-t0: #184f95;
  --rm-t1: #5598e7;
  --rm-t2: #ec835a;
  --rm-t3: #c2302f;
}
.rm {
  position: relative;
  height: calc(100vh - 66px);
  height: calc(100svh - 66px);
  min-height: 480px;
  max-height: 960px;
  background: #e8eef5;
  font-size: 14px;
}
@media (max-width: 720px) {
  .rm { height: calc(100svh - 62px); min-height: 520px; }
}
.rm-map { position: absolute; inset: 0; }
.rm .leaflet-container { font: inherit; background: #e8eef5; }

/* --- floating tools --------------------------------------------------- */
.rm-tools {
  position: absolute; z-index: 1050; top: 12px; left: 12px; right: 12px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start;
  pointer-events: none;
}
.rm-tools > * { pointer-events: auto; }
.rm-search { position: relative; width: 300px; max-width: 100%; }
.rm-search input {
  width: 100%; height: 40px; padding: 0 12px 0 34px;
  border: 1px solid var(--border); border-radius: 10px; background: #fff;
  font: inherit; color: var(--text);
  box-shadow: 0 2px 10px rgba(15, 52, 96, .15);
}
.rm-search input:focus { outline: 2px solid var(--link); outline-offset: 0; }
.rm-search-icon { position: absolute; left: 11px; top: 12px; color: var(--muted); }
.rm-results {
  position: absolute; top: 44px; left: 0; right: 0; margin: 0; padding: 4px 0;
  list-style: none; background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 52, 96, .18); max-height: 320px; overflow: auto;
}
.rm-results button {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%;
  padding: 8px 12px; border: 0; background: none; text-align: left; font: inherit; color: var(--text); cursor: pointer;
}
.rm-results button:hover, .rm-results button:focus { background: #f1f5fb; outline: none; }
.rm-results small { display: block; color: var(--muted); font-size: 12px; }
.rm-results .rm-kind { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 99px; padding: 1px 7px; flex: none; }
.rm-results .rm-empty { padding: 8px 12px; color: var(--muted); }

.rm-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 10px; background: #fff;
  font: inherit; font-weight: 500; color: var(--navy); cursor: pointer;
  box-shadow: 0 2px 10px rgba(15, 52, 96, .15);
}
.rm-btn[aria-busy="true"] { opacity: .6; }

/* --- status ----------------------------------------------------------- */
.rm-status {
  position: absolute; z-index: 1050; left: 50%; top: 64px; transform: translateX(-50%);
  max-width: calc(100% - 24px); padding: 7px 12px; border-radius: 10px;
  background: var(--navy); color: #fff; font-size: 13px; box-shadow: 0 4px 16px rgba(15, 52, 96, .25);
}
.rm-noscript { position: absolute; inset: auto 12px 12px; z-index: 900; background: #fff; padding: 10px; border-radius: 10px; }

/* Leaflet's controls sit at z-index 800-1000; the tools, status and panel
   above are set over them so the station sheet is never covered on a phone. */
@media (max-width: 720px) {
  /* Phones pinch to zoom; the buttons would only sit under the sheet. */
  .rm .leaflet-control-zoom { display: none; }
}

/* Swatches for the level labels in the text below the map; markers use .rm-plain. */
.rm-key, .rm-dot {
  display: inline-block; width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .28); flex: none;
}
/* Block, not inline: an inline dot sits on the icon's text baseline, a few
   pixels below the point Leaflet anchors it to (and below the selection ring). */
.rm-dot { width: 13px; height: 13px; display: block; }
.rm-l0 { background: var(--rm-low); }
.rm-l1 { background: var(--rm-normal); }
.rm-l2 { background: var(--rm-high); }
.rm-l3 { background: var(--rm-vhigh); }
.rm-lu { background: #fff; border-color: var(--rm-none); box-shadow: none; }
.rm-t0 { background: var(--rm-t0); }
.rm-t1 { background: var(--rm-t1); }
.rm-t2 { background: var(--rm-t2); }
.rm-t3 { background: var(--rm-t3); }
/* The open station: a navy ring drawn around the dot itself. */
.rm-dot.rm-sel { box-shadow: 0 0 0 2px #fff, 0 0 0 5px var(--navy), 0 2px 8px 5px rgba(15, 52, 96, .35); }
/* Every station on the map is the same dot, and every bubble the same colour:
   they say where gauges are; a station's card says how it reads. */
.rm-plain { background: var(--link); }
.rm-cluster.rm-plain { background: var(--navy); }

/* --- hover card (desktop) ------------------------------------------------ */
.leaflet-tooltip.rm-hover { padding: 0; border: 0; border-radius: 12px; box-shadow: 0 8px 24px rgba(15, 52, 96, .22); }
.leaflet-tooltip.rm-hover::before { display: none; }
.rm-hc { padding: 10px 12px; min-width: 230px; font: 13px/1.4 Roboto, system-ui, sans-serif; color: var(--text); }
.rm-hc > b { color: var(--navy); font-size: 14px; }
.rm-hc-sub { color: var(--muted); font-size: 12px; margin: 1px 0 6px; }
.rm-hc-sub:last-child { margin: 6px 0 0; }
.rm-hc-row { display: grid; grid-template-columns: 18px 1fr auto; gap: 6px; align-items: center; margin: 3px 0; }
.rm-hc-v { font-weight: 700; text-align: right; white-space: nowrap; }
.rm-hc-v .rm-chip { margin: 0 0 0 5px; vertical-align: 1px; }
.rm-hc-na { font-weight: 400; color: var(--muted); }
.rm-ic { display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 4px; font-size: 10px; font-weight: 700; color: #fff; }
.rm-il { background: #2a78d6; } .rm-iq { background: #0e9384; } .rm-it { background: #ec835a; }
.rm-ioff { background: #e4e7ec; color: #98a2b3; }
.rm-val.rm-off { background: #f8f9fb; }
.rm-val.rm-off .v { color: #b0b7c3; }

.rm-cluster {
  display: grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700; font-size: 12px;
  border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.rm-cluster.rm-l1 { color: #fff; }
.rm-cluster.rm-lu { background: #7b8494; border-color: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }
.rm-me { width: 16px; height: 16px; border-radius: 50%; background: var(--link); border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(42, 109, 217, .25); }

/* --- station panel (right on wide screens, bottom sheet on phones) ------ */
.rm-panel {
  position: absolute; z-index: 1100; top: 12px; right: 12px; bottom: 12px; width: 380px;
  overflow: auto; background: #fff; border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 8px 32px rgba(15, 52, 96, .22); padding: 16px 16px 18px;
}
.rm-grab { display: none; }
.rm-close {
  position: absolute; top: 8px; right: 10px; width: 32px; height: 32px; border: 0; border-radius: 8px;
  background: none; font-size: 24px; line-height: 1; color: var(--muted); cursor: pointer;
}
.rm-close:hover { background: #f1f5fb; color: var(--navy); }
.rm-panel h2 { margin: 0 34px 2px 0; font-size: 19px; color: var(--navy); }
.rm-sub { color: var(--muted); font-size: 12.5px; }
.rm-vals { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; margin: 12px 0 8px; }
.rm-val { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.rm-val .l { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.rm-val .v { font-size: 19px; font-weight: 700; color: var(--navy); line-height: 1.25; }
.rm-val .v small { font-size: 13px; font-weight: 600; white-space: nowrap; }
.rm-val .a { font-size: 11px; color: var(--muted); }
.rm-val.stale .v { color: var(--muted); }
.rm-chip { max-width: 100%; line-height: 1.3; display: inline-flex; align-items: center; gap: 4px; margin-top: 3px; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 7px; background: #eeede9; color: #52514e; }
.rm-chip.rm-c0 { background: #fde9df; color: #a2421b; }
.rm-chip.rm-c2 { background: #e0ecfb; color: #1c5cab; }
.rm-chip.rm-c3 { background: #dbe4f3; color: #0d366b; }
.rm-note { font-size: 12.5px; color: var(--text); margin: 6px 0; }
.rm-chart { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px 6px; margin: 10px 0; position: relative; }
.rm-chart-h { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.rm-chart-h b { color: var(--navy); }
.rm-chart svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.rm-chart .axis { font-size: 10px; fill: var(--muted); }
.rm-chart-tip {
  position: absolute; pointer-events: none; z-index: 2; padding: 4px 8px; border-radius: 6px;
  background: var(--navy); color: #fff; font-size: 11.5px; white-space: nowrap; transform: translate(-50%, -110%);
}
.rm-chart-h { align-items: center; }
.rm-chart-h [data-chart-title] { min-width: 0; }
.rm-range { display: inline-flex; flex-shrink: 0; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.rm-range button { font: inherit; font-size: 11px; padding: 2px 7px; border: 0; background: none; color: var(--muted); cursor: pointer; white-space: nowrap; }
.rm-range button + button { border-left: 1px solid var(--border); }
.rm-range button[aria-pressed="true"] { background: var(--navy); color: #fff; }
.rm-chart-note { font-size: 11px; color: var(--muted); min-height: 14px; }
.rm-key-range, .rm-key-normal { display: inline-block; width: 10px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: 0; }
.rm-key-range { background: rgba(42, 120, 214, .3); }
.rm-key-normal { background: rgba(168, 165, 156, .35); }
.rm-chart-empty { font-size: 12px; color: var(--muted); padding: 14px 0; text-align: center; }
.rm-cta { margin-top: 12px; padding: 12px; border-radius: 12px; background: linear-gradient(135deg, #0f3460, #1d4c8a); color: #fff; }
.rm-cta b { display: block; font-size: 14px; }
.rm-cta p { margin: 2px 0 8px; font-size: 12.5px; color: #cfe0ff; }
.rm-cta .cta-btns { margin-left: 0; gap: .5rem; }
.rm-cta .cta-btn { min-width: 0; padding: .35rem .7rem; }
.rm-cta .cta-sub { font-size: .6rem; }
.rm-cta .cta-name { font-size: .85rem; }
.rm-attr { margin-top: 10px; font-size: 11.5px; color: var(--muted); }
.rm-attr a { color: var(--muted); }
.rm-loading { color: var(--muted); padding: 20px 0; }

@media (max-width: 720px) {
  .rm-tools { top: 8px; left: 8px; right: 8px; gap: 6px; }
  .rm-search { width: 100%; }
  .rm-btn span { display: none; }
  .rm-status { top: 102px; }
  .rm-panel {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 64%;
    border-radius: 16px 16px 0 0; border-bottom: 0; padding-top: 22px;
    box-shadow: 0 -6px 24px rgba(0, 0, 0, .2); transition: max-height .2s;
  }
  .rm-panel.rm-collapsed { max-height: 132px; overflow: hidden; }
  .rm-grab {
    display: block; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 80px; height: 20px; border: 0; background: none; cursor: pointer;
  }
  .rm-grab::before { content: ""; display: block; width: 40px; height: 4px; margin: 8px auto 0; border-radius: 4px; background: #d0d5dd; }
}

/* --- text below the map ------------------------------------------------- */
.rm-stats { display: flex; flex-wrap: wrap; gap: .75rem; }
.rm-stats div { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: .6rem 1rem; min-width: 130px; }
.rm-stats b { display: block; font-size: 1.5rem; color: var(--navy); line-height: 1.2; }
.rm-stats span { color: var(--muted); font-size: .9rem; }
.rm-howto { list-style: none; padding: 0; }
.rm-howto li { display: flex; gap: .6rem; align-items: baseline; margin: .35rem 0; }
.rm-howto .rm-key { transform: translateY(1px); }
.rm-countries { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .4rem .9rem; }
.rm-countries li { display: flex; justify-content: space-between; border-bottom: 1px solid var(--border); padding: .3rem 0; }
.rm-countries b { color: var(--navy); font-variant-numeric: tabular-nums; }
.rm-sources { list-style: none; padding: 0; display: grid; gap: .6rem; }
.rm-sources li { background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; padding: .6rem .9rem; }
.rm-sources a { font-weight: 600; }
.rm-sources span { display: block; font-size: .9rem; }
.rm-sources small { color: var(--muted); }

/* "Fishing guide" in a station's card: the location page that shows this station. */
.rm-guide { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: #f6f9ff; color: var(--navy); text-decoration: none; }
.rm-guide span { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.rm-guide b { flex: 1; font-size: 14px; }
.rm-guide i { font-style: normal; color: var(--link); }
.rm-guide:hover { border-color: var(--link); }
