:root {
  --ink:      #17241c;
  --pine:     #2e5e43;
  --pine-deep:#21402f;
  --gold:     #f4b400;
  --gold-soft:#ffd34d;
  --paper:    #f7f4ec;
  --paper-2:  #efe9da;
  --line:     #d8cdb4;
  --shadow:   0 6px 22px rgba(23, 36, 28, .22);
  --sans:     "Barlow Condensed", "Segoe UI", system-ui, sans-serif;
  --mono:     "Space Mono", ui-monospace, "SFMono-Regular", monospace;
  --body:     ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.search:focus-within { box-shadow: 0 0 0 2px var(--gold-soft), var(--shadow); }
.search input:focus-visible { outline: none; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--pine-deep);
  color: var(--ink);
  font-family: var(--body);
}

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- Top bar ---------- */
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: linear-gradient(180deg, var(--pine) 0%, var(--pine-deep) 100%);
  color: var(--paper);
  box-shadow: 0 2px 0 rgba(0,0,0,.15), 0 8px 24px rgba(0,0,0,.18);
  z-index: 1200;
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand__mark {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--gold);
  color: var(--pine-deep);
  box-shadow: inset 0 0 0 1.5px rgba(0,0,0,.12);
}

.brand__text { display: flex; flex-direction: column; line-height: .95; }
.brand__text b {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.brand__26 { color: var(--gold-soft); }
.brand__text small {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: rgba(247,244,236,.7);
  padding-left: 2px;
}

/* ---------- Search ---------- */
.search {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(420px, 52vw);
  padding: 6px 6px 6px 12px;
  background: var(--paper);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.search__icon { color: var(--pine); flex: 0 0 auto; }
.search input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  font-family: var(--body);
  font-size: 15px;
  color: var(--ink);
  outline: none;
}
.search input::placeholder { color: #8a8672; }
.search button {
  flex: 0 0 auto;
  border: 0;
  border-radius: 7px;
  padding: 7px 14px;
  background: var(--pine);
  color: var(--paper);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .15s ease;
}
.search button:hover { background: var(--pine-deep); }
.search.is-busy button { opacity: .6; pointer-events: none; }
.search.is-error { box-shadow: 0 0 0 2px #d8563b, var(--shadow); }

/* ---------- Map ---------- */
#map {
  flex: 1 1 auto;
  min-height: 0;
  background: #dfe7e0;
  cursor: crosshair;
}

/* Jamboree footprint — the hero mark */
.j-footprint {
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.7));
}

/* ---------- Floating hint ---------- */
.hint {
  position: absolute;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 1100;
  padding: 9px 16px;
  background: rgba(23,36,28,.9);
  color: var(--paper);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: .03em;
  border-radius: 999px;
  box-shadow: var(--shadow);
  pointer-events: none;
  transition: opacity .4s ease, transform .4s ease;
}
.hint.is-hidden { opacity: 0; transform: translate(-50%, 8px); }

/* ---------- Scale control ---------- */
.leaflet-control-scale {
  margin: 0 0 14px 14px !important;
}
.leaflet-control-scale-line {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--ink);
  border-top: 0;
  border-radius: 0 0 3px 3px;
  padding: 2px 6px 1px;
  font-family: var(--mono);
  font-size: 11px;
  box-shadow: var(--shadow);
}

/* ---------- Custom map control bar ---------- */
.tool-bar { display: flex; flex-direction: column; gap: 6px; }
.tool-btn {
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  background: var(--paper);
  color: var(--pine-deep);
  border: 0;
  border-radius: 9px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .1s ease;
}
.tool-btn:hover { background: #fff; }
.tool-btn:active { transform: scale(.94); }
.tool-btn svg { width: 20px; height: 20px; }
.tool-btn.is-active { background: var(--pine); color: var(--paper); }
.tool-btn.is-disabled { opacity: .4; pointer-events: none; }
.tool-btn--clear { color: #b5462f; }

/* Rework default leaflet controls to match */
.leaflet-touch .leaflet-bar,
.leaflet-bar { border: 0; box-shadow: var(--shadow); border-radius: 9px; overflow: hidden; }
.leaflet-bar a {
  background: var(--paper);
  color: var(--pine-deep);
  border-bottom-color: var(--line);
  width: 34px; height: 34px; line-height: 34px;
}
.leaflet-bar a:hover { background: #fff; color: var(--ink); }
.leaflet-control-attribution {
  background: rgba(247,244,236,.85) !important;
  font-family: var(--body);
  border-radius: 6px 0 0 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 620px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 8px 12px; }
  .brand__text b { font-size: 19px; }
  .search { margin-left: 0; width: 100%; order: 3; }
}

/* Landscape phones: keep the whole tool bar on screen. */
@media (max-height: 460px) {
  .tool-bar { gap: 4px; }
  .tool-btn { width: 34px; height: 34px; }
  .tool-btn svg { width: 17px; height: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .hint { transition: none; }
}
