/* 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: 52px;
  --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; }
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: 1000;
}
.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.25rem; letter-spacing: .01em; }
.brand .mark { width: 14px; height: 22px; background: var(--blaze); border-radius: 2px; box-shadow: inset 0 0 0 2px var(--sign), inset 0 0 0 3px var(--blaze); }
.nav-links { display: flex; gap: 16px; align-items: center; font-size: .95rem; }
.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: 1100; 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); }

/* Full-screen map */
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;
}

/* Bottom sheet: paper with a sign-brown edge. Controls live in its header. */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 950;
  background: var(--paper); color: var(--ink);
  border-top: 3px solid var(--sign);
  max-height: 60vh; display: flex; flex-direction: column;
  transition: max-height .2s ease;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 0 var(--contour-2);
}
.sheet.collapsed { max-height: 118px; }
.sheet-controls { display: flex; gap: 10px; align-items: center; padding: 10px 12px 6px; flex-wrap: wrap; }
.sheet-controls .btn.primary { flex: 1 1 160px; 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); }
.sheet-controls .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) { .sheet-controls .secondary { color: var(--blaze); } }
.sheet-handle { padding: 6px 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-top: 1px solid var(--contour-2); }
.sheet-handle::after { content: ""; width: 10px; height: 10px; border-right: 2px solid var(--contour); border-bottom: 2px solid var(--contour); transform: rotate(45deg); transition: transform .2s; flex: none; margin-right: 4px; }
.sheet.collapsed .sheet-handle::after { transform: rotate(-135deg); margin-top: 6px; }
#results { list-style: none; margin: 0; padding: 0 0 10px; overflow-y: auto; overscroll-behavior: contain; }
#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 .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 .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; }

/* 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; }

/* Filters, route panel, badges */
.chips { display: flex; gap: 8px; padding: 2px 12px 8px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; 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); }
.route-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 4px 12px 10px; align-items: center; }
.route-panel .radius { grid-column: 1; }
.route-panel .btn { grid-column: 2; justify-content: center; }
@media (max-width: 480px) { .route-panel { grid-template-columns: 1fr; } .route-panel .radius, .route-panel .btn { grid-column: 1; } }
.sheet.collapsed { max-height: 172px; }
.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; }
#results .sub:empty { display: none; }

/* SOTA summits: 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; }
#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; }
.chip.program:has(input:checked) { background: var(--woodland); border-color: var(--woodland); }

.xref-badge { display: inline-block; color: var(--sign-text); background: var(--contour); border-radius: 3px; padding: 1px 7px; font-size: .8rem; font-weight: 700; }
