/* trailspage — "Trail Almanac": a warm-dark field-guide planner.
   Fraunces (display) + Hanken Grotesk (body), forest-slate palette, faint
   topographic texture, a 50/50 map+panel Plan view. */
:root {
  --bg0: #10130f;   /* near-black, faintly warm-green */
  --bg1: #161b14;   /* header / panel */
  --bg2: #1d241a;   /* lifted cards */
  --bg3: #232c1f;
  --line: #2c3527;
  --ink: #edf1e8;
  --muted: #98a48c;
  --faint: #6c7763;
  --accent: #5fb98a;
  --accent-ink: #07220f;
  /* category accents */
  --c-trail: #93b39c;
  --c-brewery: #e3a258;
  --c-camp: #5cc08a;
  --c-food: #e08aa6;
  --c-lodge: #d8b15f;
  /* weather verdicts */
  --wx-go: #5fb07f;
  --wx-iffy: #d9a94f;
  --wx-wet: #5f95cf;

  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Hanken Grotesk", system-ui, -apple-system, sans-serif;
  --topo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.035' stroke-width='1'%3E%3Cpath d='M-20 60 C 40 20 120 100 180 60 S 300 20 340 60'/%3E%3Cpath d='M-20 110 C 40 70 120 150 180 110 S 300 70 340 110'/%3E%3Cpath d='M-20 160 C 40 120 120 200 180 160 S 300 120 340 160'/%3E%3Cpath d='M-20 210 C 40 170 120 250 180 210 S 300 170 340 210'/%3E%3C/g%3E%3C/svg%3E");
}

/* category color binding: any .grp-X subtree exposes --c */
.grp-trail { --c: var(--c-trail); }
.grp-brewery { --c: var(--c-brewery); }
.grp-camp { --c: var(--c-camp); }
.grp-food { --c: var(--c-food); }
.grp-lodge { --c: var(--c-lodge); }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg0);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* header */
#bar {
  display: flex; align-items: center; gap: 16px;
  padding: 11px 18px;
  background: var(--bg1) var(--topo);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
#bar h1 {
  margin: 0; font-family: var(--display); font-weight: 600;
  font-size: 1.3rem; letter-spacing: .01em; color: var(--ink);
}
#bar h1::before {
  content: ""; display: inline-block; width: 16px; height: 12px; margin-right: 8px;
  vertical-align: -1px;
  background: no-repeat center/contain
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 18'%3E%3Cpath d='M2 16 L9 4 L13 11 L16 6 L22 16 Z' fill='none' stroke='%235fb98a' stroke-width='1.6' stroke-linejoin='round'/%3E%3C/svg%3E");
}
#tabs { display: flex; gap: 5px; }
.tab {
  font-family: var(--sans); background: transparent; color: var(--muted);
  border: 1px solid var(--line); border-radius: 8px; padding: 5px 14px;
  font-size: .84rem; cursor: pointer; transition: color .15s, background .15s;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); font-weight: 600; }
#status { margin-left: auto; color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }

/* stage = map (+ plan panel) */
#stage { flex: 1 1 auto; min-height: 0; display: flex; }
#map { flex: 1 1 0; min-height: 0; min-width: 0; }
.leaflet-container { background: var(--bg1); font-family: var(--sans); }

/* ───────── Plan panel: 50% of the page, fixed header / scroll body / footer ───────── */
#panel {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column;
  background: var(--bg1);
  border-left: 1px solid var(--line);
  font-size: .88rem;
}
#panel[hidden] { display: none; }

/* fixed header: search + trip dates */
.p-fixed { flex: 0 0 auto; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--bg1) var(--topo); }
.p-search { position: relative; display: flex; gap: 7px; margin-bottom: 10px; }
.p-search-ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; fill: none; stroke: var(--faint); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.p-search input {
  flex: 1 1 auto; min-width: 0; background: var(--bg0); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px 9px 33px; font: inherit; font-size: .86rem;
}
.p-search input::placeholder { color: var(--faint); }
.p-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.p-search button { flex: 0 0 auto; background: var(--accent); color: var(--accent-ink); border: none; border-radius: 10px; padding: 0 16px; font: inherit; font-weight: 600; cursor: pointer; }
.p-search button:hover { filter: brightness(1.07); }
.p-dates { display: flex; align-items: center; gap: 8px; }
.p-dates-l { font-family: var(--display); font-weight: 500; color: var(--muted); font-size: .9rem; }
.p-dates input[type=date] { background: var(--bg0); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; font: inherit; font-size: .8rem; color-scheme: dark; }
.p-dates input[type=date]:focus { outline: none; border-color: var(--accent); }
.p-dash { color: var(--faint); }
.p-dlen { margin-left: auto; color: var(--accent); font-size: .76rem; font-weight: 500; }

/* scroll body */
.p-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }

/* collapsible weather zone */
.zone { border-bottom: 1px solid var(--line); }
.zone-h { display: flex; align-items: center; width: 100%; gap: 8px; background: transparent; border: none; color: var(--ink); padding: 10px 14px; font: inherit; cursor: pointer; }
.zone-t { font-family: var(--display); font-weight: 600; font-size: .92rem; }
.zone-chev { width: 16px; height: 16px; margin-left: auto; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.wx-zone.collapsed .zone-chev { transform: rotate(-90deg); }
.zone-c { padding: 0 10px 10px; }
.wx-zone.collapsed .zone-c { display: none; }

/* weather table: days down (nearest at top), windows across (morning → night) */
.wx-table { display: flex; flex-direction: column; gap: 5px; }
.wx-hrow, .wx-drow { display: grid; grid-template-columns: 54px repeat(4, 1fr); gap: 5px; }
.wx-drow { opacity: 0; animation: rise .4s cubic-bezier(.2,.7,.2,1) forwards; }
.wx-hcell { text-align: center; color: var(--muted); font-size: .64rem; text-transform: uppercase; letter-spacing: .03em; padding-bottom: 1px; }
.wx-cday { display: flex; flex-direction: column; justify-content: center; line-height: 1.15; }
.wx-cday b { font-family: var(--display); font-weight: 600; font-size: .98rem; color: var(--ink); }
.wx-cday i { font-style: normal; color: var(--faint); font-size: .68rem; }
.wx-cday u { text-decoration: none; color: var(--muted); font-size: .66rem; font-variant-numeric: tabular-nums; }
.wx-cell {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 5px 2px; border-radius: 9px; background: var(--bg2);
  border: 1px solid var(--line); border-top: 3px solid var(--line);
}
.wx-cell.wx-go { border-top-color: var(--wx-go); }
.wx-cell.wx-iffy { border-top-color: var(--wx-iffy); }
.wx-cell.wx-wet { border-top-color: var(--wx-wet); }
.wx-ico { display: inline-flex; color: var(--muted); }
.wx-cell.wx-go .wx-ico { color: var(--wx-go); }
.wx-cell.wx-iffy .wx-ico { color: var(--wx-iffy); }
.wx-cell.wx-wet .wx-ico { color: var(--wx-wet); }
.wx-ico .i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.wx-t { color: var(--ink); font-size: .82rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.wx-p { color: var(--faint); font-size: .64rem; font-variant-numeric: tabular-nums; }
.wx-cell.wx-wet .wx-p { color: var(--wx-wet); }
.wx-cell.wx-na { display: flex; align-items: center; justify-content: center; color: var(--faint); background: var(--bg1); border-top-color: var(--line); }
.wx-empty { color: var(--faint); font-size: .82rem; padding: 6px 2px; }

/* sticky category filter bar */
.filterbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 9px 12px;
  background: var(--bg1);
  border-bottom: 1px solid var(--line);
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg2); color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 11px; font: inherit; font-size: .78rem; cursor: pointer;
  transition: color .12s, background .12s, border-color .12s;
}
.chip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); opacity: .4; }
.chip.on { color: var(--ink); border-color: color-mix(in srgb, var(--c) 55%, var(--line)); background: color-mix(in srgb, var(--c) 13%, var(--bg2)); }
.chip.on .chip-dot { opacity: 1; }
.chip-n { color: var(--faint); font-size: .72rem; font-variant-numeric: tabular-nums; }

/* grouped places list */
.places { padding-bottom: 8px; }
.group-h { display: flex; align-items: center; gap: 9px; padding: 9px 14px 3px; }
.group-rule { width: 9px; height: 9px; border-radius: 3px; background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); }
.group-t { font-family: var(--display); font-weight: 600; font-size: .96rem; color: var(--ink); }
.group-n { margin-left: auto; color: var(--faint); font-size: .75rem; font-variant-numeric: tabular-nums; }
.p-list { list-style: none; margin: 0; padding: 0 10px; }
.p-row { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 9px; cursor: pointer; }
.p-row:hover { background: var(--bg2); }
.p-dot { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--c, #889); }
.p-row-main { flex: 1 1 auto; min-width: 0; }
.p-name { display: block; color: var(--ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-meta { display: block; color: var(--faint); font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-dist { flex: 0 0 auto; color: var(--muted); font-size: .74rem; font-variant-numeric: tabular-nums; }
.star { flex: 0 0 auto; background: none; border: none; color: #4d5847; font-size: 1.05rem; cursor: pointer; line-height: 1; padding: 2px 4px; transition: color .12s, transform .1s; }
.star:hover { color: var(--muted); transform: scale(1.15); }
.star.on { color: var(--c-lodge); }
.p-empty { color: var(--faint); font-size: .8rem; padding: 3px 16px 8px; }
.p-empty-big { padding: 24px 16px; text-align: center; }
.p-more { color: var(--muted); font-size: .74rem; padding: 4px 18px 6px; }

/* trail detail view */
.detail { padding: 12px 16px 18px; }
.detail-back { background: none; border: none; color: var(--accent); font: inherit; font-size: .82rem; cursor: pointer; padding: 0 0 8px; }
.detail-back:hover { text-decoration: underline; }
.detail-name { font-family: var(--display); font-weight: 600; font-size: 1.5rem; line-height: 1.15; margin: 2px 0 8px; color: var(--ink); }
.detail-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.badge { font-size: .74rem; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); }
.badge-act { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); font-weight: 600; }
.badge-act.act-bike { background: #5eead4; border-color: #5eead4; }
.badge-act.act-both { background: #a5b4fc; border-color: #a5b4fc; }
.badge-diff { color: var(--ink); background: var(--bg2); }
.badge-route { color: var(--c-trail); background: var(--bg2); border-color: color-mix(in srgb, var(--c-trail) 50%, var(--line)); }
.badge-cat { color: var(--ink); font-weight: 600; background: color-mix(in srgb, var(--c) 20%, var(--bg2)); border-color: color-mix(in srgb, var(--c) 45%, var(--line)); }
.detail-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 0 0 14px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.detail-stats > div { background: var(--bg1); padding: 9px 12px; }
.detail-stats dt { color: var(--faint); font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.detail-stats dd { margin: 0; color: var(--ink); font-size: .92rem; }
.detail-desc { margin: 0 0 14px; font-size: .9rem; line-height: 1.5; color: var(--muted); }
.detail-near { margin-bottom: 14px; }
.detail-near-h { font-family: var(--display); font-weight: 600; font-size: .9rem; color: var(--ink); margin-bottom: 6px; }
.near-row { display: flex; align-items: center; gap: 9px; width: 100%; background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; margin-bottom: 5px; font: inherit; cursor: pointer; text-align: left; }
.near-row:hover { border-color: color-mix(in srgb, var(--c) 50%, var(--line)); }
.near-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--c, #889); }
.near-name { flex: 1 1 auto; min-width: 0; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.near-d { flex: 0 0 auto; color: var(--muted); font-size: .76rem; font-variant-numeric: tabular-nums; }
.detail-links { display: flex; gap: 14px; margin-bottom: 16px; }
.detail-links a { color: var(--accent); text-decoration: none; font-size: .84rem; }
.detail-links a:hover { text-decoration: underline; }
.detail-save { width: 100%; background: var(--bg2); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 10px; font: inherit; font-size: .88rem; cursor: pointer; }
.detail-save:hover { border-color: var(--c-lodge); }
.detail-save.on { color: var(--c-lodge); border-color: color-mix(in srgb, var(--c-lodge) 50%, var(--line)); }

/* shortlist drawer (footer) */
.p-foot { flex: 0 0 auto; border-top: 1px solid var(--line); background: var(--bg2) var(--topo); padding: 9px 13px; max-height: 36%; overflow-y: auto; }
.sl-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.sl-t { font-family: var(--display); font-weight: 600; font-size: .96rem; color: var(--ink); }
.sl-n { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 7px; font-size: .72rem; font-weight: 700; }
.sl-mi { margin-left: auto; color: var(--accent); font-size: .8rem; font-weight: 500; }
.sl-empty { color: var(--faint); font-size: .8rem; }
.sl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sl-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg1); border: 1px solid var(--line); border-radius: 999px; padding: 3px 5px 3px 9px; font-size: .77rem; }
.sl-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c, #889); }
.sl-name { color: var(--ink); cursor: pointer; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-name:hover { color: var(--accent); }
.sl-x { background: none; border: none; color: var(--faint); cursor: pointer; font-size: 1.05rem; line-height: 1; padding: 0 3px; }
.sl-x:hover { color: var(--ink); }

/* scrollbars */
.p-body::-webkit-scrollbar, .wx-strip::-webkit-scrollbar, .p-foot::-webkit-scrollbar { height: 8px; width: 9px; }
.p-body::-webkit-scrollbar-thumb, .wx-strip::-webkit-scrollbar-thumb, .p-foot::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
.p-body::-webkit-scrollbar-thumb:hover { background: #3a4533; }

@keyframes rise { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

/* dark map popups (Map + Plan) */
.leaflet-popup-content-wrapper { background: var(--bg2); color: var(--ink); border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 8px 28px rgba(0,0,0,.45); }
.leaflet-popup-content { margin: 11px 14px; }
.leaflet-popup-tip { background: var(--bg2); border: 1px solid var(--line); }
.leaflet-container a.leaflet-popup-close-button { color: var(--faint); }
.trail-pop { min-width: 190px; }
.trail-pop-name { font-family: var(--display); font-weight: 600; font-size: 1rem; margin-bottom: 2px; color: var(--ink); }
.trail-pop-meta { color: var(--muted); font-size: .8rem; margin-bottom: 6px; }
.trail-pop-blurb { margin: 0 0 8px; font-size: .84rem; line-height: 1.4; color: var(--ink); }
.trail-pop a.osm { font-size: .8rem; color: var(--accent); text-decoration: none; }
.trail-pop a.osm:hover { text-decoration: underline; }

/* ───────────────── mobile (phones): stack map over panel ───────────────── */
@media (max-width: 760px) {
  #bar { padding: 9px 13px; gap: 11px; }
  #bar h1 { font-size: 1.12rem; }
  #bar h1::before { width: 14px; height: 11px; margin-right: 6px; }
  .tab { padding: 6px 13px; font-size: .82rem; }
  #status { display: none; }   /* free up header space on small screens */

  /* Plan/Trip views: map on top, panel below (both visible, panel scrolls). */
  body.plan-mode #stage, body.trip-mode #stage { flex-direction: column; }
  body.plan-mode #map, body.trip-mode #map { flex: 0 0 auto; height: 44vh; min-height: 200px; }
  #panel { width: auto; border-left: none; border-top: 1px solid var(--line); }

  /* header inputs: 16px font stops iOS from zooming on focus */
  .p-fixed { padding: 11px 13px; }
  .p-search input { font-size: 16px; padding: 10px 12px 10px 34px; }
  .p-search button { padding: 0 18px; }
  .p-dates input[type=date] { font-size: 16px; padding: 7px 9px; }

  /* roomier touch targets */
  .chip { padding: 7px 13px; font-size: .8rem; }
  .p-row { padding: 10px 8px; }
  .star { font-size: 1.2rem; padding: 4px 6px; }
  .near-row { padding: 11px 11px; }
  .sec-toggle { padding: 11px 14px; }
  .sl-chip { padding: 5px 6px 5px 11px; font-size: .82rem; }
  .detail-save { padding: 13px; }

  /* weather table: tighter day column, single-column stats in detail */
  .wx-hrow, .wx-drow { grid-template-columns: 42px repeat(4, 1fr); gap: 3px; }
  .wx-cell { padding: 5px 1px; border-radius: 8px; }
  .wx-cday b { font-size: .92rem; }
  .detail-stats { grid-template-columns: 1fr; }
  .detail-name { font-size: 1.35rem; }

  /* shortlist drawer a touch taller so chips are reachable */
  .p-foot { max-height: 42%; }
}

/* ───────────────── tablets: desktop-style side-by-side, touch-sized ─────────────────
   Touch devices wider than a phone — iPads in either orientation (iPad Safari
   reports `pointer: coarse` even in "desktop site" mode) and touch laptops.
   Per Dan's ask ("like the desktop") this KEEPS the default 50/50 map+panel
   split — it only grows hit targets and pushes inputs to 16px so iOS won't zoom
   on focus. Desktops (pointer: fine) are untouched; phones keep the stacked
   layout above. */
@media (min-width: 761px) and (pointer: coarse) {
  /* header: comfier targets; #status stays visible (there's room, unlike phones) */
  #bar { padding: 12px 20px; gap: 18px; }
  .tab { padding: 8px 18px; font-size: .9rem; }

  /* fixed header inputs — 16px stops iOS from zooming on focus */
  .p-search input { font-size: 16px; padding: 11px 13px 11px 34px; }
  .p-search button { padding: 0 20px; }
  .p-dates { flex-wrap: wrap; row-gap: 7px; }   /* never overflow a portrait panel */
  .p-dates input[type=date] { font-size: 16px; padding: 8px 11px; }
  .p-dates-l { font-size: .95rem; }

  /* roomier touch targets through the panel */
  .zone-h { padding: 13px 16px; }
  .zone-t { font-size: .98rem; }
  .chip { padding: 8px 14px; font-size: .82rem; }
  .p-row { padding: 11px 10px; gap: 11px; }
  .p-name { font-size: .96rem; }
  .star { font-size: 1.25rem; padding: 5px 8px; }
  .near-row { padding: 12px 13px; }
  .detail-back { padding: 4px 0 10px; font-size: .86rem; }
  .detail-links a { font-size: .9rem; }
  .detail-save { padding: 14px; }
  .sl-chip { padding: 6px 7px 6px 12px; font-size: .84rem; }
  .sl-name { max-width: 200px; }
  .sl-x { font-size: 1.2rem; padding: 2px 6px; }

  /* a touch larger section + weather text at arm's length */
  .group-t { font-size: 1rem; }
  .wx-t { font-size: .86rem; }
  .wx-cday b { font-size: 1rem; }
}

/* ====================================================================== */
/* Trip tab — curated guide (rendered by trip.js into #panel)             */
/* ====================================================================== */
body.trip-mode #panel { display: block; overflow-y: auto; }
.trip-root { padding: 16px 16px 28px; }
.trip-error { padding: 24px; color: var(--wx-wet); }
.trip-empty { color: var(--muted); font-size: .86rem; padding: 6px 0; }

.trip-openmap {
  width: 100%; margin-bottom: 16px; padding: 10px 12px;
  background: var(--bg2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 9px; font: 600 .86rem var(--sans); cursor: pointer; text-align: left;
}
.trip-openmap:hover { border-color: var(--accent); color: var(--accent); }

/* hero */
.trip-hero { border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 18px; }
.trip-title { font: 600 1.5rem/1.15 var(--display); margin: 0 0 4px; color: var(--ink); }
.trip-tagline { color: var(--accent); font-size: .96rem; margin: 0 0 10px; }
.trip-facts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.trip-fact {
  font-size: .78rem; color: var(--muted); background: var(--bg2);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px;
}
.trip-blurb { color: var(--muted); font-size: .9rem; line-height: 1.55; margin: 0; }

/* section */
.trip-sec { margin: 22px 0 4px; }
.trip-sec-h { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.trip-sec-ic { font-size: 1.1rem; }
.trip-sec-t { font: 600 1.1rem var(--display); color: var(--ink); }
.trip-overview { color: var(--muted); font-size: .9rem; line-height: 1.55; margin: 0 0 14px; }

/* cards */
.trip-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.trip-card {
  background: var(--bg2); border: 1px solid var(--line); border-top: 3px solid var(--line);
  border-radius: 10px; padding: 13px 14px; display: flex; flex-direction: column; gap: 7px;
}
.trip-card.flash { animation: tripFlash 1.1s ease; }
@keyframes tripFlash { 0% { box-shadow: 0 0 0 2px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.trip-card-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.trip-card-name { font: 600 1rem var(--display); color: var(--ink); margin: 0; }
.trip-pick {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--accent-ink); background: var(--accent); border-radius: 999px; padding: 2px 8px;
}
.trip-card-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.trip-submeta { font-size: .8rem; color: var(--muted); }
.trip-pitch { font-size: .86rem; color: var(--ink); line-height: 1.5; margin: 0; }
.trip-hours { font-size: .8rem; color: var(--muted); }

/* availability pill */
.trip-avail { font-size: .8rem; font-weight: 600; }
.trip-avail.avail-available { color: var(--wx-go); }
.trip-avail.avail-unavailable { color: var(--wx-wet); }
.trip-avail.avail-unknown { color: var(--wx-iffy); }
.trip-avail-note { font-weight: 400; color: var(--muted); }

/* tags */
.trip-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.trip-tag {
  font-size: .72rem; color: var(--muted); background: var(--bg3);
  border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px;
}

/* card footer actions */
.trip-card-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 2px; }
.trip-star {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font: 600 .82rem var(--sans); padding: 2px 0;
}
.trip-star.on { color: var(--accent); }
.trip-jump, .trip-link {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font: 500 .82rem var(--sans); padding: 2px 0; text-decoration: none;
}
.trip-jump:hover, .trip-link:hover, .trip-star:hover { color: var(--accent); }

/* star bar */
.trip-stars { display: inline-flex; align-items: center; gap: 6px; }
.trip-star-bar { position: relative; display: inline-block; font-size: .9rem; line-height: 1; }
.trip-star-bar .s-bg { color: var(--line); }
.trip-star-bar .s-fg { position: absolute; left: 0; top: 0; overflow: hidden; white-space: nowrap; color: #f2b441; }
.trip-stars .s-num { font-size: .76rem; color: var(--muted); }

/* itinerary */
.trip-itin { display: flex; flex-direction: column; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.trip-itin-row { display: grid; grid-template-columns: 130px 1fr; gap: 12px; background: var(--bg2); padding: 11px 13px; }
.trip-itin-day { font-weight: 600; color: var(--ink); font-size: .86rem; }
.trip-itin-plan { color: var(--muted); font-size: .86rem; line-height: 1.5; }

/* weather (per-location) */
.trip-wx-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.trip-wx-tab {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 8px;
  color: var(--muted); font: 600 .8rem var(--sans); padding: 5px 12px; cursor: pointer;
}
.trip-wx-tab.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.trip-wx-box { margin-bottom: 4px; }

.trip-foot { margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--faint); font-size: .76rem; }

@media (max-width: 760px) {
  .trip-itin-row { grid-template-columns: 96px 1fr; }
  .trip-cards { grid-template-columns: 1fr; }
}

/* Just-in-time weather in the POI/trail detail view (fetched on open) */
.detail-wx { margin: 14px 0 4px; }
.detail-wx-h {
  font: 600 .74rem var(--sans); color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px;
}
.detail-wx-body { min-height: 40px; }
.wx-skel {
  height: 40px; border-radius: 8px; color: var(--faint); font-size: .8rem;
  display: flex; align-items: center; padding: 0 11px;
  background: linear-gradient(90deg, var(--bg2) 25%, var(--bg3) 38%, var(--bg2) 63%);
  background-size: 400% 100%; animation: wxShimmer 1.3s ease infinite;
}
@keyframes wxShimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* live dataset search dropdown (names of trails/POIs) */
.p-searchwrap { position: relative; }
.p-sresults {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30;
  margin: 0; padding: 4px; list-style: none; max-height: 320px; overflow-y: auto;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,.45);
}
.p-sresult { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 7px; cursor: pointer; }
.p-sresult:hover { background: var(--bg3); }
.p-sr-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--accent)); flex: 0 0 auto; }
.p-sr-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.p-sr-kind { flex: 0 0 auto; font-size: .74rem; color: var(--muted); text-transform: capitalize; }

/* zoomed-out helper (nothing loads below the min zoom) */
.zoomhelp {
  margin: 8px 0 12px; padding: 14px; text-align: center;
  background: var(--bg2); border: 1px dashed var(--line); border-radius: 10px;
}
.zoomhelp-t { color: var(--muted); font-size: .86rem; margin-bottom: 10px; }
.zoomhelp-btn {
  background: var(--accent); color: var(--accent-ink); border: none; border-radius: 8px;
  padding: 8px 16px; font: 600 .85rem var(--sans); cursor: pointer;
}
.zoomhelp-btn:hover { filter: brightness(1.08); }

/* elevation profile (trail detail view) */
.detail-prof { margin: 14px 0 4px; }
.detail-prof:empty { display: none; }
.prof-h { font: 600 .74rem var(--sans); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.prof-svg { width: 100%; height: auto; display: block; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; touch-action: none; }
.prof-area { fill: var(--accent); opacity: .16; }
.prof-line { fill: none; stroke: var(--accent); stroke-width: 1.6; }
.prof-cursor { stroke: var(--ink); stroke-width: .6; opacity: .5; }
.prof-dot { fill: var(--accent); stroke: var(--bg1); stroke-width: 1; }
.prof-start { fill: #22c55e; stroke: var(--bg2); stroke-width: 1; }   /* trail start */
.prof-end { fill: #ef4444; stroke: var(--bg2); stroke-width: 1; }     /* trail end */
.prof-ax { fill: var(--faint); font: 9px var(--sans); }
.prof-read { font-size: .78rem; color: var(--muted); margin-top: 5px; min-height: 1em; }
.prof-stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: .78rem; color: var(--muted); margin-top: 3px; }
