/* Styles for both pages (index.html and about.html). */

/* Colour palette and sizes, as CSS variables: use them as var(--name).
   The route/town colours are repeated in STYLE in app.js (Leaflet takes
   colours as JavaScript options), so change them in both places. */
:root {
  --fg: #1d2330;
  --muted: #5b6475;
  --bg: #ffffff;
  --header-bg: #1f4e79;
  --header-fg: #ffffff;
  --route: #1f6fb2;
  --route-hover: #d9480f;
  --town-fill: #ffffff;
  --town-stroke: #1f4e79;
  --header-height: 3rem;
}

/* Make width/height include padding and border; avoids surprise overflows. */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  color: var(--fg);
  background: var(--bg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

.site-header {
  display: flex;
  align-items: center;
  gap: 1.5rem; /* space between the name and the About link */
  height: var(--header-height);
  padding: 0 1rem;
  background: var(--header-bg);
  color: var(--header-fg);
}
.site-header a { color: inherit; text-decoration: none; }
.site-header a:hover, .site-header a[aria-current="page"] { text-decoration: underline; }
.site-title { font-weight: 700; font-size: 1.1rem; }

/* map page: header on top, map fills the rest.
   Leaflet needs its container to have a real height, otherwise the map is 0px
   tall and invisible. The body is a vertical flexbox the height of the screen,
   and #map takes all space left after the header (flex: 1).
   100dvh ("dynamic viewport height") accounts for mobile browser toolbars;
   the 100vh line before it is the fallback for browsers that don't know dvh. */
body.map-page { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
#map { flex: 1; min-height: 0; }

/* Small "in development" bar below the map.
   line-height and padding are whole pixels on purpose: if the bar's height
   were fractional, the map would get a fractional size/position, which can
   show up as thin gaps between the map tiles. */
.notice {
  margin: 0;
  padding: 3px 16px;
  font-size: 0.75rem;
  line-height: 18px;
  text-align: center;
  font-weight: 700;
  color: #5c5030;
  background: #fff8db;
  border-top: 1px solid #f0e2a8;
}

/* Error box floating over the top centre of the map (z-index puts it above Leaflet's layers). */
.status {
  position: absolute;
  top: calc(var(--header-height) + 1rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  margin: 0;
  padding: 0.5rem 1rem;
  background: #fff3cd;
  border: 1px solid #e0c36b;
  border-radius: 4px;
}

/* usage instructions, top right of the map (built in app.js); border matches Leaflet's controls */
.help-box {
  max-width: 17rem;
  padding: 6px 10px;
  font-size: 0.8rem;
  line-height: 1.4;
  background: #ffffff;
  border: 2px solid rgba(0, 0, 0, 0.2);
  background-clip: padding-box;
  border-radius: 4px;
}
.help-box ol { margin: 0; padding-left: 1.1rem; }
.help-box li + li { margin-top: 0.2rem; }

/* popups (content built in app.js) */
.popup h3 { margin: 0 0 0.25rem; font-size: 1rem; }
.popup p { margin: 0.25rem 0; }
.popup .muted { color: var(--muted); font-size: 0.85em; }

/* about page */
.prose { max-width: 42rem; margin: 0 auto; padding: 1rem; }
.prose a { color: var(--route); }
