:root {
  --ink: #1b2430;
  --muted: #5d6b7a;
  --line: #d8dee6;
  --paper: #ffffff;
  --wash: #f4f6f9;
  --accent: #2b6c4f;
  --accent-dark: #1f5039;
  --masthead-bg: #2b6c4f;
  --primary-bg: #2b6c4f;
  --primary-ink: #ffffff;
  --thistle: #7b4b8a;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(27, 36, 48, 0.12);
}

* { box-sizing: border-box; }

/* Class selectors like .summary{display:grid} outrank the user agent's
   [hidden]{display:none}, so panels marked hidden would otherwise still
   show. Keep the attribute authoritative. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--wash);
}

a { color: var(--accent-dark); }

/* Fifty map pins sit between the controls and the checklist in the tab order. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 2000;
  padding: 0.6rem 0.9rem;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--accent);
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* A visible, high-contrast focus ring; the browser default sits poorly on
   the green button. */
:focus-visible {
  outline: 3px solid var(--thistle);
  outline-offset: 2px;
}

.masthead {
  background: var(--masthead-bg);
  color: #fff;
  padding: 1.1rem 1.25rem;
}
.masthead h1 { margin: 0; font-size: 1.4rem; letter-spacing: -0.01em; }
.masthead p { margin: 0.25rem 0 0; font-size: 0.92rem; opacity: 0.92; }
.masthead a { color: #fff; }

/* Trail progress. Two segments in one track: what is collected, and what the
   route on screen would add to it, so a single walk reads as a bite out of the
   91 rather than an unrelated number. */
.progress-panel {
  padding: 0.7rem 1.25rem 0;
}
.progress-track {
  display: flex;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--line);
}
.progress-done { background: var(--accent); transition: width 0.25s; }
.progress-plan {
  background: repeating-linear-gradient(
    135deg, var(--accent) 0 4px, transparent 4px 8px
  );
  opacity: 0.55;
  transition: width 0.25s;
}
.progress-caption {
  margin: 0.35rem 0 0;
  font-size: 0.86rem;
  color: var(--muted);
}
.progress-caption strong { color: var(--ink); font-weight: 700; }
.progress-caption span:not(:empty)::before { content: ' — '; }
.progress-panel.complete .progress-done { background: var(--thistle); }

main {
  display: grid;
  grid-template-columns: 340px 340px 1fr;
  gap: 1rem;
  padding: 1rem;
  align-items: start;
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
}
.panel h2 { margin: 0 0 0.75rem; font-size: 1.05rem; }

#map {
  height: calc(100vh - 12.5rem);
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--paper);
}

.legend {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.legend li { display: flex; align-items: center; gap: 0.35rem; }
.legend .pin { width: 20px; height: 20px; font-size: 0.62rem; flex: 0 0 20px; }

.stale-notice {
  margin: 0 0 0.75rem;
  padding: 0.45rem 0.6rem;
  border-radius: 7px;
  background: #fdf3d8;
  border: 1px solid #e6cd8a;
  color: #6b4e12;
  font-size: 0.85rem;
}
/* The summary fades, the itinerary does not. Ticking a Scottie off mid-walk
   does make the totals stale, but it must not grey out the list of directions
   the user is standing in the street navigating by. */
.results.stale .summary { opacity: 0.5; }

.access-notice {
  margin: 0 0 0.75rem;
  padding: 0.45rem 0.6rem;
  border-radius: 7px;
  background: #eaf1fb;
  border: 1px solid #b7cdeb;
  color: #23405f;
  font-size: 0.84rem;
}

/* An overrun has to be readable beside the estimate that overruns, not only
   in the status line a panel away. */
.limit-notice {
  margin: 0 0 0.75rem;
  padding: 0.45rem 0.6rem;
  border-radius: 7px;
  background: #fbecea;
  border: 1px solid #e3b4ac;
  color: #8a2b1b;
  font-size: 0.84rem;
}

.tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0 0.35rem;
  border-radius: 4px;
  background: #eaf1fb;
  color: #23405f;
  font-size: 0.74rem;
  white-space: nowrap;
}

.field { margin-bottom: 1rem; border: 0; padding: 0; }
.field > label, .field legend, .field summary {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  cursor: default;
}
/* display:block drops the default disclosure triangle, leaving this looking
   like a heading rather than something you can open. */
.field summary { cursor: pointer; list-style: none; }
.field summary::-webkit-details-marker { display: none; }
.field summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 0.35rem;
  color: var(--muted);
  transition: transform 0.15s;
}
details[open] > summary::before { transform: rotate(90deg); }

.row { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.4rem; flex-wrap: wrap; }
.unit { color: var(--muted); font-size: 0.88rem; }

input[type="search"], input[type="number"] {
  flex: 1 1 6rem;
  min-width: 0;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
  background: #fff;
  color: inherit;
}
input[type="number"] { flex: 0 0 5.5rem; }
input[type="range"] { width: 100%; accent-color: var(--accent); }

button, .actions a {
  font: inherit;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .actions a:hover { background: var(--wash); }
button[aria-pressed="true"] { background: var(--thistle); border-color: var(--thistle); color: #fff; }

button.primary {
  width: 100%;
  background: var(--primary-bg);
  border-color: var(--primary-bg);
  color: var(--primary-ink);
  font-weight: 600;
  padding: 0.6rem;
}
button.primary:hover { filter: brightness(0.92); }
button:disabled { opacity: 0.55; cursor: progress; }

/* Comfortable targets for a thumb outdoors, not 13px browser defaults. */
input[type="checkbox"], input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex: 0 0 auto;
  margin: 0;
}
.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 28px;
  font-weight: 400;
  font-size: 0.92rem;
  cursor: pointer;
}
.hint { color: var(--muted); font-size: 0.85rem; margin: 0.4rem 0 0; }
/* The preset's effect, stated where it is chosen. Someone taking a class out
   needs to see that "a school group" means 2.5 km/h before they trust an
   estimate built on it. */
#party-hint, #aim-hint { font-style: italic; }
.status { min-height: 1.2rem; font-size: 0.88rem; margin: 0.6rem 0 0; }
.status.error { color: #a3301f; }

.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; margin-bottom: 0.85rem; }
.stat {
  background: var(--wash);
  border-radius: 8px;
  padding: 0.5rem 0.25rem;
  text-align: center;
  overflow: hidden;
}
.stat-value {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent-dark);
  white-space: nowrap;
  letter-spacing: -0.02em;
}
.stat-label { display: block; font-size: 0.72rem; color: var(--muted); }
.stat.over { background: #fbecea; box-shadow: inset 0 0 0 1px #e3b4ac; }
.stat.over .stat-value { color: #a3301f; }

.itinerary { list-style: none; margin: 0; padding: 0; max-height: 46vh; overflow-y: auto; }
.itinerary li {
  display: flex;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}
.itinerary li:first-child { border-top: 0; }
.step-number {
  flex: 0 0 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.step-number.done { background: var(--thistle); }
.step-body { flex: 1; min-width: 0; }
.step-name { font-weight: 600; }
.step-meta { color: var(--muted); font-size: 0.82rem; }

/* Recording a find has to be possible from the itinerary, because that is what
   the user is looking at while standing in front of the sculpture. Hunting the
   name down in an alphabetical list of 91 is not a thing anyone does outdoors. */
.step-scotties { margin: 0.3rem 0 0; padding: 0; list-style: none; font-size: 0.84rem; }
.step-scotties li { display: flex; align-items: center; gap: 0.45rem; min-height: 28px; }
.step-scotties input[type="checkbox"] { cursor: pointer; }
.step-scotties li.found label { text-decoration: line-through; opacity: 0.6; }
.step-scotties label { cursor: pointer; }
.step-scotties a { color: var(--muted); text-decoration: none; font-size: 0.9em; }
.step-scotties a:hover { color: var(--accent-dark); }

.collect-stop {
  margin-top: 0.35rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.82rem;
  border-color: var(--accent);
  color: var(--accent-dark);
}
.collect-stop[disabled] { opacity: 1; cursor: default; border-color: var(--line); color: var(--muted); }

.next-walk { margin-top: 0.35rem; padding: 0.3rem 0.6rem; font-size: 0.82rem; }

.empty { color: var(--muted); font-size: 0.9rem; }

/* Only on paper. Shown by the print block at the foot of this file. */
.print-only { display: none; }

.actions { display: flex; gap: 0.5rem; margin-top: 0.85rem; flex-wrap: wrap; }

.collected { margin: 0 1rem 1rem; }
/* Columns here have to wrap downwards, not sideways. A multi-column list
   under a height cap spills into further columns off to the right, and
   `overflow-y: auto` quietly makes the x-axis scrollable too, so 60 of the 91
   Scotties sat behind a horizontal scrollbar that macOS does not draw until
   you are already scrolling. Grid wraps the way the max-height assumes. */
.checklist {
  margin-top: 0.7rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  column-gap: 1rem;
  max-height: 320px;
  overflow-y: auto;
}
.checklist label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.87rem;
  min-height: 28px;
  padding: 0.12rem 0;
  cursor: pointer;
}
.checklist .place { color: var(--muted); }
.checklist label[hidden] { display: none !important; }

/* Clearing a campaign's worth of ticks on one mis-tap, next to a search box
   and a scrolling list, needed a step in between. A modal dialog would block
   the page, so the button arms itself instead. */
#clear-collected.armed {
  border-color: #a3301f;
  color: #a3301f;
  font-weight: 600;
}

#checklist-search { flex: 1 1 100%; }

footer {
  padding: 0 1.25rem 1.5rem;
  color: var(--muted);
  font-size: 0.82rem;
}
footer p { margin: 0.3rem 0; }
footer .build { font-size: 0.76rem; opacity: 0.8; }
footer .build code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Map markers */
.pin {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  background: #97a2ae;
}
/* Route pins are square as well as green, so the two kinds stay apart for
   anyone who cannot rely on the colour difference. */
.pin.on-route {
  background: var(--accent);
  border-radius: 6px;
  width: 28px;
  height: 28px;
}
/* The start already carries its own glyph, so colour is not doing the work. */
.pin.start { background: var(--thistle); }
.leaflet-popup-content { font-size: 0.88rem; }
.leaflet-popup-content h3 { margin: 0 0 0.25rem; font-size: 0.95rem; }
.leaflet-popup-content ul { margin: 0.2rem 0 0; padding-left: 1.1rem; }

/* On a phone the map is the interface, so a find has to be recordable from the
   pin you just tapped, not only from the list below it. */
.popup-scotties { list-style: none; padding: 0 !important; margin: 0.35rem 0 0 !important; }
.popup-scottie { display: flex; align-items: center; gap: 0.4rem; min-height: 28px; }
.popup-scottie label { cursor: pointer; }
.popup-scottie.found label { text-decoration: line-through; opacity: 0.6; }
.popup-scottie a { color: var(--muted); text-decoration: none; }
.popup-hint { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.78rem; }

@media (max-width: 1100px) {
  main { grid-template-columns: 1fr 1fr; }
  .map-wrap { grid-column: 1 / -1; }
  #map { height: 60vh; }
}
@media (max-width: 720px) {
  main { grid-template-columns: 1fr; }
  #map { height: 55vh; min-height: 320px; }
  .itinerary { max-height: none; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e7ecf2;
    --muted: #9aa7b5;
    --line: #33404f;
    --paper: #1c242e;
    --wash: #141a21;
    --accent: #3f8f68;
    --accent-dark: #56ab82;
    --thistle: #a374b3;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    /* White on the light green failed AA, so the masthead goes darker and
       the primary button flips to dark text on a light green. */
    --masthead-bg: #1a3327;
    --primary-bg: #6fca9b;
    --primary-ink: #0d2419;
  }
  input[type="search"], input[type="number"], button, .actions a {
    background: #232d38;
    color: var(--ink);
  }
  .stat { background: #232d38; }
  .status.error { color: #ff9c8a; }
  .leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--paper); color: var(--ink); }
  .stale-notice { background: #3a3018; border-color: #6b5a2c; color: #f0dca6; }
  .access-notice, .tag { background: #1e2c3d; border-color: #35506f; color: #bcd4f0; }
  .limit-notice { background: #3d2320; border-color: #7a4038; color: #ffb9ac; }
  #clear-collected.armed { border-color: #ff9c8a; color: #ff9c8a; }
  .stat.over { background: #3d2320; box-shadow: inset 0 0 0 1px #7a4038; }
  .stat.over .stat-value { color: #ff9c8a; }
}

/* A walk led by several adults is planned once and carried by all of them, so
   the plan has to survive a printer. Untouched, it did not: the itinerary sits
   under `max-height: 46vh; overflow-y: auto`, and a printer honours that, so a
   three-stop class walk came out on paper with five of its seven sculptures at
   Buchanan Galleries simply missing -- cut off mid-name. The rest of the sheet
   was a blank map and a truncated alphabetical list of all 91.

   This block must stay last: it re-declares the light palette, because a
   teacher printing in dark mode would otherwise get pale grey ink on white. */
@media print {
  :root {
    --ink: #1b2430;
    --muted: #45525f;
    --line: #b9c2cd;
    --paper: #ffffff;
    --wash: #ffffff;
    --accent: #1f5039;
    --accent-dark: #1f5039;
    --thistle: #5c3568;
    --shadow: none;
  }

  @page { margin: 14mm; }

  body { background: #fff; color: var(--ink); font-size: 11pt; }

  /* Ink on paper, not a green banner. */
  .masthead { background: #fff; color: var(--ink); padding: 0 0 0.4rem; }
  .masthead a, footer a { color: var(--ink); text-decoration: none; }
  .masthead p { font-size: 0.9em; }

  /* The controls have been used, the map does not survive the printer, and a
     paper plan for one walk is not the place for all 91 names. */
  .skip-link,
  .progress-panel,
  .panel[aria-labelledby="plan-heading"],
  .map-wrap,
  .collected,
  .actions,
  .legend,
  .collect-stop,
  .next-walk,
  .step-scotties a { display: none; }

  main { display: block; padding: 0; }
  .results { border: 0; box-shadow: none; padding: 0; }
  .results h2 { font-size: 1.15em; }

  /* The whole reason a printed plan was unusable. */
  .itinerary { max-height: none; overflow: visible; }
  /* A stop and its sculptures belong on one page. */
  .itinerary li, .stat { break-inside: avoid; }

  #route-origin { display: block; color: var(--muted); margin: 0 0 0.7rem; font-size: 0.92em; }

  /* Backgrounds a printer would either drop or render as grey mud. */
  .stat { background: #fff; border: 1px solid var(--line); }
  .access-notice, .limit-notice, .stale-notice, .tag {
    background: #fff;
    border: 1px solid var(--line);
    color: var(--ink);
  }
  /* Ticking off on the walk happens in pen, so leave the boxes empty and big
     enough to hit. Struck-through names would be last week's sheet. */
  .step-scotties li.found label { text-decoration: none; opacity: 1; }
  .step-scotties input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 12pt;
    height: 12pt;
    border: 1px solid var(--ink);
    border-radius: 2px;
  }

  footer { padding: 0.6rem 0 0; font-size: 0.75em; }
  footer .build { display: none; }
}
