/* Stroll
   Layout: one-screen app. Map on top, a quiet list below, thumb-reach tabs
   at the bottom, place details in a bottom sheet.

   Design system — see DESIGN.md for how each token is meant to be used. */

:root {
  /* ── Stroll palette (raw colours): warm paper, ink, and one dusk-indigo accent ── */
  --st-indigo: #3F3CBB;     /* the accent: late-afternoon sky, the one cool colour */
  --st-paper-0: #FFFFFF;
  --st-paper-50: #F5F2EC;   /* warm paper */
  --st-paper-100: #ECE7DE;
  --st-paper-200: #DDD6CA;
  --st-paper-500: #6B6560;  /* pencil */
  --st-ink: #1D1B22;
  --st-roast: #7A4E2A;      /* coffee */
  --st-terracotta: #B0402A; /* food */
  --st-plum: #94336E;       /* drinks */
  --st-leaf: #2E7346;       /* open */
  --st-amber: #965A00;      /* closing soon */

  /* ── Semantic tokens (use these in components) ── */
  --bg: var(--st-paper-50);
  --surface: var(--st-paper-0);
  --surface-2: var(--st-paper-100);
  --line: var(--st-paper-200);
  --text: var(--st-ink);
  --text-muted: var(--st-paper-500);
  --accent: var(--st-indigo);
  --on-accent: #FFFFFF;
  --kind-coffee: var(--st-roast);
  --kind-food: var(--st-terracotta);
  --kind-drinks: var(--st-plum);
  --status-open: var(--st-leaf);
  --status-soon: var(--st-amber);
  --status-closed: var(--st-paper-500);
  --warn-bg: #FBEFDD;
  --shadow: 0 1px 2px rgb(29 27 34 / .08), 0 6px 20px rgb(29 27 34 / .10);

  /* ── Map (OpenFreeMap vector style, recoloured from these) ── */
  --map-land: #EFEBE3;
  --map-water: #CCD7E2;         /* a cool wash, the only blue on the page */
  --map-water-label: #5A7089;
  --map-park: #DCE4D0;          /* a light wash of --st-leaf */
  --map-building: #E6E0D6;
  --map-building-line: #DCD5CA;
  --map-road: #FFFFFF;
  --map-road-major: #FFFFFF;
  --map-road-casing: #DDD6CA;
  --map-rail: #D0C9BE;
  --map-label: #6B6560;

  /* ── Type ── */
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Atkinson Hyperlegible", -apple-system, "Segoe UI", system-ui, sans-serif;
  --fs-xs: 12px;   /* labels, meta */
  --fs-sm: 13px;   /* secondary lines */
  --fs-md: 15px;   /* body, list names */
  --fs-lg: 18px;   /* section titles */
  --fs-xl: 24px;   /* sheet title */
  --fs-brand: 32px; /* the Stroll wordmark, and nothing else */

  /* ── Space, shape ── */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px;
  --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-pill: 999px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --tab-h: 52px;
  --safe-top: env(safe-area-inset-top, 0px);
  --walk-col: 64px;          /* walking-time column in list rows */
  --ctl-col: 84px;           /* Add / Added / Been button column */
  --sheet-overlap: 16px;     /* how far the list sheet tucks over the map */

  /* ── Motion ── */
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --dur-fast: 150ms;   /* colour and press feedback */
  --dur-base: 240ms;   /* things entering */
  --dur-slow: 380ms;   /* springy confirmations */
  --dur-list: 420ms;   /* a row rising into a list */
  --dur-drawer: 380ms; /* the list sliding down or up */
  --stagger: 45ms;     /* gap between rows rising in */
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121118; --surface: #1B1A23; --surface-2: #24232E; --line: #2F2D3A;
    --text: #ECEAF2; --text-muted: #A19DAD;
    --accent: #A3A1FF; --on-accent: #14121C;
    --kind-coffee: #D09E70; --kind-food: #F2876A; --kind-drinks: #E58BC0;
    --status-open: #6CC98F; --status-soon: #E8A93A; --status-closed: #A19DAD;
    --warn-bg: #2E2414;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 6px 20px rgb(0 0 0 / .4);
    --map-land: #121118; --map-water: #1A2233; --map-water-label: #7387A6; --map-park: #172119;
    --map-building: #1A1922; --map-building-line: #1A1922; --map-road: #26242F; --map-road-major: #312F3C;
    --map-road-casing: #121118; --map-rail: #2F2D3A; --map-label: #9A96A6;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121118; --surface: #1B1A23; --surface-2: #24232E; --line: #2F2D3A;
  --text: #ECEAF2; --text-muted: #A19DAD;
  --accent: #A3A1FF; --on-accent: #14121C;
  --kind-coffee: #D09E70; --kind-food: #F2876A; --kind-drinks: #E58BC0;
  --status-open: #6CC98F; --status-soon: #E8A93A; --status-closed: #A19DAD;
  --warn-bg: #2E2414;
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 6px 20px rgb(0 0 0 / .4);
  --map-land: #121118; --map-water: #1A2233; --map-water-label: #7387A6; --map-park: #172119;
  --map-building: #1A1922; --map-building-line: #1A1922; --map-road: #26242F; --map-road-major: #312F3C;
  --map-road-casing: #121118; --map-rail: #2F2D3A; --map-label: #9A96A6;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: var(--fs-md)/1.4 var(--font-body);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.k-coffee { --k: var(--kind-coffee); }
.k-food { --k: var(--kind-food); }
.k-drinks { --k: var(--kind-drinks); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--k); display: inline-block; flex: none; }

/* ── Frame ─────────────────────────────────────────────────────────────── */
/* The map fills the stage (running up under the status bar). The list is a drawer laid
   over it, which slides down to leave just its title row, like Apple Maps. Keeping the
   name on the drawer, not at the top, keeps it clear of the blur iOS puts under the
   status bar in home-screen apps. */
.app {
  height: 100%;
  height: 100dvh;
  display: flex; flex-direction: column;
  overflow: hidden;
  position: relative;
}
.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; overflow: clip; } /* clip: can't be scrolled, even by script */

.drawer {
  position: absolute; z-index: 2; left: 0; right: 0; bottom: 0;
  top: calc(36dvh + var(--safe-top) - var(--sheet-overlap));
  display: flex; flex-direction: column;
  /* One solid surface (title row and list together), so no seam can show the map through. */
  background: var(--bg);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: 0 -6px 18px rgb(13 24 32 / .10);
  transform: translateY(var(--drawer-y, 0px));
  transition: transform var(--dur-drawer) var(--ease-out);
}
.drawer.dragging { transition: none; }
.brand {
  position: relative; flex: none;
  display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-3);
  padding-top: 24px; padding-bottom: 10px;
  padding-left: var(--gutter-l); padding-right: var(--gutter-r);
  touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none;
}
.drawer.dragging .brand { cursor: grabbing; }
/* The grab handle: a wide, tall tap target around a small bar. */
.handle {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 72px; height: 22px; border: 0; background: none; padding: 0;
}
.handle::before {
  content: ""; position: absolute; left: 50%; top: 8px; transform: translateX(-50%);
  width: 36px; height: 5px; border-radius: 3px;
  background: color-mix(in srgb, var(--text-muted) 45%, transparent);
  transition: background-color var(--dur-fast), width var(--dur-fast);
}
.handle:hover::before, .drawer.dragging .handle::before { background: var(--text-muted); width: 42px; }
.handle:focus-visible { outline: none; }
.handle:focus-visible::before { background: var(--accent); }
/* The brand row: the wordmark on the left (the one place the display face is set large),
   the tagline right-aligned in the space opposite, both sitting on the same baseline. */
.wordmark {
  font: italic 700 var(--fs-brand)/0.95 var(--font-display);
  font-variation-settings: "opsz" 96, "SOFT" 100;
  letter-spacing: -.02em;
  color: var(--text);
}
.wordmark::after { content: "."; color: var(--accent); margin-left: .02em; }
.tagline, .clock {
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px; padding-bottom: 2px;
  font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; line-height: 1.15;
  color: var(--text-muted); text-align: right; white-space: nowrap;
}
.clock { color: var(--accent); }
/* The tagline doubles as the city switch: tap it to move to the next city. */
.city-switch { border: 0; background: none; padding: 4px 0 2px 8px; margin: -4px 0 0; cursor: pointer; font-family: inherit; }
.city-switch #city-name { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); }
.city-switch #city-name::after {
  content: ""; width: 10px; height: 10px; flex: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 4 3 8l4 4M3 8h14M17 12l4 4-4 4M21 16H7' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 4 3 8l4 4M3 8h14M17 12l4 4-4 4M21 16H7' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
}
.city-switch:active { transform: scale(.96); }
.clock:not([hidden]) ~ .tagline, .tagline:has(~ .clock:not([hidden])) { display: none; } /* previewing: the label takes the tagline's place */


/* ── Map ───────────────────────────────────────────────────────────────── */
.mapwrap { position: absolute; inset: 0; z-index: 1; padding-top: var(--safe-top); }
/* --map-bottom: how much of the map the drawer covers; kept in sync from app.js. */
.maplibregl-ctrl-bottom-right { bottom: var(--map-bottom, 0px); transition: bottom var(--dur-drawer) var(--ease-out); }
.stage.dragging .maplibregl-ctrl-bottom-right, .stage.dragging .peek { transition: none; }
#map { position: absolute; inset: 0; background: var(--map-land); }
.maplibregl-ctrl-attrib { font: 10px var(--font-body); }
.maplibregl-ctrl.maplibregl-ctrl-attrib.maplibregl-compact { background: color-mix(in srgb, var(--surface) 80%, transparent); color: var(--text-muted); }
.maplibregl-ctrl-attrib a { color: var(--text-muted); }
.maplibregl-ctrl.maplibregl-ctrl-attrib.maplibregl-compact { margin: 0 calc(var(--sp-2) + env(safe-area-inset-right, 0px)) var(--sp-2) 0; }
.maplibregl-ctrl-attrib-button { opacity: .5; }

.mapbtns {
  position: absolute; z-index: 500;
  right: calc(var(--sp-3) + env(safe-area-inset-right, 0px)); top: calc(var(--safe-top) + var(--sp-3));
  display: flex; flex-direction: column; gap: var(--sp-2);
}
.mapbtn {
  transition: transform var(--dur-fast), color var(--dur-fast);
  width: 40px; height: 40px; border-radius: var(--r-md); border: 0;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
  display: grid; place-items: center;
}
.mapbtn svg { width: 20px; height: 20px; }
#btn-locate.on { color: var(--accent); }
#btn-transit[aria-pressed="false"] { color: var(--text-muted); }
#btn-transit[aria-pressed="false"] svg { opacity: .55; }
#btn-locate.on svg { fill: currentColor; }

/* pins */
.pin { width: 30px; height: 30px; display: grid; place-items: center; cursor: pointer; }
.pin:focus-visible { outline: none; }
.pin:focus-visible .pin-b { box-shadow: 0 0 0 3px var(--accent); }
.pin-b {
  position: relative;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--k); color: #fff;
  border: 2px solid var(--surface);
  box-shadow: 0 1px 3px rgb(0 0 0 / .3);
  display: grid; place-items: center;
  transition: transform var(--dur-base) var(--ease-spring), opacity var(--dur-base), filter var(--dur-base);
  animation: pin-in var(--dur-slow) var(--ease-spring) backwards;
}
@keyframes pin-in { from { transform: scale(0); opacity: 0; } }
.pin.is-leaving .pin-b { animation: pin-out 240ms ease-in forwards; animation-delay: 0s !important; }
@keyframes pin-out { to { transform: scale(0); opacity: 0; } }
.pin-b svg { width: 14px; height: 14px; stroke-width: 2.2; }
.pin.is-closed .pin-b { filter: saturate(.2); opacity: .7; }
.pin.is-visited .pin-b::after {
  content: ""; position: absolute; right: -5px; bottom: -4px;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--status-open) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 12.5 4 4L18 8.5' fill='none' stroke='white' stroke-width='3.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/9px no-repeat;
  border: 1.5px solid var(--surface);
}
.pin.is-dim .pin-b { transform: scale(.6); opacity: .4; filter: saturate(.2); }
.pin.is-planned .pin-b { box-shadow: 0 0 0 2px var(--accent), 0 1px 3px rgb(0 0 0 / .3); } /* in your plan */
.pin.is-sel .pin-b { transform: scale(1.3); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 40%, transparent), 0 2px 6px rgb(0 0 0 / .35); }
.pin.is-approx .pin-b { border-style: dashed; }
.zoomed-out .pin-b { width: 14px; height: 14px; border-width: 2px; }
.zoomed-out .pin-b svg { display: none; }
.zoomed-out .pin.is-visited .pin-b::after { width: 9px; height: 9px; right: -5px; bottom: -4px; background-size: 7px; border-width: 1px; }
.zoomed-out .pin.is-sel .pin-b { transform: scale(1.6); }

/* Train and cable car stops: a small dark badge with the system letters, then the name.
   Square and dark like the SoMa base marker, so they never read as a venue pin. */
.stn { display: flex; align-items: center; gap: 4px; cursor: pointer; z-index: 0; }
.stn-chip {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; flex: none;
  border-radius: 5px; background: var(--text); color: var(--bg);
  font: 800 9.5px/1 var(--font-body); letter-spacing: .02em; white-space: nowrap;
  box-shadow: 0 1px 3px rgb(0 0 0 / .3);
}
.stn-chip.cable { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1.5px var(--text), 0 1px 3px rgb(0 0 0 / .25); }
.stn-name {
  display: none; font: 700 11px/1.1 var(--font-body); color: var(--text); white-space: nowrap;
  text-shadow: 0 0 2px var(--map-land), 0 0 2px var(--map-land), 0 0 3px var(--map-land);
}
.zoomed-in .stn-name { display: block; }
.zoomed-out .stn { display: none; }
.station-line { display: flex; gap: var(--sp-2); align-items: center; font-size: var(--fs-sm); margin: 0; }
.station-line .stn-chip { box-shadow: none; }
.station-peek { cursor: default; }
.station-peek .row-sub { white-space: normal; }
.station-peek .row-top { gap: 6px; }
.me-dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: 3px solid #fff;
  animation: pin-in var(--dur-slow) var(--ease-spring) backwards, ping 2.4s ease-out var(--dur-slow) infinite;
}
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); } 70%,100% { box-shadow: 0 0 0 14px transparent; } }
.base-pin {
  width: 22px; height: 22px; border-radius: 6px; background: var(--text); color: var(--bg);
  display: grid; place-items: center; box-shadow: 0 1px 3px rgb(0 0 0 / .3);
}
.base-pin svg { width: 13px; height: 13px; stroke-width: 2.4; }

.peek {
  position: absolute; z-index: 600;
  left: calc(var(--sp-3) + env(safe-area-inset-left, 0px)); right: calc(64px + env(safe-area-inset-right, 0px)); bottom: calc(var(--map-bottom, 0px) + var(--sp-3));
  transition: bottom var(--dur-drawer) var(--ease-out);
  background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow);
  padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-3);
  display: flex; gap: var(--sp-2); align-items: center;
}
.peek .row-main { padding: 0; }
.peek.enter { animation: peek-in var(--dur-base) var(--ease-spring); }
@keyframes peek-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }

/* ── Panel ─────────────────────────────────────────────────────────────── */
.panel {
  flex: 1; overflow-y: auto; min-height: 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-left: var(--gutter-l); padding-right: var(--gutter-r);
  padding-bottom: var(--sp-5);
}

.filters {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  margin-inline: calc(-1 * var(--gutter-l)) calc(-1 * var(--gutter-r));
  padding: var(--sp-3) var(--gutter-r) var(--sp-2) var(--gutter-l);
  display: flex; gap: var(--sp-2); align-items: center;
}
.search {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 6px;
  background: var(--surface-2); border-radius: var(--r-pill); padding: 0 var(--sp-3); height: 36px;
}
.search svg { width: 16px; height: 16px; color: var(--text-muted); flex: none; }
.search input {
  border: 0; background: transparent; color: var(--text); font: inherit; font-size: 16px; /* 16px stops iOS zooming in */
  width: 100%; min-width: 0; padding: 0; outline: none;
}
.search input::placeholder { color: var(--text-muted); }
.kinds { display: flex; gap: 6px; flex: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: transparent; color: var(--text);
  border-radius: var(--r-pill); padding: 0 10px; height: 36px; font-size: var(--fs-sm); white-space: nowrap;
  transition: background-color var(--dur-base), border-color var(--dur-base), color var(--dur-base), transform var(--dur-fast);
}
.chip[aria-pressed="true"] { animation: chip-on var(--dur-slow) var(--ease-spring); }
@keyframes chip-on { from { transform: scale(.9); } }
.chip .dot { transition: background-color var(--dur-base); }
.chip:active, .btn:active, .mapbtn:active, .link:active { transform: scale(.96); }
.chip[aria-pressed="true"] { background: var(--k); border-color: var(--k); color: #fff; }
.chip[aria-pressed="true"] .dot { background: #fff; }

.hint { margin: var(--sp-1) 2px var(--sp-2); font-size: var(--fs-sm); color: var(--text-muted); }
.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 700; font-size: inherit; }
.empty { color: var(--text-muted); text-align: center; padding: var(--sp-5) 0; font-size: var(--fs-sm); }

/* ── Rows (the one list item used everywhere) ──────────────────────────── */
.list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
/* Row layout: name and details · walking time · button. The last two are fixed-width
   columns, so walking times line up down the list whatever the button says. */
.row-main {
  flex: 1; min-width: 0; text-align: left; border: 0; background: none;
  padding: var(--sp-3) 0;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--sp-3); row-gap: 2px; align-items: center;
}
.row-main > .row-top, .row-main > .row-sub { grid-column: 1; }
.row-top { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
/* Long names wrap to a second line rather than being cut off. */
.row-name {
  font-size: var(--fs-md); font-weight: 700; min-width: 0; line-height: 1.25;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.row:not(.peek *) .row-top { align-items: flex-start; }
.row .row-top .dot { margin-top: 6px; }
.row-walk {
  grid-column: 2; grid-row: 1 / span 2; width: var(--walk-col);
  display: inline-flex; align-items: center; gap: 3px;
  font-size: var(--fs-sm); color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.row-walk svg { width: 15px; height: 15px; flex: none; stroke-width: 1.8; opacity: .8; }
.row-sub { font-size: var(--fs-sm); color: var(--text-muted); padding-left: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.is-sel .row-name { color: var(--accent); }
.row-name { transition: color var(--dur-fast); }
.row.enter { animation: rise-in var(--dur-list) var(--ease-out) backwards; animation-delay: calc(var(--n, 0) * var(--stagger)); }
@keyframes rise-in { from { opacity: 0; transform: translateY(14px); } }
.list.leaving .row { animation: row-out 180ms ease-in forwards; }
@keyframes row-out { to { opacity: 0; transform: translateY(-6px); } }
.row.is-visited .row-name { color: var(--text-muted); font-weight: 400; }

.st { font-weight: 700; }
.st-open { color: var(--status-open); }
.st-soon { color: var(--status-soon); }
.st-later, .st-closed, .st-unknown { color: var(--status-closed); font-weight: 400; }

.check {
  flex: none; width: var(--ctl-col); height: 48px; margin-left: var(--sp-2); border: 0; background: none;
  display: grid; place-items: center; color: var(--text-muted);
}
.check i {
  width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--text-muted) 55%, transparent);
  display: grid; place-items: center;
}
.check svg { width: 14px; height: 14px; stroke-width: 3; opacity: 0; color: #fff; }
.check i { transition: background-color var(--dur-fast), border-color var(--dur-fast); }
.check:active i { transform: scale(.88); }
.check[aria-pressed="true"] i { background: var(--status-open); border-color: var(--status-open); }
.row.pop .check i { animation: pop var(--dur-slow) var(--ease-spring); }
.row.pop .check path { stroke-dasharray: 20; stroke-dashoffset: 20; animation: draw 260ms 80ms var(--ease-out) forwards; }
@keyframes pop { 0% { transform: scale(.55); } 100% { transform: scale(1); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
.check[aria-pressed="true"] svg { opacity: 1; }

/* ── Add / Been controls ───────────────────────────────────────────────── */
/* A labelled pill at the end of a row: "+ Add" / "✓ Added" in Nearby, "✓ Been" in Plan. */
.pill-btn {
  position: relative; flex: none; margin-left: var(--sp-2); width: var(--ctl-col);
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 30px; padding: 0 8px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-size: var(--fs-sm); font-weight: 700; white-space: nowrap;
  transition: background-color var(--dur-base), border-color var(--dur-base), color var(--dur-base), transform var(--dur-fast);
}
.pill-btn::after { content: ""; position: absolute; inset: -9px -6px; } /* a thumb-sized tap target */
.pill-btn svg { width: 14px; height: 14px; stroke-width: 2.6; flex: none; }
.pill-btn:active { transform: scale(.94); }
/* In your plan: an orange tint rather than a solid fill, so a list of them stays calm. */
.pill-btn.on {
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent);
}
.pill-btn.been { color: var(--status-open); border-color: color-mix(in srgb, var(--status-open) 45%, var(--line)); }
.row.pop .pill-btn { animation: pop var(--dur-slow) var(--ease-spring); }
.row.pop .pill-btn path:first-child { stroke-dasharray: 20; stroke-dashoffset: 20; animation: draw 260ms 80ms var(--ease-out) forwards; }

/* ── Plan ──────────────────────────────────────────────────────────────── */
.view:not([hidden]) { animation: fade-up var(--dur-base) var(--ease-out); }
@keyframes fade-up { from { opacity: 0; transform: translateY(4px); } }
.plan-head { margin: var(--sp-3) 0 var(--sp-1); }
.plan-head h2 { font: 700 var(--fs-md)/1.25 var(--font-body); margin: 0; text-wrap: balance; }
.plan-head p { margin: 2px 0 0; color: var(--text-muted); font-size: var(--fs-sm); }
.plan-note { color: var(--text-muted); font-size: var(--fs-sm); margin: var(--sp-3) 0; }
.subhead {
  margin: var(--sp-5) 0 0; font-size: var(--fs-xs); font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em;
}
.plan-empty {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-3);
  text-align: center; padding: var(--sp-5) var(--sp-3); color: var(--text-muted); font-size: var(--fs-sm);
}
.plan-empty h2 { font: 700 var(--fs-lg)/1.2 var(--font-display); color: var(--text); margin: 0; }
.plan-empty p { margin: 0; max-width: 34ch; line-height: 1.6; }
.pill-demo {
  display: inline-flex; align-items: center; gap: 3px; vertical-align: 1px;
  padding: 1px 8px 1px 6px; border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--surface); color: var(--text); font-weight: 700; font-size: var(--fs-xs);
}
.pill-demo svg { width: 11px; height: 11px; stroke-width: 2.8; }
.been-tools { display: flex; gap: var(--sp-4); align-items: center; flex-wrap: wrap; margin-top: var(--sp-5); font-size: var(--fs-sm); }
.link.quiet { color: var(--text-muted); font-weight: 400; }
.list-foot { text-align: center; margin: var(--sp-5) 0 0; font-size: var(--fs-sm); }
.about-link { font-size: var(--fs-sm); margin-top: var(--sp-2); }
.d-sec .link { font-weight: 400; text-decoration: underline; text-underline-offset: 2px; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: var(--r-md); padding: 0 var(--sp-3); height: 44px; font-weight: 700; font-size: var(--fs-md);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; white-space: nowrap;
  transition: transform var(--dur-fast), background-color var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.small { height: 34px; font-size: var(--fs-sm); padding: 0 var(--sp-3); }
/* Toggles in the details sheet: Add to plan / Mark as been */
.d-toggles { display: flex; gap: var(--sp-2); }
.toggle {
  flex: 1; height: 40px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 700; font-size: var(--fs-sm);
  transition: background-color var(--dur-base), border-color var(--dur-base), color var(--dur-base), transform var(--dur-fast);
}
.toggle svg { width: 16px; height: 16px; stroke-width: 2.4; }
.toggle:active { transform: scale(.97); }
.toggle.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.toggle.been { color: var(--status-open); }
.toggle.been.on { background: var(--status-open); border-color: var(--status-open); color: #fff; }

/* ── Tabs ──────────────────────────────────────────────────────────────── */
.tabs {
  display: grid; grid-template-columns: repeat(2, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
}
.tabs button {
  border: 0; background: none; height: var(--tab-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-muted); font-size: 11px;
}
.tabs svg { width: 22px; height: 22px; }
.tabs button[aria-current="page"] { color: var(--accent); font-weight: 700; }
.count { font-variant-numeric: tabular-nums; display: inline-block; }
.count.bump { animation: pop var(--dur-slow) var(--ease-spring); }

/* ── Sheet ─────────────────────────────────────────────────────────────── */
.scrim { position: absolute; inset: 0; background: rgb(13 24 32 / .35); z-index: 900; }
.sheet {
  position: absolute; z-index: 1000; left: 0; right: 0; bottom: 0;
  max-height: calc(100% - 48px - env(safe-area-inset-top, 0px));
  background: var(--surface); border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: 0 -8px 32px rgb(0 0 0 / .2);
  display: flex; flex-direction: column;
  animation: rise var(--dur-base) var(--ease-out);
}
@keyframes rise { from { transform: translateY(48px); opacity: .3; } }
.sheet.is-closing { animation: sheet-out 200ms ease-in forwards; }
@keyframes sheet-out { to { transform: translateY(100%); } }
.scrim { animation: fade-in var(--dur-base) var(--ease-out); }
.scrim.is-closing { animation: fade-out 200ms ease-in forwards; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
.grab { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: var(--sp-2) auto 0; flex: none; }
.close {
  position: absolute; top: var(--sp-3); right: calc(var(--sp-3) + env(safe-area-inset-right, 0px));
  width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--surface-2); display: grid; place-items: center; color: var(--text-muted);
}
.close svg { width: 16px; height: 16px; }
.close { z-index: 1; box-shadow: 0 1px 6px rgb(0 0 0 / .25); }
.sheet-body {
  overflow-y: auto; overscroll-behavior: contain;
  padding: var(--sp-2) var(--gutter-r) var(--sp-4) var(--gutter-l);
  display: flex; flex-direction: column; gap: var(--sp-4);
}
.sheet-actions {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2);
  padding: var(--sp-3) var(--gutter-r) calc(var(--sp-3) + env(safe-area-inset-bottom, 0px)) var(--gutter-l);
  border-top: 1px solid var(--line);
}
.sheet-actions .btn { padding-inline: var(--sp-2); }

/* Venue photos: a swipeable strip at the top of the details sheet. */
.photos { margin-inline: calc(-1 * var(--gutter-l)) calc(-1 * var(--gutter-r)); margin-top: var(--sp-1); }
.photo-strip {
  display: flex; gap: var(--sp-2); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  padding-inline: var(--gutter-l) var(--gutter-r); scroll-padding-inline: var(--gutter-l);
  overscroll-behavior-x: contain;
}
.photo-strip::-webkit-scrollbar { display: none; }
.photo-strip img {
  flex: none; width: 82%; height: 200px; object-fit: cover; border-radius: var(--r-md);
  scroll-snap-align: start; background: var(--surface-2);
  opacity: 0; transition: opacity var(--dur-list) var(--ease-out);
}
.photo-strip img.loaded { opacity: 1; }
.photos.single .photo-strip img { width: 100%; }
.photo-credit {
  display: inline-block; margin: 6px var(--gutter-r) 0 var(--gutter-l);
  font-size: var(--fs-xs); color: var(--text-muted); text-decoration: none;
}
.photo-credit::after { content: " ↗"; }
.photos-link { font-size: var(--fs-sm); align-self: flex-start; text-decoration: none; }
.photos ~ div .d-name, .photos + div .d-name { margin-right: 0; }
.d-name { font: 700 var(--fs-xl)/1.1 var(--font-display); font-variation-settings: "opsz" 48, "SOFT" 50; letter-spacing: -.01em; margin: var(--sp-1) 44px 0 0; text-wrap: balance; }
.d-meta { color: var(--text-muted); font-size: var(--fs-sm); margin-top: var(--sp-1); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.d-meta .st { font-size: var(--fs-sm); }
.d-blurb { margin: 0; max-width: 62ch; }
.d-sec h3 { margin: 0 0 2px; font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.d-sec p { margin: 0; max-width: 62ch; }
.note { border-radius: var(--r-md); padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); background: var(--warn-bg); }
.tags { font-size: var(--fs-sm); color: var(--text-muted); margin: 0; }
.hours { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.hours td { padding: 5px 0; border-bottom: 1px solid var(--line); }
.hours tr:last-child td { border-bottom: 0; }
.hours td:last-child { text-align: right; }
.hours tr.today td { font-weight: 700; }
.hours .closed, .hours .unk { color: var(--text-muted); }
.addr { font-size: var(--fs-sm); user-select: text; -webkit-user-select: text; }
.addr small { color: var(--text-muted); }

/* ── Toast ─────────────────────────────────────────────────────────────── */
.toast {
  position: absolute; z-index: 1100; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + var(--sp-3));
  background: var(--text); color: var(--bg); border-radius: var(--r-md); padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-3);
  display: flex; gap: var(--sp-3); align-items: center; font-size: var(--fs-sm); box-shadow: var(--shadow);
  max-width: calc(100% - 32px); width: max-content;
  animation: toast-in var(--dur-base) var(--ease-spring);
}
.toast.is-leaving { animation: toast-out 180ms ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }
@keyframes toast-out { to { opacity: 0; transform: translate(-50%, 6px); } }
.toast button { background: none; border: 0; color: var(--accent); font-weight: 700; padding: 6px 8px; font-size: var(--fs-sm); }

/* Small phones (iPhone SE and similar): let names wrap rather than cut off, slim the
   time and button columns, and give search its own row. */
@media (max-width: 374px) {
  :root { --walk-col: 56px; --ctl-col: 76px; }
  .row-main { column-gap: var(--sp-2); }
  .brand { flex-wrap: wrap; row-gap: 6px; }
  .tagline, .clock { flex-basis: 100%; flex-direction: row; align-items: center; justify-content: flex-start; gap: .5em; text-align: left; }
  .tagline > span + span::before { content: "· "; }
  .filters { flex-wrap: wrap; }
  .search { flex-basis: 100%; }
  .kinds { flex: 1; }
  .kinds .chip { flex: 1; justify-content: center; }
}

@media (min-width: 900px) {
  /* Desktop / tablet landscape: map left, list right, no drawer */
  .app { --sheet-overlap: 0px; }
  .mapwrap { right: 420px; }
  .drawer { top: 0; left: auto; width: 420px; transform: none; border-left: 1px solid var(--line); border-radius: 0; box-shadow: none; }
  .brand { padding-top: var(--sp-4); cursor: auto; touch-action: auto; }
  .handle { display: none; }
  .sheet { left: auto; width: 420px; right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .row.pop .check path { stroke-dashoffset: 0; }
}
