/* POTA Locator — topo paper, park-sign chrome, trail-blaze accent.
   Light by default: this is read outdoors in sun. */
:root {
  --paper: #f4f2ea;        /* USGS quad sheet */
  --paper-2: #ebe7dc;      /* sheet edge / rows */
  --ink: #1f1b17;
  --ink-2: #5a4d40;        /* secondary text */
  --contour: #9a6a3a;      /* hairlines, meta */
  --contour-2: #d9c6ae;    /* light rules */
  --sign: #4a3221;         /* park sign brown */
  --sign-text: #f4f2ea;
  --blaze: #f2c230;        /* trail blaze yellow */
  --blaze-ink: #1f1b17;
  --blaze-line: #c98a00;   /* trail line on the map */
  --hydro: #2f6f9f;        /* you are here */
  --woodland: #5e8a4a;     /* park boundaries */
  --danger: #a33a2b;
  --bar-h: 58px;
  --radius: 4px;
  --font-display: "Zilla Slab", "Rockwell", "Roboto Slab", Georgia, serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #17140f; --paper-2: #221d16; --ink: #ede7d8; --ink-2: #b8ab98;
    --contour: #b8875a; --contour-2: #3d3126; --sign: #2c1d12; --sign-text: #ede7d8;
    --blaze: #f2c230; --blaze-ink: #1f1b17; --blaze-line: #f2c230; --hydro: #6fa7d6; --woodland: #7fae6a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font: 17px/1.45 var(--font-body);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--sign); text-decoration-color: var(--contour); text-underline-offset: 2px; }
@media (prefers-color-scheme: dark) { a { color: var(--blaze); } }
h1, h2, h3, .display { font-family: var(--font-display); font-weight: 600; line-height: 1.15; letter-spacing: -0.005em; }
h1 { font-size: 1.9rem; margin: .4rem 0 .6rem; }
h1 small { display: block; font-family: var(--font-body); font-weight: 400; font-size: 1.05rem; color: var(--ink-2); margin-top: .2rem; }
h2 { font-size: 1.3rem; margin: 1.6rem 0 .5rem; }
p { margin: .5rem 0; max-width: 62ch; }
:focus-visible { outline: 3px solid var(--hydro); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Sign bar */
.topbar {
  height: var(--bar-h);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 14px;
  background: var(--sign); color: var(--sign-text);
  border-bottom: 3px solid var(--blaze);
  position: sticky; top: 0; z-index: 1200; /* above Leaflet controls (1000) so the menu drops over maps */
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--sign-text); text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; letter-spacing: .01em; }
.brand img { display: block; height: 46px; width: auto; }
.brand { white-space: nowrap; }
.nav-links { display: flex; gap: 16px; align-items: center; font-size: .95rem; }
.menu-btn { display: none; width: 44px; height: 40px; padding: 8px 10px; background: none; border: 2px solid transparent; border-radius: var(--radius); cursor: pointer; flex-direction: column; justify-content: space-between; }
.menu-btn span { display: block; height: 3px; background: var(--sign-text); border-radius: 2px; }
.menu-btn[aria-expanded="true"] { border-color: var(--blaze); }
@media (max-width: 720px) {
  .menu-btn { display: flex; }
  .nav-links { display: none; position: absolute; top: var(--bar-h); right: 0; left: 0; flex-direction: column; align-items: stretch; gap: 0; background: var(--sign); border-bottom: 3px solid var(--blaze); z-index: 1001; }
  .nav-links.open { display: flex; }
  .nav-links a, .nav-links form.inline, .nav-links button.linkish { display: block; padding: 14px 16px; border-top: 1px solid rgba(244, 242, 234, .15); font-size: 1.05rem; width: 100%; text-align: left; }
  .nav-links form.inline { padding: 0; }
  .nav-links form.inline button { width: 100%; }
}
.nav-links a, .nav-links button { color: var(--sign-text); text-decoration: none; }
.nav-links a:hover, .nav-links button:hover { text-decoration: underline; text-decoration-color: var(--blaze); }
form.inline { display: inline; margin: 0; }
button.linkish { background: none; border: 0; cursor: pointer; font: inherit; padding: 0; }

/* Content pages */
.page { padding: 16px 16px 40px; max-width: 880px; margin: 0 auto; }
.page.narrow { max-width: 460px; }
.meta { color: var(--ink-2); font-size: .95rem; }
.tag { display: inline-block; border: 1.5px solid var(--contour); border-radius: 3px; padding: 1px 8px; font-size: .85rem; color: var(--ink-2); }
.tag.ok { border-color: var(--woodland); color: var(--woodland); }
.mini-map { height: 46vh; min-height: 260px; border: 2px solid var(--sign); border-radius: var(--radius); margin: 14px 0; }
ul.plain { list-style: none; padding: 0; margin: .4rem 0; }
ul.plain li { padding: 6px 0; border-bottom: 1px solid var(--contour-2); }
.stack p { margin: .7rem 0; }
.stack label, .stack .helptext { display: block; color: var(--ink-2); font-size: .92rem; margin-bottom: 4px; }
input:not([type=range]):not([type=checkbox]), textarea, select {
  width: 100%; padding: 12px; font: inherit; color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--contour); border-radius: var(--radius);
}
input[type="file"] { padding: 8px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 46px; padding: 10px 16px;
  font: 600 1rem/1 var(--font-body); color: var(--ink);
  background: var(--paper); border: 2px solid var(--sign); border-radius: var(--radius);
  cursor: pointer; text-decoration: none;
}
.btn.primary { background: var(--blaze); color: var(--blaze-ink); border-color: var(--blaze-ink); }
.btn.primary:active { transform: translateY(1px); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-family: var(--font-display); font-weight: 600; color: var(--ink-2); padding: 8px 6px; border-bottom: 2px solid var(--sign); }
.table td { text-align: left; padding: 10px 6px; border-bottom: 1px solid var(--contour-2); vertical-align: top; font-variant-numeric: tabular-nums; }
.table small { color: var(--ink-2); display: block; }
.ref { font-family: var(--font-display); font-weight: 700; color: var(--sign); letter-spacing: .01em; }
@media (prefers-color-scheme: dark) { .ref { color: var(--blaze); } }
.messages { position: fixed; top: calc(var(--bar-h) + 8px); left: 50%; transform: translateX(-50%); z-index: 1300; width: min(92vw, 520px); }
.msg { background: var(--paper); color: var(--ink); border: 2px solid var(--sign); border-left-width: 8px; padding: 10px 12px; border-radius: var(--radius); margin-bottom: 6px; }
.msg.success { border-color: var(--woodland); }
.msg.error { border-color: var(--danger); } .msg.warning { border-color: var(--blaze-line); }

.site-foot { max-width: 880px; margin: 0 auto; padding: 8px 16px 24px; color: var(--ink-2); font-size: .82rem; }
.site-foot a { color: inherit; }
.panel-foot { padding: 6px 14px; font-size: .78rem; color: var(--ink-2); border-top: 1px solid var(--contour-2); }
.panel-foot a { color: inherit; }
@media (max-width: 899px) { .panel.collapsed .panel-foot { display: none; } }

/* Full-screen map + the panel. Desktop: a left column beside the map. Phone: a bottom sheet
   with a peek state that shows only the mode strip and the one button. */
body.fullmap { overflow: hidden; }
body.fullmap #map { position: fixed; top: var(--bar-h); left: 0; right: 0; bottom: 0; background: var(--paper-2); }
.zoom-hint {
  position: fixed; top: calc(var(--bar-h) + 12px); left: 50%; transform: translateX(-50%); z-index: 900;
  background: var(--paper); color: var(--ink-2); border: 1.5px solid var(--contour); border-radius: 3px; padding: 6px 12px; font-size: .92rem;
}

.panel {
  position: fixed; z-index: 950; background: var(--paper); color: var(--ink);
  display: flex; flex-direction: column;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px 6px; }
.modes { display: inline-flex; border: 2px solid var(--sign); border-radius: var(--radius); overflow: hidden; }
.mode { background: var(--paper); color: var(--ink); border: 0; font: 600 .95rem/1 var(--font-body); padding: 9px 12px; cursor: pointer; min-height: 40px; }
.mode + .mode { border-left: 2px solid var(--sign); }
.mode.active { background: var(--sign); color: var(--sign-text); }
.filters-btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 2px solid transparent; border-radius: var(--radius); color: var(--ink); font: 600 .95rem/1 var(--font-body); padding: 9px 10px; cursor: pointer; min-height: 40px; }
.filters-btn[aria-expanded="true"] { border-color: var(--sign); }
.filters-btn .count { background: var(--blaze); color: var(--blaze-ink); border-radius: 999px; padding: 1px 7px; font-size: .8rem; }
.mode-body { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 4px 12px 10px; }
.mode-body .btn.primary { flex: 1 1 200px; justify-content: center; font-size: 1.05rem; min-height: 50px; }
.radius { display: flex; align-items: center; gap: 8px; font-size: .95rem; color: var(--ink-2); white-space: nowrap; }
.radius output { font-family: var(--font-display); font-weight: 600; color: var(--ink); min-width: 3.4ch; text-align: right; font-size: 1.05rem; }
.radius input[type="range"] { width: 110px; accent-color: var(--sign); }
.secondary { background: none; border: 0; color: var(--sign); font: inherit; text-decoration: underline; text-decoration-color: var(--contour); text-underline-offset: 2px; cursor: pointer; padding: 6px 2px; }
@media (prefers-color-scheme: dark) { .secondary { color: var(--blaze); } }
.route-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 4px 12px 10px; }
.route-row { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.route-row .btn { flex: 1 1 200px; justify-content: center; }
.route-saved { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.route-saved select { width: auto; flex: 1 1 200px; padding: 8px 10px; }
.ac { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 1200; margin: 2px 0 0; padding: 0; list-style: none; background: var(--paper); border: 1.5px solid var(--sign); border-radius: var(--radius); max-height: 40vh; overflow-y: auto; }
.ac-list li { padding: 9px 12px; cursor: pointer; font-size: .95rem; border-top: 1px solid var(--contour-2); }
.ac-list li:first-child { border-top: 0; }
.ac-list li:hover, .ac-list li.active { background: var(--paper-2); }
.ac-list li small { display: block; color: var(--ink-2); font-size: .82rem; }
.filters { padding: 0 12px 8px; border-top: 1px solid var(--contour-2); }
.chips { display: flex; gap: 8px; padding: 8px 0 0; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1.5px solid var(--contour); border-radius: 999px; font-size: .9rem; color: var(--ink-2); cursor: pointer; white-space: nowrap; background: var(--paper); }
.chip input { margin: 0; accent-color: var(--sign); width: 16px; height: 16px; }
.chip:has(input:checked) { background: var(--sign); color: var(--sign-text); border-color: var(--sign); }
.chip.program:has(input:checked) { background: var(--woodland); border-color: var(--woodland); }
.sheet-handle { padding: 8px 14px 10px; font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 0; border-top: 2px solid var(--sign); background: var(--paper); color: var(--ink); text-align: left; width: 100%; }
#results { list-style: none; margin: 0; padding: 0 0 10px; overflow-y: auto; overscroll-behavior: contain; flex: 1 1 auto; min-height: 0; }
#results li { display: grid; grid-template-columns: 14px 1fr auto; column-gap: 12px; align-items: center; padding: 11px 14px; border-top: 1px solid var(--contour-2); cursor: pointer; min-height: 56px; }
#results li:hover, #results li:focus-visible { background: var(--paper-2); }
#results .blaze { width: 14px; height: 22px; border-radius: 2px; background: var(--woodland); }
#results .kind-trail .blaze { background: var(--blaze); box-shadow: inset 0 0 0 1.5px var(--blaze-line); }
#results .program-sota .blaze { width: 0; height: 0; background: none; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 14px solid var(--sign); border-radius: 0; }
#results .name { font-weight: 400; line-height: 1.25; }
#results .name .ref { margin-right: .35em; }
#results .sub { color: var(--ink-2); font-size: .88rem; margin-top: 2px; }
#results .sub:empty { display: none; }
#results .dist { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--ink); text-align: right; }
#results .dist .nav, .leaflet-popup-content .nav { display: block; font: 600 .85rem/1 var(--font-body); color: var(--hydro); text-decoration: none; margin-top: 6px; padding: 6px 0; }
.leaflet-popup-content .nav { display: inline-block; }
.onair { display: inline-block; color: #fff; background: var(--danger); border-radius: 3px; padding: 1px 7px; font-size: .8rem; font-weight: 700; }
.nfer-badge { display: inline-block; color: #fff; background: var(--hydro); border-radius: 3px; padding: 1px 7px; font-size: .8rem; font-weight: 700; }

/* Desktop: left column, map beside it, no sheet behaviour. */
@media (min-width: 900px) {
  body.fullmap #map { left: 380px; }
  .panel { top: var(--bar-h); left: 0; bottom: 0; width: 380px; border-right: 3px solid var(--sign); }
  .sheet-handle { cursor: default; }
  .zoom-hint { left: calc(380px + (100vw - 380px) / 2); }
}
/* Phone: bottom sheet. Peek shows mode strip + primary control; open shows the list. */
@media (max-width: 899px) {
  .panel { left: 0; right: 0; bottom: 0; border-top: 3px solid var(--sign); max-height: 72vh; transition: max-height .2s ease; padding-bottom: env(safe-area-inset-bottom); }
  .panel.collapsed #results { display: none; }
  .sheet-handle::after { content: ""; width: 10px; height: 10px; border-right: 2px solid var(--contour); border-bottom: 2px solid var(--contour); transform: rotate(45deg); flex: none; margin-right: 4px; }
  .panel.collapsed .sheet-handle::after { transform: rotate(-135deg); margin-top: 6px; }
  .route-panel { grid-template-columns: 1fr; }
  .mode-body .radius { flex: 1 1 100%; }
}

/* Leaflet on paper */
.leaflet-container { font-family: var(--font-body); }
.leaflet-popup-content-wrapper { background: var(--paper); color: var(--ink); border: 2px solid var(--sign); border-radius: var(--radius); box-shadow: none; }
.leaflet-popup-tip { background: var(--sign); }
.leaflet-popup-content { margin: 10px 14px; font-size: .95rem; }
.leaflet-bar a { background: var(--paper); color: var(--ink); border-bottom-color: var(--contour-2); }
.leaflet-control-layers { border: 2px solid var(--sign) !important; border-radius: var(--radius) !important; background: var(--paper); color: var(--ink); }
.leaflet-control-attribution { background: rgba(244, 242, 234, .8) !important; color: var(--ink-2); }
@media (prefers-color-scheme: dark) { .leaflet-control-attribution { background: rgba(23, 20, 15, .8) !important; } }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; }
.report-form textarea { min-height: 64px; }
.review-row form { display: inline; }
.review-row input[name=osm_id] { width: 14em; display: inline-block; padding: 6px 8px; margin-right: 4px; }
.review-row .btn { min-height: 34px; padding: 4px 10px; font-size: .9rem; }
.stale { color: var(--danger); font-weight: 700; }
.okay { color: var(--woodland); font-weight: 700; }


/* SOTA summits on the map: a brown peak */
.summit-icon { width: 0; height: 0; border-left: 9px solid transparent; border-right: 9px solid transparent; border-bottom: 16px solid #4a3221; filter: drop-shadow(0 0 1px #f4f2ea); }
.summit-icon.onair-icon { border-left-width: 11px; border-right-width: 11px; border-bottom: 20px solid #a33a2b; }

.nfer-go { font: 700 .8rem/1 var(--font-body); color: var(--hydro); background: var(--paper); border: 1.5px solid var(--hydro); border-radius: 3px; padding: 3px 7px; cursor: pointer; }
.nfer-go:hover { background: var(--hydro); color: #fff; }
.leaflet-popup-content .sub { color: var(--ink-2); font-size: .8rem; }

/* n-fer spot pins: a blue marker with the count */
.spot-pin { background: var(--hydro); border: 2px solid #f4f2ea; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); box-shadow: 0 1px 2px rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; }
.parking-pin { background: var(--hydro); color: #fff; border: 2px solid #f4f2ea; border-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; }
.parking-pin span { font: 700 .8rem/1 var(--font-body); }
.hint { color: var(--ink-2); font-size: .8rem; align-self: center; }
.spot-pin span { transform: rotate(45deg); color: #fff; font: 700 .8rem/1 var(--font-body); }
.nfer-spots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
h2 small { display: block; font-family: var(--font-body); font-weight: 400; font-size: .9rem; color: var(--ink-2); }

.chip select { width: auto; padding: 2px 4px; font-size: .85rem; border-radius: 3px; margin-left: 2px; }
.chip:has(input:checked) select { background: var(--paper); color: var(--ink); }
