/* Map mode: the itinerary drawn on a street map of the city (plan.html#map).
   Streets come from output/<city>.basemap.json (build_basemap.py). Each day has
   its own color, and every mark also has a number, shape or word, so color is
   never the only signal. The fog lifts where the trip goes. */

:root {
  --mm-land: #FBF6EC; --mm-out: #F3EDDF; --mm-water: #a9cbe0; --mm-park: #d4e3c8; --mm-golf: #dbe6cd;
  --mm-res: #e0d6c6; --mm-r3: #d0c4b1; --mm-r2: #bcae98; --mm-r1: #9e8f78; --mm-r0: #C9964A; --mm-rail: #a39684;
  --mm-area: #2F6B68; --mm-label: #6E6357; --mm-label-h: #3d362f; --mm-halo: #FBF6EC;
  --mm-fog: rgba(251, 246, 236, .93); --mm-veil: rgba(251, 246, 236, .3);
  --mm-you: #1765cc; --mm-you-ring: rgba(23, 101, 204, .25);
  --mm-ink: #2b2118; --mm-line2: #d3c8b8; --mm-faint: #8a8076; --mm-focus: #1765cc;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --mm-land: #1A1229; --mm-out: #150E22; --mm-water: #24504E; --mm-park: #1C2A24; --mm-golf: #1E2C26;
    --mm-res: #241A35; --mm-r3: #33274A; --mm-r2: #43365C; --mm-r1: #5A4B75; --mm-r0: #A8661A; --mm-rail: #4A3D63;
    --mm-area: #9FD8D2; --mm-label: #A79BC0; --mm-label-h: #D6CCE6; --mm-halo: #150E22;
    --mm-fog: rgba(21, 14, 34, .9); --mm-veil: rgba(21, 14, 34, .3);
    --mm-you: #6fb6ff; --mm-you-ring: rgba(111, 182, 255, .3);
    --mm-ink: #E7DFF3; --mm-line2: #3A2B52; --mm-faint: #8A7EA3; --mm-focus: #6fb6ff;
  }
}
:root[data-theme="dark"] {
  --mm-land: #1A1229; --mm-out: #150E22; --mm-water: #24504E; --mm-park: #1C2A24; --mm-golf: #1E2C26;
  --mm-res: #241A35; --mm-r3: #33274A; --mm-r2: #43365C; --mm-r1: #5A4B75; --mm-r0: #A8661A; --mm-rail: #4A3D63;
  --mm-area: #9FD8D2; --mm-label: #A79BC0; --mm-label-h: #D6CCE6; --mm-halo: #150E22;
  --mm-fog: rgba(21, 14, 34, .9); --mm-veil: rgba(21, 14, 34, .3);
  --mm-you: #6fb6ff; --mm-you-ring: rgba(111, 182, 255, .3);
  --mm-ink: #E7DFF3; --mm-line2: #3A2B52; --mm-faint: #8A7EA3; --mm-focus: #6fb6ff;
}

/* Switching between the list and the map */
body.map-on { overflow-x: clip; }
body.map-on > .topbar, body.map-on > main, body.map-on > .foot, body.map-on > .action-bar { display: none !important; }

#map-mode {
  background: var(--bg); color: var(--ink); min-height: 100vh; position: relative;
  font: 15px/1.55 var(--body); -webkit-font-smoothing: antialiased;
}
#map-mode[hidden], #map-mode [hidden] { display: none !important; }
#map-mode *, #map-mode *::before, #map-mode *::after { box-sizing: border-box; }
#map-mode :focus { outline: none; }
#map-mode :focus-visible { outline: 3px solid var(--mm-focus); outline-offset: 2px; border-radius: 6px; }
#map-mode button { font-family: inherit; }
#map-mode h1, #map-mode h2, #map-mode h3 { text-wrap: balance; }
#map-mode .vh { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.mm-skip { position: absolute; left: -9999px; top: 8px; z-index: 80; background: var(--accent); color: var(--accent-ink); padding: 10px 14px; border-radius: 8px; font-weight: 600; text-decoration: none; }
.mm-skip:focus { left: 16px; }

/* Bar */
.mm-bar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px clamp(16px, 3vw, 36px); background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.mm-brand { display: inline-flex; align-items: center; gap: 10px; background: none; border: 0; color: var(--ink); cursor: pointer; padding: 4px; min-height: 40px; text-align: left; margin-right: auto; }
.mm-brand .brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font: 700 1.1rem var(--disp); }
.mm-brand span.t { font: 600 1.05rem/1.1 var(--disp); }
.mm-brand small { display: block; font: 500 .74rem var(--body); color: var(--muted); letter-spacing: .04em; }
.mode-switch { display: inline-flex; align-items: center; border: 1px solid var(--mm-line2); border-radius: 30px; padding: 3px; background: var(--surface); flex-shrink: 0; }
.mode-switch button { font-size: 14px; font-weight: 500; line-height: 1; color: var(--muted); background: none; border: 0; border-radius: 24px; padding: 8px 13px; min-height: 32px; cursor: pointer; }
.mode-switch button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.mode-switch button:not([aria-pressed="true"]):hover { color: var(--ink); }
.mm-iconbtn { display: inline-flex; align-items: center; gap: 7px; background: transparent; color: var(--ink); border: 1px solid var(--mm-line2); border-radius: 30px; padding: 8px 13px; min-height: 40px; font-size: 14px; font-weight: 600; cursor: pointer; }
.mm-iconbtn:hover { border-color: var(--ink); }
.mm-iconbtn svg { width: 17px; height: 17px; flex-shrink: 0; }
@media (max-width: 640px) { .mm-brand small, .mm-iconbtn .mm-w { display: none; } .mm-iconbtn { padding: 8px 10px; } }
@media (max-width: 440px) { .mm-brand span.t { display: none; } .mm-bar { gap: 8px; } }

/* Layout */
.mm-main { display: grid; grid-template-columns: minmax(320px, 420px) minmax(0, 1fr); gap: clamp(18px, 2.4vw, 32px); padding: clamp(16px, 2.4vw, 28px) clamp(16px, 3vw, 36px) 32px; align-items: start; max-width: 1600px; margin: 0 auto; }
.mm-panel { min-width: 0; }
.mm-stage { position: sticky; top: calc(var(--mm-bar-h, 62px) + 12px); min-width: 0; }
@media (max-width: 900px) {
  .mm-main { grid-template-columns: 1fr; }
  .mm-stage { position: relative; top: auto; order: -1; }
}

/* Panel */
.mm-eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin: 0 0 8px; }
.mm-h1 { font: 600 clamp(28px, 3.2vw, 38px)/1.08 var(--disp); letter-spacing: -.01em; color: var(--ink); margin: 0 0 10px; }
.mm-lead { font-size: 16px; color: var(--muted); margin: 0 0 14px; max-width: 60ch; }
.mm-fine { font-size: 12.5px; line-height: 1.5; color: var(--mm-faint); margin: 14px 0 0; }
.mm-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 14px 0 16px; }
.mm-stat { border: 1px solid var(--line); border-radius: 14px; padding: 11px 13px; background: var(--surface); }
.mm-stat b { display: block; font: 600 28px/1 var(--disp); color: var(--ink); font-variant-numeric: tabular-nums; }
.mm-stat span { display: block; font-size: 13px; line-height: 1.35; color: var(--muted); margin-top: 5px; }
.mm-days { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.mm-days button { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--mm-line2); background: var(--surface); color: var(--ink); border-radius: 30px; padding: 6px 12px; min-height: 34px; font-size: 13.5px; font-weight: 500; cursor: pointer; }
.mm-days button i { width: 10px; height: 10px; border-radius: 3px; background: var(--dc, var(--muted)); }
.mm-days button[aria-pressed="true"] { border-color: var(--dc, var(--ink)); box-shadow: inset 0 0 0 1px var(--dc, var(--ink)); font-weight: 600; }
.mm-acts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 6px; }
.mm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: 14px; font-weight: 600; border-radius: 30px; padding: 9px 16px; min-height: 40px; cursor: pointer; border: 1px solid transparent; }
.mm-btn.primary { background: var(--accent); color: var(--accent-ink); }
.mm-btn.primary:hover { filter: brightness(1.06); }
.mm-btn.ghost { background: transparent; color: var(--ink); border-color: var(--mm-line2); }
.mm-btn.ghost:hover { border-color: var(--ink); }
.mm-btn svg { width: 15px; height: 15px; }
.mm-link { background: none; border: 0; padding: 4px 0; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--mm-line2); cursor: pointer; font-size: 14px; }
.mm-link:hover { text-decoration-color: var(--ink); }

/* Steps: the map in words */
.mm-phase { margin: 16px 0 0; }
.mm-ph-t { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 8px 0; font: inherit; text-align: left; cursor: pointer; color: var(--ink); }
.mm-ph-t i { width: 12px; height: 12px; border-radius: 3px; background: var(--dc); flex-shrink: 0; }
.mm-ph-t b { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.mm-ph-t span { font-size: 12.5px; color: var(--muted); margin-left: auto; text-align: right; }
.mm-ph-t::after { content: "+"; font-size: 16px; color: var(--muted); margin-left: 6px; }
.mm-ph-t[aria-expanded="true"]::after { content: "\2212"; }
.mm-ph-title { font: 600 17px/1.3 var(--disp); margin: 10px 0 2px; color: var(--ink); }
.mm-steps { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 7px; }
.mm-area { font-size: 12px; font-weight: 600; color: var(--muted); margin: 6px 0 -1px; padding-left: 2px; }
.mm-step { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; cursor: pointer; color: var(--ink); font-size: 14.5px; line-height: 1.35; }
.mm-step:hover { border-color: var(--dc); }
.mm-step.lit { box-shadow: 0 0 0 2px var(--mm-you); border-color: transparent; }
.mm-step .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--dc); color: #fff; font-variant-numeric: tabular-nums; }
.mm-step.ev .n { border-radius: 7px; }
.mm-step.meal { background: transparent; border-style: dashed; font-size: 13.5px; }
.mm-step.meal .n { background: transparent; color: var(--dc); border: 1.5px dashed var(--dc); font-size: 13px; }
.mm-step .meta { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.mm-step .meta .ok { color: var(--ok); }
.mm-step .meta .est { color: var(--warn); }
.mm-hop { font-size: 12px; color: var(--mm-faint); padding-left: 42px; margin: -3px 0; }

/* Stage */
.mm-stage-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 8px; }
.mm-crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.mm-crumbs li + li::before { content: "\203A"; margin-right: 6px; color: var(--mm-line2); }
.mm-crumbs [aria-current] { color: var(--ink); font-weight: 600; }
.mm-zoom { display: inline-flex; gap: 6px; margin-left: auto; }
.mm-zoom button { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--mm-line2); background: var(--surface); color: var(--ink); cursor: pointer; font-size: 18px; line-height: 1; display: grid; place-items: center; }
.mm-zoom button:hover { border-color: var(--ink); }
.mm-zoom button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.mm-zoom svg { width: 16px; height: 16px; }
.mm-map { position: relative; height: min(76vh, 820px); min-height: 420px; border-radius: 18px; overflow: hidden; background: var(--mm-out); border: 1px solid var(--line); touch-action: none; }
@media (max-width: 900px) { .mm-map { height: min(62vh, 560px); min-height: 330px; } }
.mm-map > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#mm-city { cursor: grab; }
#mm-city.drag { cursor: grabbing; }
.mm-attr { position: absolute; right: 8px; bottom: 6px; font-size: 11px; color: var(--muted); background: color-mix(in srgb, var(--bg) 80%, transparent); padding: 2px 7px; border-radius: 6px; z-index: 3; max-width: calc(100% - 16px); }
.mm-attr a { color: var(--muted); }
.mm-nobase { position: absolute; left: 10px; top: 10px; z-index: 3; font-size: 12.5px; color: var(--ink); background: color-mix(in srgb, var(--bg) 88%, transparent); border: 1px solid var(--line); padding: 6px 10px; border-radius: 10px; max-width: calc(100% - 20px); }
.mm-clock { position: absolute; left: 10px; bottom: 10px; z-index: 3; font: 600 13px var(--body); color: var(--ink); background: color-mix(in srgb, var(--bg) 88%, transparent); border: 1px solid var(--line); padding: 6px 11px; border-radius: 20px; font-variant-numeric: tabular-nums; }
.mm-clock:empty { display: none; }

/* City map */
.c-out { fill: var(--mm-out); }
.c-land { fill: var(--mm-land); }
.c-park { fill: var(--mm-park); }
.c-golf { fill: var(--mm-golf); }
.c-water { fill: var(--mm-water); fill-rule: evenodd; }
.c-riv { fill: none; stroke: var(--mm-water); stroke-width: 3; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.c-res { fill: none; stroke: var(--mm-res); stroke-width: .8; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.c-r3 { fill: none; stroke: var(--mm-r3); stroke-width: 1.1; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.c-r2 { fill: none; stroke: var(--mm-r2); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.c-r1 { fill: none; stroke: var(--mm-r1); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.c-r0 { fill: none; stroke: var(--mm-r0); stroke-width: 2.8; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.c-rail { fill: none; stroke: var(--mm-rail); stroke-width: 1; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.c-hood { font-family: var(--body); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; fill: var(--mm-label); paint-order: stroke; stroke: var(--mm-halo); stroke-linejoin: round; }
.c-hood.big { fill: var(--mm-label-h); letter-spacing: .16em; }
.c-hood:not(.big) { opacity: 0; transition: opacity .3s; }
.mm-map.z1 .c-hood:not(.big) { opacity: 1; }
.c-roadl { display: none; font-family: var(--body); font-weight: 500; fill: var(--mm-label-h); paint-order: stroke; stroke: var(--mm-halo); stroke-linejoin: round; }
.mm-map.z2 .c-roadl { display: inline; }
.c-area { fill: var(--dc); fill-opacity: .06; stroke: var(--dc); stroke-width: 1.2; stroke-dasharray: 2 4; vector-effect: non-scaling-stroke; opacity: .9; }
.c-fog { fill: var(--mm-fog); transition: fill 1s ease; pointer-events: none; }
.mm-map.lifted .c-fog { fill: var(--mm-veil); }

/* Routes: solid for a ride, dotted for a walk */
.c-route { fill: none; stroke: var(--dc); stroke-width: 3.4; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.c-route.walk { stroke-dasharray: 1 6; stroke-width: 4; }
.c-route-halo { fill: none; stroke: var(--mm-halo); stroke-width: 7; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.c-routes.dim .c-route, .c-routes.dim .c-route-halo { opacity: .18; }
.c-routes.dim .on .c-route, .c-routes.dim .on .c-route-halo { opacity: 1; }

/* Pins */
.pin { cursor: pointer; }
.pin .pin-b { fill: var(--dc); stroke: var(--mm-halo); stroke-width: 2.5; }
.pin .pin-n { font: 700 11px var(--body); fill: #fff; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.pin.meal .pin-b { fill: var(--mm-land); stroke: var(--dc); stroke-width: 2; stroke-dasharray: 3 2.2; }
.pin.meal .pin-n { fill: var(--dc); font-size: 10px; }
.pin .pin-l { font: 600 12px var(--body); fill: var(--mm-label-h); paint-order: stroke; stroke: var(--mm-halo); stroke-width: 4px; stroke-linejoin: round; opacity: 0; transition: opacity .2s; pointer-events: none; }
.mm-map.z1 .pin.lbl .pin-l, .pin:hover .pin-l, .pin:focus .pin-l, .pin.act .pin-l { opacity: 1; }
.pin:focus-visible .pin-b { stroke: var(--mm-focus); stroke-width: 3.5; }
.pin.act .pin-b { stroke: var(--mm-you); stroke-width: 3.5; }
.pin.later { opacity: 0; }
.pin-pop { animation: pinpop .55s cubic-bezier(.2, 1.4, .4, 1) both; transform-box: fill-box; transform-origin: center; }
@keyframes pinpop { from { opacity: 0; transform: translateY(-10px) scale(.4); } to { opacity: 1; transform: none; } }

/* Hotel and the walker */
.home-b { fill: var(--mm-you); stroke: var(--mm-halo); stroke-width: 2.5; }
.home-i { fill: none; stroke: #fff; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.you-core { fill: var(--mm-you); stroke: var(--mm-halo); stroke-width: 3; }
.you-ring { fill: var(--mm-you-ring); }
.you-pulse { fill: none; stroke: var(--mm-you); stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: youpulse 1.8s ease-out infinite; }
@keyframes youpulse { 0% { transform: scale(.6); opacity: .95; } 100% { transform: scale(2.6); opacity: 0; } }
.you-lbl { font: 700 11px var(--body); letter-spacing: .12em; fill: var(--mm-you); paint-order: stroke; stroke: var(--mm-halo); stroke-width: 4px; text-anchor: middle; }

/* Legend */
.mm-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 10px 2px 0; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.mm-legend li { display: inline-flex; align-items: center; gap: 7px; }
.mm-legend svg { width: 22px; height: 18px; flex-shrink: 0; overflow: visible; }

/* Detail sheet */
.mm-sheet { position: absolute; top: 12px; right: 12px; bottom: 12px; width: min(390px, calc(100% - 24px)); z-index: 6; background: var(--surface); border: 1px solid var(--mm-line2); border-radius: 16px; box-shadow: 0 18px 50px rgba(0, 0, 0, .22); overflow: auto; padding: 18px 18px 20px; }
.mm-sheet-x { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--mm-line2); background: var(--bg); color: var(--ink); font-size: 20px; line-height: 1; cursor: pointer; }
.mm-sheet .mm-eyebrow { color: var(--dc); margin-right: 40px; }
.mm-sheet h2 { font: 600 22px/1.2 var(--disp); color: var(--ink); margin: 2px 40px 10px 0; }
.mm-sheet p { font-size: 14.5px; line-height: 1.6; margin: 0 0 10px; }
.mm-kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; margin: 10px 0; }
.mm-kv dt { color: var(--muted); }
.mm-kv dd { margin: 0; color: var(--ink); font-variant-numeric: tabular-nums; }
.mm-sheet .badge { display: inline-block; font-size: 12.5px; font-weight: 600; border-radius: 20px; padding: 3px 10px; }
.mm-sheet .badge.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.mm-sheet .badge.est { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.mm-sheet .badge.bad { background: color-mix(in srgb, #c92a2a 15%, transparent); color: #c92a2a; }
.mm-sheet-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.mm-sheet-acts a { text-decoration: none; }
@media (max-width: 900px) {
  .mm-sheet { position: fixed; top: auto; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); width: auto; max-height: 70vh; z-index: 70; }
}

.mm-toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 95; background: var(--ink); color: var(--bg); border-radius: 12px; padding: 10px 16px; font-size: 14px; max-width: calc(100% - 32px); box-shadow: 0 10px 30px rgba(0, 0, 0, .3); }
.mm-toast:empty { display: none; }

@media (prefers-reduced-motion: reduce) {
  .c-fog { transition: none !important; }
  .you-pulse, .pin-pop { animation: none !important; }
}
@media print {
  #map-mode .mm-bar, #map-mode .mm-zoom, #map-mode .mm-acts { display: none !important; }
  .mm-main { grid-template-columns: 1fr; }
  .mm-stage { position: static; }
}

/* MusafirQuest logo mark */
.mm-brand .brand-mark svg { width: 21px; height: 21px; display: block; }
.mm-brand span.t em { font-style: normal; color: var(--accent); }
