/* Same tokens as the plan and the walk builder — one design system across all
   three surfaces, so the app doesn't look like a different product. */
:root{
  color-scheme:light dark;
  --bg:#EFF1EC; --surface:#FFFFFF; --surface-2:#E7EAE3;
  --ink:#131A17; --muted:#5C6B64; --line:#D6DCD3;
  --accent:#1F6B52; --accent-soft:#DCEAE2;
  --amber:#A8700F; --amber-soft:#F2E6CE;
  --shadow:0 1px 2px rgba(19,26,23,.06), 0 12px 28px rgba(19,26,23,.09);
  --shadow-sm:0 1px 2px rgba(19,26,23,.05), 0 4px 10px rgba(19,26,23,.05);
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#0E1412; --surface:#161E1A; --surface-2:#1D2622;
    --ink:#E6EDE8; --muted:#93A29A; --line:#28332E;
    --accent:#56C39A; --accent-soft:#1B3A30;
    --amber:#E0AC55; --amber-soft:#3A2F1B;
    --shadow:0 1px 2px rgba(0,0,0,.4), 0 14px 30px rgba(0,0,0,.42);
    --shadow-sm:0 1px 2px rgba(0,0,0,.35), 0 4px 10px rgba(0,0,0,.3);
  }
}
:root[data-theme="dark"]{
  color-scheme:dark;
  --bg:#0E1412; --surface:#161E1A; --surface-2:#1D2622;
  --ink:#E6EDE8; --muted:#93A29A; --line:#28332E;
  --accent:#56C39A; --accent-soft:#1B3A30;
  --amber:#E0AC55; --amber-soft:#3A2F1B;
  --shadow:0 1px 2px rgba(0,0,0,.4), 0 14px 30px rgba(0,0,0,.42);
  --shadow-sm:0 1px 2px rgba(0,0,0,.35), 0 4px 10px rgba(0,0,0,.3);
}

:root[data-theme="light"]{color-scheme:light}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;background:var(--bg);color:var(--ink);
  font-family:"Newsreader",Georgia,"Times New Roman",serif;
  font-size:17px;line-height:1.6;-webkit-font-smoothing:antialiased;
}
h1,h2,h3,.display{font-family:"Bricolage Grotesque","Helvetica Neue",Arial,sans-serif;text-wrap:balance;margin:0}
.mono,.label,.chip,.walk,.fact,.tools button,.close{font-family:"IBM Plex Mono",ui-monospace,SFMono-Regular,Menlo,monospace}
button{font-family:inherit}
.label{font-size:10.5px;letter-spacing:.14em;text-transform:uppercase;color:var(--muted);font-weight:500}
button{font-size:12px;color:inherit;background:none;border:0;cursor:pointer}
.tools button,.close{font-size:12px}
a{color:var(--accent)}
a:visited{color:var(--accent)}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:4px}

.app{max-width:560px;margin:0 auto;padding:0 20px 96px}

/* ---------- masthead ---------- */
header.top{
  position:sticky;top:0;z-index:5;background:var(--bg);
  padding:22px 0 14px;border-bottom:1px solid var(--line);
  display:flex;align-items:flex-start;justify-content:space-between;gap:16px;
}
.wordmark{display:flex;align-items:center;gap:9px}
.pin{width:20px;height:20px;flex:none;color:var(--accent)}
.wordmark h1{font-size:23px;font-weight:800;letter-spacing:-.02em}
.where{margin-top:2px}
.tools{display:flex;gap:6px;align-items:center}
.tools button{
  border:1px solid var(--line);background:var(--surface);
  padding:6px 10px;border-radius:999px;color:var(--muted);white-space:nowrap;
}
.tools button:hover{color:var(--ink);border-color:var(--muted)}
#theme{padding:6px 9px;font-size:13px;line-height:1}

/* ---------- tabs ---------- */
.tabs{
  display:flex;gap:4px;margin-top:14px;padding:4px;
  background:var(--surface-2);border-radius:999px;border:1px solid var(--line);
}
.tabs button{
  flex:1;padding:8px 12px;border-radius:999px;color:var(--muted);
  font-family:"IBM Plex Mono",ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:12px;letter-spacing:.06em;text-transform:uppercase;
  transition:background .15s ease,color .15s ease;
}
.tabs button:hover{color:var(--ink)}
.tabs button[aria-selected="true"]{background:var(--surface);color:var(--ink);box-shadow:var(--shadow-sm)}

/* ---------- status line ---------- */
.status{
  display:flex;flex-wrap:wrap;gap:10px 14px;align-items:baseline;
  padding:14px 0 4px;
}
.status .dot{width:6px;height:6px;border-radius:50%;background:var(--accent);display:inline-block;margin-right:7px;vertical-align:middle}
.status .warn{color:var(--amber)}

/* ---------- cards ---------- */
.feed{display:flex;flex-direction:column;gap:14px;padding-top:14px}
.card{
  background:var(--surface);border:1px solid var(--line);border-radius:16px;
  box-shadow:var(--shadow-sm);overflow:hidden;
  transition:box-shadow .18s ease, transform .18s ease;
}
.card:hover{box-shadow:var(--shadow);transform:translateY(-1px)}
.cardMain{
  text-align:left;width:100%;color:inherit;
  display:grid;grid-template-columns:auto 1fr auto;gap:0 14px;padding:16px 16px 12px;
  align-items:start;
}
/* Actions live outside the button — a link inside a button is invalid, and the
   walk is a different intent from "tell me about this". */
.cardbar{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  padding:9px 14px 10px;border-top:1px solid var(--line);background:var(--surface-2);
}
.cardbar .hint{
  font-family:"IBM Plex Mono",ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:11px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.dirs{
  display:inline-flex;align-items:center;gap:6px;flex:none;text-decoration:none;
  font-family:"IBM Plex Mono",ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:11.5px;letter-spacing:.04em;color:var(--accent);
  background:var(--accent-soft);border:1px solid transparent;
  padding:6px 11px;border-radius:999px;
}
.dirs:hover{border-color:var(--accent)}
.dirs.ghost{background:none;border-color:var(--line);color:var(--muted)}
.sheetActions{display:flex;gap:8px;margin-top:16px}
.card .head{display:flex;align-items:center;gap:9px;flex-wrap:wrap;margin-bottom:5px}
.chip{
  font-size:10px;letter-spacing:.1em;text-transform:uppercase;font-weight:600;
  padding:3px 7px;border-radius:5px;background:var(--accent-soft);color:var(--accent);
}
.chip.open{background:var(--amber-soft);color:var(--amber)}
.card h2{font-size:20px;font-weight:600;letter-spacing:-.01em;line-height:1.25}
.card .why{color:var(--ink);margin:2px 0 10px}
.card .meta{display:flex;flex-wrap:wrap;gap:4px 10px;color:var(--muted);font-size:12px}
.card .thumb{
  width:78px;height:78px;border-radius:11px;object-fit:cover;
  background:var(--surface-2);border:1px solid var(--line);
}
.walk{
  align-self:start;text-align:right;color:var(--muted);
  font-size:11px;letter-spacing:.1em;text-transform:uppercase;white-space:nowrap;
}
.walk b{display:block;font-size:19px;letter-spacing:-.01em;color:var(--ink);font-weight:600}

/* ---------- detail sheet ---------- */
dialog{
  border:0;padding:0;background:transparent;color:var(--ink);max-width:560px;width:calc(100% - 24px);
  margin:auto auto 0;
}
dialog::backdrop{background:rgba(19,26,23,.42);backdrop-filter:blur(2px)}
.sheet{
  color:var(--ink);background:var(--surface);border:1px solid var(--line);
  border-radius:20px 20px 0 0;box-shadow:var(--shadow);
  padding:8px 22px 30px;max-height:88vh;overflow-y:auto;
}
.grab{width:38px;height:4px;border-radius:2px;background:var(--line);margin:6px auto 16px}
.sheet h2{font-size:27px;font-weight:600;letter-spacing:-.02em;margin-bottom:6px}
.sheet img.hero{width:100%;max-height:40vh;object-fit:cover;border-radius:12px;margin:14px 0 4px;display:block}
.sheet .body{margin:14px 0 0}
.sheet .wikiNote{margin:16px 0 -8px;font-size:13px;color:var(--muted);font-style:italic}
.sheet .facts{
  display:flex;flex-wrap:wrap;gap:8px;margin:14px 0 2px;padding-top:14px;
  border-top:1px solid var(--line);
}
.card .meta span + span::before{content:'·';margin-right:10px;color:var(--line)}
.fact{background:var(--surface-2);border-radius:7px;padding:5px 9px;font-size:11px;color:var(--muted)}
.sheet .source{margin-top:18px;font-size:12px;color:var(--muted)}
.sheet .close{position:sticky;top:0;float:right;color:var(--muted)}

/* ---------- misc ---------- */
.note{
  border:1px dashed var(--line);border-radius:12px;padding:14px 16px;
  color:var(--muted);font-size:15px;margin-top:16px;background:var(--surface);
}
.note b{color:var(--ink);font-weight:600}
footer.attrib{padding-top:26px;color:var(--muted);font-size:11.5px;text-align:center}
.skeleton{height:112px;border-radius:16px;background:var(--surface);border:1px solid var(--line);
  animation:pulse 1.4s ease-in-out infinite}
@keyframes pulse{0%,100%{opacity:.5}50%{opacity:.85}}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}

/* Narrow phones: the walk time stops being a column and joins the meta line. */
@media (max-width:430px){
  .cardMain{grid-template-columns:auto 1fr}
  /* Its own row: a card with no thumbnail has the body in column 1, and
     pinning the walk to column 2 parked it beside the chips instead. */
  .walk{grid-column:1/-1;text-align:left;display:flex;align-items:baseline;gap:6px;margin-top:9px}
  .walk b{display:inline;font-size:15px}
  .card h2{font-size:19px}
}

/* ---------- walk builder ---------- */
.walkbar{
  display:flex;flex-wrap:wrap;align-items:center;gap:10px 18px;
  margin-top:12px;padding:12px 14px;
  background:var(--surface);border:1px solid var(--line);border-radius:14px;
}
.walkrow{display:flex;align-items:center;gap:10px;min-width:0}
.pills{display:flex;gap:5px;flex-wrap:wrap}
.pills button{
  padding:6px 11px;border-radius:999px;border:1px solid var(--line);
  background:var(--bg);color:var(--muted);
  font-family:"IBM Plex Mono",ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11.5px;
}
.pills button[aria-pressed="true"]{background:var(--accent-soft);border-color:var(--accent);color:var(--accent)}
.walkbar .meal{cursor:pointer;font-size:14px;color:var(--muted)}
.walkbar .meal input{accent-color:var(--accent);width:17px;height:17px}
.walkbar .meal:hover{color:var(--ink)}

.routeStats{
  display:grid;grid-template-columns:repeat(4,1fr);gap:8px;
  margin-top:14px;padding:14px;border:1px solid var(--line);border-radius:14px;background:var(--surface);
}
.stat{display:flex;flex-direction:column;gap:1px;min-width:0}
.stat b{font-size:19px;font-weight:600;letter-spacing:-.01em;font-variant-numeric:tabular-nums}
.stat span{
  font-family:"IBM Plex Mono",ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);
}

.route{list-style:none;margin:16px 0 0;padding:0;display:flex;flex-direction:column}
.route .leg{
  display:flex;align-items:center;gap:12px;padding:0 0 0 15px;min-height:34px;
  font-family:"IBM Plex Mono",ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:11px;color:var(--muted);
}
/* The dotted rule *is* the leg — the walking between two stops, drawn as the
   gap it actually is rather than as another box. */
.route .legLine{width:2px;align-self:stretch;background:repeating-linear-gradient(
  to bottom,var(--line) 0 4px,transparent 4px 8px);flex:none;margin-left:12px}
.route .stop{
  display:grid;grid-template-columns:auto 1fr auto;align-items:start;gap:0 13px;
  background:var(--surface);border:1px solid var(--line);border-radius:14px;
  padding:14px;box-shadow:var(--shadow-sm);
}
.route .stop.meal{border-color:var(--amber);background:var(--amber-soft)}
.route .pip{
  width:26px;height:26px;border-radius:50%;flex:none;
  display:grid;place-items:center;background:var(--accent-soft);color:var(--accent);
  font-family:"IBM Plex Mono",ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;font-weight:600;
}
.route .stop.meal .pip{background:var(--surface);color:var(--amber)}
.stopBody{min-width:0}
.stopWhen{
  font-family:"IBM Plex Mono",ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:11px;color:var(--muted);display:flex;gap:8px;align-items:baseline;
}
.stopWhen b{color:var(--ink);font-size:13px;font-variant-numeric:tabular-nums}
.stopBody h3{font-size:18px;font-weight:600;letter-spacing:-.01em;margin:3px 0 0;line-height:1.25}
.stopBody .why{margin:3px 0 0;font-size:15px}
.routeEnd{
  display:flex;align-items:baseline;gap:9px;margin-top:14px;padding:12px 14px;
  border:1px dashed var(--line);border-radius:14px;
  font-family:"IBM Plex Mono",ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:11px;color:var(--muted);
}
.routeEnd b{font-size:15px;color:var(--ink);font-variant-numeric:tabular-nums}

@media (max-width:430px){
  /* Four tabs, not three: the labels have to give up some of their padding
     before "Walk" starts wrapping. */
  .tabs button{padding:8px 4px;letter-spacing:.02em}
  /* The label sits above a full-width row of pills; beside them it wrapped to
     two lines and pushed 180 min onto a second row of its own. */
  .walkbar{flex-direction:column;align-items:stretch;gap:12px}
  .walkrow{flex-direction:column;align-items:flex-start;gap:7px}
  .walkbar .meal{flex-direction:row;align-items:center}
  .pills{display:grid;grid-template-columns:repeat(4,1fr);width:100%}
  .pills button{padding:7px 2px;text-align:center}
  .routeStats{grid-template-columns:repeat(2,1fr);gap:12px 8px}
  /* The directions button drops under the stop rather than squeezing the name
     into a two-word column. */
  .route .stop{grid-template-columns:auto 1fr}
  .route .stop .dirs{grid-column:2;margin-top:10px;justify-self:start}
  .stopBody h3{font-size:17px}
}
