/* /stylesheets/routemaps-v-8.css
   Shared stylesheet for route maps (OpenLayers + OS Raster)
   v-8
*/

/* === Layout === */
body {
  margin: 0;
  padding: 0;
}
#map {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
}

/* === Toast (top-centre) — shown when user is outwith route extent === */
.ol-control.map-toast {
  position: absolute !important;
  top: calc(6px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  background: rgba(20, 24, 28, 0.85);
  color: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  font: 13px/1.2 Arial, sans-serif;
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease;
  white-space: nowrap;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}
.ol-control.map-toast.show { opacity: 1; }

/* === Zoom control restyle === */
.ol-control.ol-zoom {
  position: absolute;
  top: 8px;
  left: 8px;
  background: transparent;
  border: none;
  box-shadow: none;
  z-index: 1100;
}
.ol-control.ol-zoom button {
  width: 28px;
  height: 28px;
  line-height: 28px;
  padding: 0;
  margin: 0 0 6px 0;
  border: 0;
  border-radius: 2px;
  background: rgba(90, 120, 150, 0.8);
  color: #fff;
  font: 18px/28px Arial, sans-serif;
  cursor: pointer;
  transition: opacity .15s ease, background .15s ease;
}
.ol-control.ol-zoom button:hover { background: rgba(70, 100, 130, 0.9); }

/* Replace OL’s built-in zoom icons with plain text via ::after (uses the button's title) */
.ol-control.ol-zoom .ol-zoom-in::after,
.ol-control.ol-zoom .ol-zoom-out::after {
  content: attr(title);
  display: block;
  text-align: center;
  font-weight: 600;
}
.ol-control.ol-zoom .ol-zoom-in > span,
.ol-control.ol-zoom .ol-zoom-out > span {
  display: none !important;
}

/* === Layers menu (under zoom) === */
.ol-control.layer-menu {
  position: absolute !important;
  top: 86px;
  left: 7px;
  z-index: 1100;
}
.ol-control.layer-menu .layer-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: rgba(90, 120, 150, 0.8);
  color: #fff;
  border: 0;
  border-radius: 2px;
  cursor: pointer;
  padding: 0;
  outline: none;
  box-shadow: none;
}
.ol-control.layer-menu .layer-btn:hover { background: rgba(70, 100, 130, 0.9); }

.ol-control.layer-menu .menu {
  position: absolute;
  top: 2px;
  left: 44px;
  background: #fff;
  border-radius: 3px;
  box-shadow: none;
  outline: none;
  padding: 4px;
  min-width: 110px;
  display: none;
}
.ol-control.layer-menu .menu button {
  display: block;
  width: 100%;
  background: transparent;
  border: 0;
  text-align: left;
  padding: 2px 10px;
  font: 14px Arial, sans-serif;
  color: #222;
  border-radius: 2px;
  cursor: pointer;
}
.ol-control.layer-menu .menu button:hover { background: #f2f5f8; }
.ol-control.layer-menu .menu button.active {
  background: #e8f0fb;
  color: #1f5fb8;
}

/* === Locate button (lines up under layer menu) === */
.ol-control.locate-btn.bl {
  position: absolute;
  top: 125px;
  left: 7px;
}
.ol-control.locate-btn .locate-button {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: rgba(90, 120, 150, 0.8);
  color: #fff;
  border: 0;
  border-radius: 3px;
  cursor: pointer;
  padding: 0;
  box-shadow: none;
  outline: none;
}
.ol-control.locate-btn .locate-button:hover { background: rgba(70, 100, 130, 0.9); }
.ol-control.locate-btn .locate-button svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* === Bottom-centre scale bar === */
.ol-scale-line {
  position: absolute !important;
  top: calc(8px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  bottom: auto;
  right: auto;
  z-index: 1000;
  background: rgba(90, 120, 150, 0.8);
  padding: 1px 3px;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
  opacity: 0.5;
}
.ol-scale-line-inner {
  border-style: solid;
  border-color: #ffffff;
  border-width: 0 1px 1px 1px;
  color: #ffffff;
  font: 9px/0.9 Arial, sans-serif;
  max-width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

/* === Small screens === */
@media (max-width: 380px) {
  /* hooks if you want tweaks later */
}

/* === OS branding (bottom-left): gently shrink & pin tighter to the corner === */
.os-api-branding {
  position: absolute !important;
  left: 0 !important;
  bottom: 3px !important;
  transform: scale(0.85);
  transform-origin: left bottom;
  font-size: 11px !important;
  line-height: 1.15 !important;
}

/* Hide OS bottom-left copyright badge globally (Option B) */
.os-api-branding.copyright {
  display: none !important;
}

/* === Hypsometric tint & readability helpers === */
.hyps canvas {
  /* mix-blend-mode: multiply; */ /* optional */
}

/* Outdoor readability boost (Outdoor layer has className: 'os-overlay') */
.os-overlay canvas {
  filter: contrast(1.08) saturate(0.85) brightness(1.0);
  mix-blend-mode: multiply;
}

/* === Attribution (bottom-right) === */
#map .ol-attribution,
#map .ol-attribution.ol-uncollapsible {
  position: absolute !important;
  right: 0 !important;
  bottom: 4px !important;
  background: rgba(255, 255, 255, 0.9) !important;
  padding: 1px 2px !important;
  border-radius: 1px !important;
  z-index: 1200 !important;
  opacity: 0.55 !important;
  font: 9px/1.1 Arial, sans-serif !important;
}
.ol-attribution button { display: none !important; }
.ol-attribution,
.ol-attribution ul,
.ol-attribution li,
.ol-attribution a,
.ol-attribution span {
  font-size: 9px !important;
  line-height: 1.1 !important;
}

/* === Embed mode === */
body.embed { margin: 0; }
body.embed #map { width: 100vw; height: 100vh; }

/* Hide any UI in embed (belt & braces) */
body.embed .layer-menu,
body.embed .locate-btn,
body.embed .ol-scale-line,
body.embed .ol-zoom,
body.embed .ol-rotate,
body.embed .ol-full-screen {
  display: none !important;
}

/* Route-summary map embed helpers */
.routesummarymapembed {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  overflow: hidden;
}
.routesummarymapframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none;
}
.routesummarymapclick {
  position: absolute;
  inset: 0;
  display: block;
  z-index: 5;
}

/* EMBED: shrink OS badge hard */
body.embed .os-api-branding,
body.embed .os-api-branding-logo,
body.embed .os-api-branding-badge,
body.embed [class*="os-api-branding"] {
  transform: scale(0.6) !important;
  transform-origin: left bottom !important;
}

/* === Hyps legend (stepped bands) === */
.hyps-legend {
  position: absolute;
  right: 7px;
  top: 7px;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(0,0,0,0.20);
  border-radius: 4px;
  padding: 8px 7px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.22);
  font: 9px/0.9 Arial, sans-serif;
  pointer-events: none; /* no hover/focus effects */
}
.hyps-title {
  font-weight: normal;
  margin-bottom: 4px;
}
.hyps-row {
  display: flex;
  align-items: center;
  gap: 3px;
  margin: 2px 0;
}
.hyps-swatch {
  width: 9px;
  height: 9px;
  border: 1px solid rgba(0,0,0,0.20);
  flex: 0 0 auto;
}
.hyps-label { white-space: nowrap; }

/* === Padlock “map kick” control === */
.ol-control.layer-menu.layer-menu-dup {
  position: absolute !important;
  top: 165px;
  left: 7px;
  z-index: 1100;
}

/* Unlock menu styling (distinct from basemap menu) */
.ol-control.layer-menu.layer-menu-dup .menu {
  background: rgba(70, 100, 130, 0.9);
  border-radius: 4px;
  padding: 6px 8px;
  min-width: 120px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.ol-control.layer-menu.layer-menu-dup .menu button {
  color: #fff;
  font-weight: 500;
  text-align: center;
}
.ol-control.layer-menu.layer-menu-dup .menu button:hover {
  background: rgba(255,255,255,0.12);
}

/* === OSM paths toggle (under padlock) === */
.ol-control.osm-paths {
  position: absolute !important;
  top: 204px; /* below padlock control */
  left: 7px;
  z-index: 1100;
}
.ol-control.osm-paths button {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: rgba(90, 120, 150, 0.8);
  color: #fff;
  border: 0;
  border-radius: 3px;
  cursor: pointer;
  padding: 0;
  box-shadow: none;
  outline: none;
}
.ol-control.osm-paths button:hover { background: rgba(70, 100, 130, 0.9); }
.ol-control.osm-paths button.on { background: rgba(35, 140, 70, 0.9); }