/* ============================================================
   map — the journey map overlay (js/overlays/map.js): a full-screen parchment map you can pinch,
   drag and wheel; the Road inked in up to where you are. Loads last.
   ============================================================ */
.mapov { --ink: #2a170a; --halo: #f6ecd2; position: fixed; inset: 0; z-index: 78; overflow: hidden; color: var(--ink); background: #c9b388;
  opacity: 0; transition: opacity .3s var(--ease); overscroll-behavior: contain; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.mapov.show { opacity: 1; }
body.map-open { overflow: hidden; }

/* the stage and the world (the image + the route) — moved with one transform */
.mp-stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; outline: none;
  background: radial-gradient(ellipse at 50% 42%, #e2d1a9, #b49c6c 115%); }
.mp-stage.dragging { cursor: grabbing; }
.mp-world { position: absolute; left: 0; top: 0; width: 1536px; height: 1024px; transform-origin: 0 0; background: #e6d6b0;
  box-shadow: 0 40px 90px -40px rgba(40, 24, 8, .65), 0 0 60px rgba(60, 36, 12, .18); }
.mp-stage.moving .mp-world { will-change: transform; }
.mp-base { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; -webkit-user-drag: none; }
.mp-base.hi { opacity: 0; transition: opacity .45s ease; }
.mp-base.hi.on { opacity: 1; }

/* the Road: faint dots for all of it, dark ink (with a paper halo and a little bleed) for what you've walked */
.mp-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.mp-svg path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.mp-trail-halo { stroke: rgba(250, 240, 214, .3); }
.mp-trail { stroke: rgba(48, 28, 12, .62); }
.mp-ink-halo { stroke: rgba(250, 241, 216, .5); }
.mp-ink-bleed { stroke: rgba(70, 36, 12, .17); }
.mp-ink { stroke: #2a1609; }
.mp-ink-fine { stroke: rgba(34, 16, 5, .62); }

/* pins: placed in screen space every frame, so they stay the same size at any zoom */
.mp-pins { position: absolute; inset: 0; pointer-events: none; }
.mp-pin { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; }
button.mp-pin { appearance: none; border: 0; background: none; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; overflow: visible; pointer-events: auto; -webkit-tap-highlight-color: transparent; }
button.mp-pin::before { content: ""; position: absolute; left: -16px; top: -16px; width: 32px; height: 32px; border-radius: 50%; }
button.mp-pin:focus { outline: none; }

/* places */
.mp-dot { position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; border-radius: 50%; transition: transform .2s var(--ease); }
.mp-place.reached .mp-dot { background: radial-gradient(circle at 35% 32%, #fff0bf, #e0ab42 55%, #9a681a); box-shadow: 0 0 0 1.5px var(--ink), 0 0 9px 2px rgba(255, 210, 110, .55); }
.mp-place.ahead .mp-dot { left: -4px; top: -4px; width: 8px; height: 8px; background: rgba(248, 238, 214, .8); box-shadow: 0 0 0 1.5px rgba(42, 23, 10, .55); }
.mp-place.r1.reached .mp-dot { left: -6px; top: -6px; width: 12px; height: 12px; }
.mp-place:hover .mp-dot, .mp-place:focus-visible .mp-dot { transform: scale(1.25); }
.mp-place:focus-visible .mp-dot { box-shadow: 0 0 0 3px var(--gold), 0 0 9px 2px rgba(255, 210, 110, .55); }
.mp-lbl { position: absolute; left: 0; top: 0; white-space: nowrap; font-family: var(--font-display); font-weight: 600; font-size: 12.5px; letter-spacing: .04em; line-height: 1.15;
  color: var(--ink); pointer-events: auto; transition: opacity .2s;
  text-shadow: 0 0 2px var(--halo), 0 0 3px var(--halo), 0 0 6px rgba(246, 236, 210, .85), 0 0 10px rgba(246, 236, 210, .5); }
.mp-place.r1 .mp-lbl { font-size: 14px; font-weight: 700; }
.mp-place.r3 .mp-lbl { font-size: 11.5px; font-weight: 500; }
.mp-place.ahead .mp-lbl { color: rgba(42, 23, 10, .72); }
.mp-place.nolabel .mp-lbl { opacity: 0; visibility: hidden; }
.mp-place.light .mp-lbl { color: #f6e6c2; text-shadow: 0 0 2px #1a0d05, 0 0 4px #1a0d05, 0 0 8px rgba(20, 8, 2, .85), 0 0 12px rgba(20, 8, 2, .5); }
.mp-place.light.ahead .mp-lbl { color: rgba(246, 230, 194, .8); }

/* region names: quiet italic lettering under everything */
.mp-region > span { position: absolute; left: 0; top: 0; white-space: nowrap; font-family: var(--font-body); font-style: italic; font-size: calc(16px * var(--sz, 1));
  letter-spacing: .2em; line-height: 1; color: rgba(62, 38, 16, .56); transform: rotate(var(--rot, 0deg)); transition: opacity .25s;
  text-shadow: 0 0 3px rgba(246, 236, 210, .55); }
.mp-region.light > span { color: rgba(246, 222, 190, .62); text-shadow: 0 0 4px rgba(20, 8, 2, .6); }
.mp-region.hid > span { opacity: 0; }

/* companions: small bubbles where they joined (faded where they left), a cluster next to you */
.mp-row { position: absolute; display: flex; align-items: center; pointer-events: none; }
.mp-group.g-t .mp-row { left: 0; bottom: 9px; transform: translateX(-50%); }
.mp-group.g-b .mp-row { left: 0; top: 9px; transform: translateX(-50%); }
.mp-group.g-l .mp-row { right: 10px; top: 0; transform: translateY(-50%); }
.mp-group.g-r .mp-row { left: 10px; top: 0; transform: translateY(-50%); }
.mp-group.g-tl .mp-row { right: 6px; bottom: 6px; }
.mp-group.g-tr .mp-row { left: 6px; bottom: 6px; }
.mp-group.g-bl .mp-row { right: 6px; top: 6px; }
.mp-group.g-br .mp-row { left: 6px; top: 6px; }
.mp-bub { appearance: none; border: 0; padding: 0; flex: none; width: 24px; height: 24px; margin-left: -8px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; cursor: pointer; pointer-events: auto;
  background: radial-gradient(circle at 35% 30%, hsl(var(--h) 40% 55%), hsl(var(--h) 38% 32%)); color: #fff; font-family: var(--font-display); font-size: 11px;
  box-shadow: 0 0 0 2px #f4e8c8, 0 3px 7px -1px rgba(30, 16, 6, .5); transition: transform .18s var(--ease), opacity .2s; -webkit-tap-highlight-color: transparent; }
.mp-row > .mp-bub:first-child { margin-left: 0; }
.mp-bub img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.mp-bub:hover, .mp-bub:focus-visible { transform: translateY(-2px) scale(1.12); z-index: 2; outline: none; }
.mp-bub.left { opacity: .5; filter: grayscale(.75) sepia(.2); }
.mp-bub.met { box-shadow: 0 0 0 2px #e6d6ae, 0 3px 7px -1px rgba(30, 16, 6, .45); }
.mp-more { appearance: none; border: 0; flex: none; height: 22px; min-width: 26px; margin-left: -4px; padding: 0 7px; border-radius: 999px; cursor: pointer; pointer-events: auto;
  background: #2f1d0e; color: #f4e6c4; font-family: var(--font-display); font-size: 11px; letter-spacing: .02em; box-shadow: 0 0 0 2px #f4e8c8, 0 3px 7px -1px rgba(30, 16, 6, .5); }
.mp-extra { display: none; }
.mp-row.open .mp-extra { display: contents; }
.mp-row.open > .mp-more { display: none; }
.mp-row.open > .mp-bub, .mp-row.open .mp-extra > .mp-bub { margin-left: 3px; }

/* you */
.mp-me { z-index: 3; }
.mp-me::before { content: ""; position: absolute; left: -31px; top: -31px; width: 62px; height: 62px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(224, 171, 66, .6); animation: mpPulse 2.8s ease-out infinite; pointer-events: none; }
@keyframes mpPulse { from { transform: scale(.8); opacity: .9; } to { transform: scale(1.35); opacity: 0; } }
.mp-face { appearance: none; border: 0; padding: 0; position: absolute; left: -24px; top: -24px; width: 48px; height: 48px; border-radius: 50%; overflow: hidden; cursor: pointer; pointer-events: auto;
  background: radial-gradient(circle at 40% 30%, #e8cf96, #a87c3c); display: grid; place-items: center; color: var(--ink); font-family: var(--font-display); font-size: 12px;
  box-shadow: 0 0 0 3px #f7e9c2, 0 0 0 4.5px #9a681a, 0 8px 16px -4px rgba(30, 16, 6, .65); -webkit-tap-highlight-color: transparent; }
.mp-face img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.mp-face:focus-visible { outline: none; box-shadow: 0 0 0 3px #f7e9c2, 0 0 0 6px var(--gold), 0 8px 16px -4px rgba(30, 16, 6, .65); }
.mp-cluster .mp-row { left: 21px; top: 4px; }
.mp-cluster .mp-bub { width: 30px; height: 30px; margin-left: -11px; box-shadow: 0 0 0 2.5px #f4e8c8, 0 4px 9px -2px rgba(30, 16, 6, .55); }
.mp-cluster .mp-more { height: 26px; }

/* the frame: title, close, zoom */
.mp-top { position: absolute; left: 0; right: 0; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; pointer-events: none;
  padding: calc(12px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) 30px calc(18px + env(safe-area-inset-left)); color: var(--ink);
  background: linear-gradient(180deg, rgba(240, 226, 194, .97) 0%, rgba(240, 226, 194, .9) 45%, rgba(240, 226, 194, .55) 72%, rgba(240, 226, 194, 0) 100%); }
.mp-top > * { pointer-events: auto; }
.mp-title { min-width: 0; padding-top: 2px; }
.mp-title h2 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: clamp(17px, 4.6vw, 22px); letter-spacing: .08em; line-height: 1.15; color: #2a170a; text-shadow: 0 1px 0 rgba(255, 248, 230, .6); }
.mp-title p { margin: 3px 0 0; font-style: italic; font-size: 14.5px; color: #5e4329; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mapov .iconbtn.glass { width: 44px; height: 44px; flex: none; }
.mp-ctrl { position: absolute; z-index: 5; right: calc(14px + env(safe-area-inset-right)); bottom: calc(18px + env(safe-area-inset-bottom)); display: grid; gap: 8px; }
.mp-ctrl .iconbtn:first-child { border-radius: 999px; }
@media (min-width: 1024px) { .mp-top { padding: 20px 22px 40px 28px; } .mp-ctrl { right: 22px; bottom: 24px; } }

/* a place's popover */
.mp-pop { position: absolute; left: 0; top: 0; z-index: 4; width: 236px; border-radius: 14px; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .18s ease;
  background: #f6ebd1; color: var(--ink); box-shadow: 0 20px 44px -16px rgba(30, 16, 6, .75), 0 2px 6px rgba(30, 16, 6, .18); }
.mp-pop.show { opacity: 1; }
.mp-pop.ahead { width: auto; max-width: 250px; }
.has-tex-parchment .mp-pop { background: linear-gradient(rgba(246, 235, 209, .86), rgba(246, 235, 209, .86)), var(--tex-parchment) center / 300px; }
.mp-thumb { aspect-ratio: 16 / 9; overflow: hidden; background: #2a1a10; }
.mp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mp-pop-t { display: grid; gap: 2px; padding: 9px 13px 11px; }
.mp-pop-t b { font-family: var(--font-display); font-size: 15px; letter-spacing: .04em; line-height: 1.2; }
.mp-pop-t span { font-size: 14px; font-style: italic; color: #6e5233; }

.mp-hint { position: absolute; left: 50%; top: calc(86px + env(safe-area-inset-top)); transform: translateX(-50%); padding: 8px 14px; border-radius: 999px; white-space: nowrap; pointer-events: none;
  background: rgba(30, 18, 8, .6); color: #f6ead0; font-size: 14px; transition: opacity .6s; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.mp-hint.out { opacity: 0; }
