/* Stigrr — map-first layout: white top bar, full-bleed map, floating left panel (bottom sheet on phones), filter chips over the map. Brand: light green and white. */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --ink: #10261a;
  --muted: #5b6b61;
  --line: #e2ebe4;
  --chip: #f1f7f2;
  --brand: #4cc764;
  --brand-dark: #1d6f33;
  --brand-soft: #ebfae6;
  --logo: #2fae4e;
  --accent: #4cc764;
  --accent-text: #1d6f33;
  --accent-line: #b9eaa9;
  --accent-soft: #f0fbea;
  --easy: #2e8b57; --moderate: #d99a0b; --hard: #d2412f;
  --error: #b42318;
  --f: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --top: 64px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--f); font-size: 15px; line-height: 1.45; }
body.map-page { overflow: hidden; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.muted { color: var(--muted); }
.error { color: var(--error); font-size: 0.9rem; margin: 4px 0 0; }
.hint { color: var(--muted); font-size: 0.82rem; margin: 2px 0 0; }

/* Top bar */
.topbar { position: fixed; z-index: 1000; left: 0; right: 0; top: 0; height: calc(var(--top) + env(safe-area-inset-top, 0px)); padding-top: env(safe-area-inset-top, 0px); padding-inline: 20px; background: var(--bg); display: flex; align-items: center; gap: 20px; border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 8px; color: var(--logo); font-weight: 800; font-size: 1.45rem; letter-spacing: -0.02em; text-decoration: none; flex-shrink: 0; }
.search { flex: 1 1 auto; max-width: 820px; min-width: 0; display: flex; align-items: center; gap: 10px; background: var(--chip); border-radius: 999px; padding: 10px 18px; }
.search svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--muted); }
.search input { border: 0; background: transparent; outline: none; width: 100%; min-width: 0; font-size: 1rem; }
.search-spacer { flex: 1; }
.nav { display: flex; align-items: center; gap: 20px; margin-left: auto; flex-shrink: 0; }
.nav .link { background: none; border: 0; font-weight: 600; cursor: pointer; padding: 4px 0; text-decoration: none; }
.nav form.inline { margin: 0; }
.pill { display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 999px; padding: 10px 20px; font-weight: 700; cursor: pointer; background: var(--brand); color: #0d3319; text-decoration: none; }
.pill:hover { background: #3db556; }
.pill.wide { width: 100%; padding: 13px; margin-top: 8px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); display: grid; place-items: center; font-weight: 800; }

/* Map */
#map { position: fixed; left: 0; right: 0; bottom: 0; top: calc(var(--top) + env(safe-area-inset-top, 0px)); background: #e7efe6; }
.maplibregl-popup-content { font-family: var(--f); font-weight: 700; font-size: 13px; padding: 7px 11px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.18); }
.maplibregl-ctrl-attrib { font-size: 10.5px; }

/* Filter chips */
.filters { position: fixed; z-index: 900; top: calc(var(--top) + env(safe-area-inset-top, 0px) + 14px); left: 456px; right: 76px; display: flex; gap: 8px; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; pointer-events: none; }
.filters::-webkit-scrollbar { display: none; }
.filters > * { pointer-events: auto; flex-shrink: 0; }
.fchip { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: 0.88rem; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,0.12); white-space: nowrap; }
.fchip select { border: 0; background: transparent; font-weight: 600; cursor: pointer; padding: 0; }
.fchip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.fchip .x { font-weight: 800; }

/* Map controls */
.ctrls { position: fixed; z-index: 900; right: 16px; top: calc(var(--top) + env(safe-area-inset-top, 0px) + 14px); display: flex; flex-direction: column; gap: 10px; }
.cbtn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,0.2); display: grid; place-items: center; cursor: pointer; font-size: 22px; font-weight: 600; }
.cbtn svg { width: 20px; height: 20px; }
.cbtn.txt { font-size: 14px; font-weight: 800; color: var(--ink); }
.cbtn.on { background: var(--brand); color: #0d3319; }
.cbtn { color: var(--ink); }
.layers-menu { position: absolute; right: 54px; top: 162px; background: #fff; border-radius: 14px; box-shadow: 0 4px 20px rgba(16,38,26,0.18); padding: 6px; display: flex; flex-direction: column; min-width: 140px; }
.layers-menu button { border: 0; background: none; text-align: left; padding: 10px 12px; border-radius: 9px; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; }
.layers-menu button:hover { background: var(--chip); }
.layers-menu button[aria-checked="true"] { background: var(--brand-soft); color: var(--brand-dark); }
.layers-menu button[aria-checked="true"]::after { content: " ✓"; }
.map-tip .maplibregl-popup-content { padding: 8px 12px; border-radius: 10px; font-family: var(--f); box-shadow: 0 2px 12px rgba(16,38,26,0.2); }
.map-tip b { display: block; color: var(--ink); font-size: 0.9rem; }
.map-tip span { color: var(--muted); font-size: 0.8rem; }
.maplibregl-ctrl-scale { border-color: var(--ink); color: var(--ink); font-family: var(--f); }
.search-area { position: fixed; z-index: 900; left: calc(50% + 218px); transform: translateX(-50%); top: calc(var(--top) + env(safe-area-inset-top, 0px) + 64px); background: #fff; border: 0; border-radius: 999px; padding: 9px 16px; font-weight: 700; box-shadow: 0 2px 10px rgba(0,0,0,0.2); cursor: pointer; }

/* Panel */
.panel { position: fixed; z-index: 950; left: 16px; top: calc(var(--top) + env(safe-area-inset-top, 0px) + 14px); bottom: 16px; width: 420px; background: #fff; border-radius: 18px; box-shadow: 0 4px 24px rgba(0,0,0,0.16); display: flex; flex-direction: column; overflow: hidden; overflow: clip; }
.panel-scroll { overflow-y: auto; flex: 1 1 auto; min-height: 0; padding: 20px 22px 24px; }
.grab { display: none; }
.list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.list-head h2 { margin: 0; font-size: 1.15rem; font-weight: 800; }
.list-head span { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.list-sub { color: var(--muted); font-size: 0.85rem; margin: 0 0 12px; }
.sort { border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; background: #fff; font-size: 0.82rem; font-weight: 600; }
.card { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 14px; padding: 12px 0; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; background: none; width: 100%; text-align: left; }
.card:hover .card-name { text-decoration: underline; }
.thumb { width: 100%; aspect-ratio: 1 / 1; border-radius: 12px; object-fit: cover; display: grid; place-items: center; background: linear-gradient(160deg, #e3f8dc, #a9e59a); color: #fff; }
.thumb svg { width: 44%; height: 44%; opacity: 0.9; }
.thumb.moderate { background: linear-gradient(160deg, #f7f0cf, #e3cf7a); }
.thumb.hard { background: linear-gradient(160deg, #f3d9d4, #dca196); }
.card-name { font-weight: 800; font-size: 1rem; margin: 2px 0; }
.card-park { color: var(--muted); font-size: 0.85rem; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 0.85rem; margin-top: 6px; }
.dot { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; }
.dot::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: currentColor; }
.dot.easy { color: var(--easy); } .dot.moderate { color: var(--moderate); } .dot.hard { color: var(--hard); }
.star { color: var(--accent); }
.why { font-size: 0.85rem; color: var(--muted); margin-top: 6px; }
.saved-mark { color: var(--accent); }
.empty { padding: 30px 0; color: var(--muted); list-style: none; }
.more { width: 100%; margin-top: 14px; }

/* Trail page */
.d-top { display: flex; justify-content: space-between; margin-bottom: 14px; }
.round { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: #fff; cursor: pointer; display: grid; place-items: center; }
.round svg { width: 18px; height: 18px; }
.d-name { font-size: 1.45rem; font-weight: 800; margin: 0; line-height: 1.2; letter-spacing: -0.01em; text-wrap: balance; }
.d-park { margin-top: 4px; display: inline-block; font-size: 0.92rem; }
.d-park a { text-underline-offset: 3px; }
.d-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.obtn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 9px 16px; background: #fff; font-weight: 700; cursor: pointer; text-decoration: none; }
.obtn svg { width: 18px; height: 18px; }
.obtn.on { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.gallery { display: grid; grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; gap: 6px; height: 220px; }
.gallery img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; min-height: 0; }
.gallery img:first-child { grid-row: span 2; }
.gallery.one { grid-template-columns: 1fr; } .gallery.one img:first-child { grid-row: span 2; }
.no-photos { height: 150px; border-radius: 12px; border: 1.5px dashed #c6d8cb; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 0.9rem; padding: 12px; }
.statrow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 22px 0 16px; }
.stat b { display: block; font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat span { color: var(--muted); font-size: 0.82rem; }
.stat svg { width: 22px; height: 22px; display: block; margin-bottom: 2px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; font-size: 0.85rem; font-weight: 600; }
.tag.muse { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-text); }
.d-desc { margin: 16px 0 0; white-space: pre-line; }
.sec { font-weight: 800; font-size: 1.05rem; margin: 26px 0 8px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sec small { font-weight: 600; color: var(--muted); font-size: 0.8rem; }
.profile { width: 100%; height: auto; display: block; }
.profile .fill { fill: #e8f5ea; } .profile .line { fill: none; stroke: var(--ink); stroke-width: 1.6; }
.profile .grid { stroke: var(--line); } .profile text { fill: var(--muted); font-size: 11px; font-family: var(--f); }
.note { font-size: 0.8rem; color: var(--muted); margin-top: 8px; }
.review { border-top: 1px solid var(--line); padding: 12px 0; }
.review-head { display: flex; justify-content: space-between; gap: 8px; font-size: 0.88rem; }
.review p { margin: 6px 0 0; white-space: pre-line; }
.rform { display: grid; gap: 8px; margin: 10px 0 4px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.stars { display: flex; gap: 2px; flex-direction: row-reverse; justify-content: flex-end; }
.stars input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.stars label { font-size: 26px; color: #cfdcd2; cursor: pointer; line-height: 1; }
.stars input:checked ~ label, .stars label:hover, .stars label:hover ~ label { color: var(--accent); }
.stars input:focus-visible + label { outline: 2px solid var(--brand); border-radius: 4px; }
.rform textarea { width: 100%; min-height: 90px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; resize: vertical; }
.rform input[type="date"] { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
.rform .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.cta { flex-shrink: 0; padding: 12px 22px calc(16px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: #fff; }
.cta a { display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--ink); color: #fff; text-decoration: none; border-radius: 999px; padding: 14px; font-weight: 700; font-size: 1.02rem; }
.cta a svg { width: 20px; height: 20px; }
.toast { position: fixed; z-index: 2000; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 0.9rem; box-shadow: 0 4px 16px rgba(0,0,0,0.25); max-width: calc(100% - 32px); text-align: center; }

/* Plain pages */
body.page { padding-top: calc(var(--top) + env(safe-area-inset-top, 0px)); background: #f5faf5; }
.auth { max-width: 420px; margin: 48px auto; padding-inline: 16px; }
.auth h1, .hikes h1 { font-size: 1.7rem; margin: 0 0 4px; letter-spacing: -0.01em; }
.form { display: grid; gap: 6px; margin: 18px 0; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.form label { font-weight: 700; font-size: 0.9rem; margin-top: 6px; }
.form input { border: 1px solid #cbdccf; border-radius: 10px; padding: 11px 12px; }
.form .helptext, .form ul { display: none; }
.hikes { max-width: 820px; margin: 36px auto; padding-inline: 16px; }
.hikes-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.hike-list { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 10px; }
.hike { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 14px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.hike svg { width: 76px; height: 76px; background: #eef7ef; border-radius: 10px; }
.hike-stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.88rem; margin-top: 4px; font-variant-numeric: tabular-nums; }

@media (max-width: 1100px) { .nav .link { display: none; } }
@media (max-width: 760px) {
  :root { --top: 58px; }
  .topbar { gap: 10px; padding-inline: 16px; }
  .logo span { display: none; }
  .nav .pill { display: none; }
  .search { padding: 9px 14px; }
  .filters { left: 16px; right: 70px; }
  .ctrls { right: 12px; top: calc(var(--top) + env(safe-area-inset-top, 0px) + 64px); }
  .cbtn { width: 40px; height: 40px; }
  .search-area { left: 50%; top: calc(var(--top) + env(safe-area-inset-top, 0px) + 64px); }
  .panel { left: 0; right: 0; width: auto; bottom: 0; top: auto; height: 50%; border-radius: 18px 18px 0 0; transition: height 0.2s; }
  .panel.tall { height: calc(100% - var(--top) - env(safe-area-inset-top, 0px) - 10px); }
  .grab { display: block; border: 0; background: none; padding: 8px 0 0; cursor: pointer; flex-shrink: 0; }
  .grab::before { content: ""; display: block; width: 44px; height: 5px; border-radius: 3px; background: #cfdcd2; margin: 0 auto; }
  .panel-scroll { padding: 10px 16px 20px; }
  .cta { padding-inline: 16px; }
  .card { grid-template-columns: 88px minmax(0, 1fr); }
  .statrow { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 14px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
