/* Magic Spot
   Layout: the map fills the screen; a drag-to-hide drawer holds the brand row, the
   "where are you going?" search and the parking list; details open in a bottom sheet.

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

:root {
  /* ── Miami palette (raw colours) ── */
  --mia-flamingo: #D63D73;   /* flamingo pink: the accent */
  --mia-ocean: #0B7285;      /* Biscayne Bay teal */
  --mia-mango: #C76A12;      /* mango / sunset */
  --mia-orchid: #7A4BB0;     /* Art Deco neon orchid */
  --mia-palm: #1D7F55;       /* royal palm green */
  --mia-seafoam-0: #FFFFFF;
  --mia-seafoam-50: #EEF5F4; /* sea-foam page */
  --mia-seafoam-100: #E1ECEB;
  --mia-seafoam-200: #CFDDDC;
  --mia-seafoam-500: #5B7078;
  --mia-night: #0E2230;      /* Ocean Drive after dark */
  --mia-amber: #A15C00;

  /* ── Semantic tokens (use these in components) ── */
  --bg: var(--mia-seafoam-50);
  --surface: var(--mia-seafoam-0);
  --surface-2: var(--mia-seafoam-100);
  --line: var(--mia-seafoam-200);
  --text: var(--mia-night);
  --text-muted: var(--mia-seafoam-500);
  --accent: var(--mia-flamingo);
  --on-accent: #FFFFFF;
  --kind-garage: var(--mia-ocean);
  --kind-lot: var(--mia-mango);
  --kind-ride: var(--mia-orchid);
  --status-open: var(--mia-palm);
  --status-soon: var(--mia-amber);
  --status-closed: var(--mia-seafoam-500);
  --free: var(--mia-palm);
  --free-bg: #E2F3EA;
  --warn: var(--mia-amber);
  --warn-bg: #FCF0DF;
  --shadow: 0 1px 2px rgb(14 34 48 / .08), 0 6px 20px rgb(14 34 48 / .10);

  /* ── Map (OpenFreeMap vector style, recoloured from these) ── */
  --map-land: #EEF4F2;
  --map-water: #B9E2E7;        /* turquoise shallows */
  --map-water-label: #2F7C8C;
  --map-park: #D3EBDC;
  --map-building: #E2E9E8;
  --map-building-line: #D6DFDE;
  --map-road: #FFFFFF;
  --map-road-major: #FFFFFF;
  --map-road-casing: #D2DEDD;
  --map-rail: #C6D3D2;
  --map-label: #5B7078;

  /* ── Type ── */
  --font-display: "Josefin Sans", "Avenir Next", "Futura", system-ui, sans-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: 30px; /* the Magic Spot 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);
  --sheet-overlap: 16px;
  --walk-col: 64px;          /* distance column in list rows */

  /* ── Motion ── */
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --dur-fast: 150ms;
  --dur-base: 240ms;
  --dur-slow: 380ms;
  --dur-list: 420ms;
  --stagger: 45ms;
  --dur-drawer: 380ms;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1A22; --surface: #13262F; --surface-2: #1A3039; --line: #243A43;
    --text: #E6EFF0; --text-muted: #8FA6AD;
    --accent: #F2679A; --on-accent: #1B0710;
    --kind-garage: #3FB3C6; --kind-lot: #E89A4E; --kind-ride: #B48BE6;
    --status-open: #4FC48E; --status-soon: #E9AE48; --status-closed: #8FA6AD;
    --free: #4FC48E; --free-bg: #12301F; --warn: #E9AE48; --warn-bg: #2E2413;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 6px 20px rgb(0 0 0 / .4);
    --map-land: #0B1A22; --map-water: #0B3440; --map-water-label: #5FA9B8; --map-park: #102A20;
    --map-building: #13252E; --map-building-line: #13252E; --map-road: #1C313B; --map-road-major: #27414C;
    --map-road-casing: #0B1A22; --map-rail: #273D47; --map-label: #8FA6AD;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1A22; --surface: #13262F; --surface-2: #1A3039; --line: #243A43;
  --text: #E6EFF0; --text-muted: #8FA6AD;
  --accent: #F2679A; --on-accent: #1B0710;
  --kind-garage: #3FB3C6; --kind-lot: #E89A4E; --kind-ride: #B48BE6;
  --status-open: #4FC48E; --status-soon: #E9AE48; --status-closed: #8FA6AD;
  --free: #4FC48E; --free-bg: #12301F; --warn: #E9AE48; --warn-bg: #2E2413;
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 6px 20px rgb(0 0 0 / .4);
  --map-land: #0B1A22; --map-water: #0B3440; --map-water-label: #5FA9B8; --map-park: #102A20;
  --map-building: #13252E; --map-building-line: #13252E; --map-road: #1C313B; --map-road-major: #27414C;
  --map-road-casing: #0B1A22; --map-rail: #273D47; --map-label: #8FA6AD;
  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-garage { --k: var(--kind-garage); }
.k-lot { --k: var(--kind-lot); }
.k-ride { --k: var(--kind-ride); }
.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. Keeping the name on the drawer,
   not at the top, keeps it clear of the blur iOS puts under the status bar. */
.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; }

.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;
  background: var(--bg);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: 0 -6px 18px rgb(14 34 48 / .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; }
.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 opposite it, both on the same baseline. */
.wordmark {
  font: 700 var(--fs-brand)/0.9 var(--font-display);
  letter-spacing: -.02em;
  color: var(--text);
  padding-top: 4px; /* Josefin sits high on its baseline */
}
.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); }
.clock:not([hidden]) ~ .tagline, .tagline:has(~ .clock:not([hidden])) { display: none; }

/* ── Map ───────────────────────────────────────────────────────────────── */
.mapwrap { position: absolute; inset: 0; z-index: 1; padding-top: var(--safe-top); }
.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); margin: 0 calc(var(--sp-2) + env(safe-area-inset-right, 0px)) var(--sp-2) 0; }
.maplibregl-ctrl-attrib a { color: var(--text-muted); }
.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-locate.on svg { fill: currentColor; }

/* Parking pins: rounded squares (a parking sign, not a café dot), coloured by kind. */
.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: 8px;
  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;
  font: 700 13px/1 var(--font-display);
  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, .pin.is-only .pin-b { filter: saturate(.15); opacity: .6; }
/* Free (or free under a condition): a small green badge */
.pin.is-free .pin-b::after {
  content: "$0"; position: absolute; right: -9px; top: -8px;
  font: 800 8px/1 var(--font-body); color: #fff; background: var(--free);
  padding: 2px 3px; border-radius: 6px; border: 1.5px solid var(--surface);
}
.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; border-radius: 4px; font-size: 0; }
.zoomed-out .pin-b svg, .zoomed-out .pin.is-free .pin-b::after { display: none; }
.zoomed-out .pin.is-sel .pin-b { transform: scale(1.6); }

/* Where you're going: a flamingo flag */
.dest-pin { width: 34px; height: 40px; display: grid; place-items: end center; pointer-events: none; animation: pin-in var(--dur-slow) var(--ease-spring) backwards; transform-origin: bottom center; }
.dest-pin svg { width: 34px; height: 40px; fill: var(--accent); stroke: var(--surface); stroke-width: 1.6; filter: drop-shadow(0 2px 3px rgb(0 0 0 / .3)); }
.dest-pin circle { fill: var(--surface); stroke: none; }

.me-dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: #2F7CF6; 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 rgb(47 124 246 / .45); } 70%,100% { box-shadow: 0 0 0 14px transparent; } }

.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; grid-template-columns: minmax(0, 1fr); }
.peek .row-sub { white-space: normal; }
.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; flex-direction: column; gap: var(--sp-2);
}
/* "Where are you going?" */
.search {
  position: relative; display: flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-pill); padding: 0 6px 0 var(--sp-3); height: 42px;
  transition: border-color var(--dur-fast);
}
.search:focus-within { border-color: var(--accent); }
.search > svg { width: 18px; height: 18px; color: var(--accent); 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); }
.search input::-webkit-search-cancel-button { display: none; }
.search .clear {
  flex: none; width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--surface-2);
  display: grid; place-items: center; color: var(--text-muted);
}
.search .clear svg { width: 14px; height: 14px; }
.suggest {
  list-style: none; margin: 0; padding: var(--sp-1) 0; position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow);
  max-height: min(320px, 45dvh); overflow-y: auto;
  animation: fade-up var(--dur-fast) var(--ease-out);
}
.suggest button {
  width: 100%; border: 0; background: none; text-align: left; padding: 9px var(--sp-3);
  display: grid; grid-template-columns: 22px minmax(0, 1fr); column-gap: var(--sp-2); align-items: center;
}
.suggest button:hover, .suggest button.active { background: var(--surface-2); }
.suggest .s-ico { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; color: #fff; background: var(--k, var(--text-muted)); font: 700 11px/1 var(--font-display); }
.suggest .s-ico.place { background: color-mix(in srgb, var(--accent) 15%, var(--surface)); color: var(--accent); }
.suggest .s-ico svg { width: 13px; height: 13px; }
.suggest .s-name { font-weight: 700; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest .s-sub { grid-column: 2; font-size: var(--fs-xs); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest .s-head { padding: 6px var(--sp-3) 2px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.suggest .s-note { padding: 8px var(--sp-3); font-size: var(--fs-xs); color: var(--text-muted); }

.kinds { display: flex; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; flex: 1; justify-content: center;
  border: 1px solid var(--line); background: transparent; color: var(--text);
  border-radius: var(--r-pill); padding: 0 10px; height: 34px; 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); background: var(--k); border-color: var(--k); color: #fff; }
.chip[aria-pressed="true"] .dot { background: #fff; }
@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); }

.hint { margin: var(--sp-2) 2px var(--sp-1); font-size: var(--fs-sm); color: var(--text-muted); }
.hint b { color: var(--text); }
.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 700; font-size: inherit; text-decoration: none; }
.link.quiet { color: var(--text-muted); font-weight: 400; }
.empty { color: var(--text-muted); text-align: center; padding: var(--sp-5) 0; font-size: var(--fs-sm); }
.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; }
.list-foot { text-align: center; margin: var(--sp-5) 0 0; font-size: var(--fs-sm); color: var(--text-muted); }

/* ── Rows ──────────────────────────────────────────────────────────────── */
/* Name and price · distance. The distance column is fixed-width so the icons line up. */
.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-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: 3px; align-items: center;
}
.row-main > .row-top, .row-main > .row-sub, .row-main > .row-price { grid-column: 1; }
.row-top { display: flex; align-items: flex-start; gap: var(--sp-2); min-width: 0; }
.row-top .dot { margin-top: 6px; border-radius: 2px; }
.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;
  transition: color var(--dur-fast);
}
.row-price { padding-left: 16px; font-size: var(--fs-sm); font-weight: 700; color: var(--text); }
.row-price.free { color: var(--free); }
.row-price.unk { color: var(--text-muted); font-weight: 400; }
.row-sub { font-size: var(--fs-sm); color: var(--text-muted); padding-left: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-walk {
  grid-column: 2; grid-row: 1 / span 3; 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.is-sel .row-name { color: var(--accent); }
.row.is-only .row-name, .row.is-only .row-price { color: var(--text-muted); font-weight: 400; }
.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); } }

.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; }
.st-only { color: var(--warn); font-weight: 400; }

/* Destination banner above the list */
.dest {
  display: flex; align-items: center; gap: var(--sp-2); margin: var(--sp-2) 0 var(--sp-1);
  font-size: var(--fs-sm); color: var(--text-muted);
}
.dest svg { width: 16px; height: 16px; color: var(--accent); flex: none; fill: var(--accent); stroke: none; }
.dest b { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.dest .link { margin-left: auto; flex: none; }

/* ── Tips ──────────────────────────────────────────────────────────────── */
.view:not([hidden]) { animation: fade-up var(--dur-base) var(--ease-out); }
@keyframes fade-up { from { opacity: 0; transform: translateY(4px); } }
.tips { display: flex; flex-direction: column; gap: var(--sp-5); padding-top: var(--sp-3); }
.tip h2 { font: 700 var(--fs-md)/1.25 var(--font-body); margin: 0 0 var(--sp-2); }
.tip p { margin: 0 0 var(--sp-2); font-size: var(--fs-sm); line-height: 1.5; max-width: 62ch; }
.tip ul { margin: 0; padding-left: 18px; font-size: var(--fs-sm); line-height: 1.5; display: flex; flex-direction: column; gap: 6px; }
.tip .card { background: var(--surface); border-radius: var(--r-md); padding: var(--sp-3); }
.free-list { list-style: none; padding: 0 !important; gap: 0 !important; }
.free-list li { padding: var(--sp-2) 0; border-bottom: 1px solid var(--line); }
.free-list li:last-child { border-bottom: 0; }
.free-list b { display: block; }
.free-list span { color: var(--text-muted); }
.tbl-wrap { overflow-x: auto; margin-inline: calc(-1 * var(--sp-3)); padding-inline: var(--sp-3); }
.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-xs); font-variant-numeric: tabular-nums; min-width: 420px; }
.tbl th { text-align: left; font-weight: 700; color: var(--text-muted); padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); }
.tbl td { padding: 7px 8px 7px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td:first-child { font-weight: 700; }

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

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

/* ── Sheet ─────────────────────────────────────────────────────────────── */
.scrim { position: absolute; inset: 0; background: rgb(14 34 48 / .35); z-index: 900; 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; } }
.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%); } }
.grab { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: var(--sp-2) auto 0; flex: none; }
.close {
  position: absolute; z-index: 1; 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; }
.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(2, 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); }
.d-name { font: 700 var(--fs-xl)/1.1 var(--font-display); 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 .dot { border-radius: 2px; }
.d-price { font: 700 var(--fs-lg)/1.25 var(--font-body); margin: 0; }
.d-price.free { color: var(--free); }
.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; font-size: var(--fs-sm); line-height: 1.5; }
.d-sec .link { font-weight: 400; text-decoration: underline; text-underline-offset: 2px; }
.note { border-radius: var(--r-md); padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); background: var(--warn-bg); }
.note.free { background: var(--free-bg); }
.note b { color: var(--warn); }
.note.free b { color: var(--free); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.tags li { font-size: var(--fs-xs); padding: 3px 8px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--text); }
.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 tr.today td:first-child::after { content: " · today"; color: var(--accent); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.hours .closed, .hours .unk { color: var(--text-muted); }
.addr { font-size: var(--fs-sm); user-select: text; -webkit-user-select: text; margin: 0; }
.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); }

/* ── Drive mode ────────────────────────────────────────────────────────── */
/* For a phone in a car dock: glanceable, huge targets, nothing to type. The drawer and tabs
   go away; the map follows you; the best three car parks sit in big cards. Tapping one hands
   turn-by-turn navigation to a real maps app. */
/* The Drive switch: a flamingo pill in the map's bottom-left corner, riding just above the
   list as it moves. It steps aside while a pin's preview card uses that corner. */
.drive-fab {
  position: absolute; z-index: 550;
  left: calc(var(--sp-3) + env(safe-area-inset-left, 0px));
  bottom: calc(var(--map-bottom, 0px) + var(--sp-3));
  height: 44px; padding: 0 16px 0 13px; border: 0; border-radius: var(--r-pill);
  background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: var(--fs-md);
  transition: bottom var(--dur-drawer) var(--ease-out), transform var(--dur-fast), opacity var(--dur-fast);
}
.drive-fab svg { width: 22px; height: 22px; stroke-width: 2.2; }
.drive-fab:active { transform: scale(.95); }
.stage.dragging .drive-fab { transition: none; }
.peek:not([hidden]) ~ .drive-fab { opacity: 0; pointer-events: none; transform: translateY(8px); }
.drive {
  position: absolute; z-index: 700; left: 0; right: 0; bottom: 0;
  background: var(--bg); border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: 0 -6px 24px rgb(0 0 0 / .18);
  padding: var(--sp-3) var(--gutter-r) calc(var(--sp-3) + env(safe-area-inset-bottom, 0px)) var(--gutter-l);
  display: flex; flex-direction: column; gap: var(--sp-3);
  animation: rise var(--dur-base) var(--ease-out);
}
.app.driving .drawer, .app.driving .tabs, .app.driving .peek, .app.driving .drive-fab { display: none !important; }
.app.driving .pin:not(.is-cand) { display: none; }
.app.driving .pin.is-cand .pin-b { transform: scale(1.25); }
.app.driving .pin.is-target .pin-b { transform: scale(1.5); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 45%, transparent), 0 2px 6px rgb(0 0 0 / .35); }
.app.driving .me-dot { width: 22px; height: 22px; }
/* Toasts go to the top in Drive mode, clear of the cards. */
.app.driving .toast { bottom: auto; top: calc(var(--safe-top) + var(--sp-3)); }

.drive-top { display: flex; align-items: center; gap: var(--sp-3); }
.drive-exit {
  flex: none; height: 52px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); color: var(--text);
  display: grid; place-items: center; font-weight: 700; font-size: var(--fs-sm);
}
.drive-exit { width: 52px; }
.drive-exit svg { width: 24px; height: 24px; stroke-width: 2.4; }
.drive-title { flex: 1; min-width: 0; }
.drive-title small { display: block; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.drive-title b { display: block; font: 700 22px/1.15 var(--font-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.drive-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.dcard {
  display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; column-gap: var(--sp-3); align-items: center;
  min-height: 84px; padding: var(--sp-3) var(--sp-3) var(--sp-3) 0; border-radius: var(--r-md);
  background: var(--surface); border: 1.5px solid var(--line); color: var(--text); text-decoration: none; overflow: hidden;
  transition: transform var(--dur-fast), border-color var(--dur-fast);
}
.dcard:active { transform: scale(.98); }
.dcard::before { content: ""; align-self: stretch; margin: calc(-1 * var(--sp-3)) 0; background: var(--k); }
.dcard.is-target { border-color: var(--accent); box-shadow: 0 0 0 1.5px var(--accent); }
.dc-text { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.dc-name { font-size: 20px; font-weight: 700; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-price { font-size: 17px; font-weight: 700; }
.dc-price.free { color: var(--free); }
.dc-price.unk { color: var(--text-muted); font-weight: 400; font-size: 15px; }
.dc-meta { font-size: 15px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-meta .st { font-size: 15px; }
.dc-go {
  display: grid; place-items: center; width: 64px; height: 56px; border-radius: var(--r-md);
  background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 17px;
}
.dcard.is-target .dc-go { font-size: 13px; line-height: 1.1; text-align: center; padding: 0 4px; }
.drive-note { margin: 0; font-size: 15px; color: var(--text-muted); text-align: center; }
.drive-note .link { font-size: 15px; }
.drive-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
.drive-actions .btn { height: 60px; font-size: 18px; }
.drive-actions .btn svg { width: 22px; height: 22px; }
/* Arrived */
.arrive h2 { font: 700 26px/1.15 var(--font-display); margin: 0; text-wrap: balance; }
.arrive .lead { font-size: 22px; font-weight: 700; margin: 6px 0 0; }
.arrive .lead.free { color: var(--free); }
.arrive .facts { list-style: none; margin: var(--sp-2) 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 17px; }
.arrive .facts li { display: flex; gap: 8px; }
.arrive .facts li::before { content: "•"; color: var(--accent); font-weight: 800; }

/* Landscape dashboard mounts: map on the left, the cards on the right. */
@media (orientation: landscape) and (max-height: 560px) {
  .drive {
    top: 0; left: auto; width: min(460px, 52vw); border-radius: 0; overflow-y: auto;
    padding-top: calc(var(--sp-3) + env(safe-area-inset-top, 0px)); padding-left: var(--sp-4);
  }
  .dcard { min-height: 74px; }
  .dc-name { font-size: 18px; }
}

/* Small phones (iPhone SE and similar) */
@media (max-width: 374px) {
  :root { --walk-col: 56px; --fs-brand: 26px; }
  .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: "· "; }
}

@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; }
}
