/* Maddlink — the map layer: pins, clusters, ripples, tooltips, controls (IDENTITY §5; D18: pins and clusters are
   card-coloured with ink text, cyan when active — plan default n°7). */

.map .maplibregl-canvas { outline: none; }
.map .maplibregl-ctrl-attrib { background: color-mix(in oklab, var(--paper) 70%, transparent); color: var(--ink-muted); font: 11px/1.4 var(--font-ui); }
.map .maplibregl-ctrl-attrib a { color: var(--ink-soft); }
.map .maplibregl-ctrl-attrib-button { filter: invert(1) brightness(1.4); }
/* 44 px targets on small drawings (EXPERIENCE §9): the attribution's « i », the pins */
.maplibregl-ctrl-attrib-button::after { content: ""; position: absolute; inset: -10px; border-radius: 50%; }
.pin::after { content: ""; position: absolute; inset: -4px; border-radius: inherit; }
.map-fallback { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(360px, 80%); text-align: center; color: var(--ink-soft); }
.map-fallback .lost-orbs { margin: 0 auto 18px; }

.pins { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.pin, .cluster { position: absolute; left: 0; top: 0; pointer-events: auto; transform: translate(-50%, -50%); will-change: translate; }
.pin.is-occluded, .cluster.is-occluded { visibility: hidden; }

/* compact pin (region zooms): the portrait in a universe ring */
.pin {
  display: inline-flex; align-items: center; gap: 0; padding: 3px; border-radius: var(--r-pill);
  background: var(--card); color: var(--ink); box-shadow: var(--shadow-pin), inset 0 0 0 1px var(--line-strong);
  font-size: 12px; font-weight: 650; white-space: nowrap; cursor: pointer;
  /* a breath of 3.6 s (1 → 1.035 → 1), each pin at its own rhythm and moment (plan §5) */
  animation: breathe var(--breath-d, 1.8s) ease-in-out var(--breath, 0s) infinite alternate;
  transition: background-color 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out), color 0.35s, padding 0.45s var(--ease-out), gap 0.45s var(--ease-out), scale 0.45s var(--ease-out);
}
@keyframes breathe { from { scale: 1; } to { scale: 1.035; } }
.pin-portrait { width: 30px; height: 30px; font-size: 0.72rem; box-shadow: inset 0 0 0 2px color-mix(in oklab, var(--u) 85%, transparent); }
.pin-body { display: inline-flex; align-items: center; gap: 6px; max-width: 0; overflow: hidden; opacity: 0; transition: max-width 0.45s var(--ease-out), opacity 0.3s; }
.pin-icon { display: inline-grid; color: var(--u); }
.pin-icon .uicon { width: 15px; height: 15px; }
.pin-trade { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.pin-name { display: none; color: var(--ink-soft); font-weight: 600; }
/* full capsules (city and street) */
.pins.is-full .pin { gap: 7px; padding: 3px 12px 3px 3px; }
.pins.is-full .pin-body { max-width: 240px; opacity: 1; }
/* hot: cyan, larger, name visible, in front */
.pin.is-hot, .pin:focus-visible { background: var(--cyan); color: var(--on-cyan); box-shadow: 0 0 0 4px var(--cyan-soft), 0 10px 28px -8px var(--cyan-glow); animation: none; scale: 1.18; gap: 7px; padding: 3px 12px 3px 3px; z-index: 30; }
.pin.is-hot .pin-body, .pin:focus-visible .pin-body { max-width: 420px; opacity: 1; }
.pin.is-hot .pin-trade, .pin:focus-visible .pin-trade { max-width: none; }
.pin.is-hot .pin-name, .pin:focus-visible .pin-name { display: inline; color: var(--on-cyan); }
.pin.is-hot .pin-icon, .pin:focus-visible .pin-icon { color: var(--on-cyan); }
.pin.is-hot .pin-portrait, .pin:focus-visible .pin-portrait { box-shadow: inset 0 0 0 2px var(--on-cyan); }
.pin:focus-visible { outline: none; }
.pin.is-selected { box-shadow: 0 0 0 2px var(--cyan-deep), var(--shadow-pin); }
/* fully booked / on a break / not matching: dimmed by colour, never by opacity (contrast of inactive states) */
.pin[data-state="fully_booked"]:not(.is-hot), .pin[data-state="paused"]:not(.is-hot), .pin.is-dim:not(.is-hot) { background: var(--paper); color: var(--ink-muted); box-shadow: var(--shadow-pin), inset 0 0 0 1px var(--line); }
.pin.is-dim:not(.is-hot) .pin-portrait, .pin[data-state="fully_booked"]:not(.is-hot) .pin-portrait, .pin[data-state="paused"]:not(.is-hot) .pin-portrait { filter: grayscale(0.85) brightness(0.78); }
.pin[data-state="fully_booked"]:not(.is-hot) .pin-icon, .pin[data-state="paused"]:not(.is-hot) .pin-icon, .pin.is-dim:not(.is-hot) .pin-icon { color: var(--ink-muted); }
/* fully booked / on a break: a small badge on the portrait says which (IDENTITY §5), the date shows when hovered */
.pin-badge { position: absolute; left: 22px; top: 20px; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; background: var(--ink-muted); color: var(--paper); box-shadow: 0 0 0 2px var(--paper); }
.pin-badge .icon { width: 11px; height: 11px; }
.pin { position: absolute; }
.pin.is-hot .pin-badge { background: var(--on-cyan); color: var(--cyan-deep); box-shadow: 0 0 0 2px var(--cyan-deep); }
.pin.is-remote .pin-portrait .orbit { inset: -5px; }

.cluster {
  display: grid; place-items: center; width: var(--s, 44px); height: var(--s, 44px); border-radius: 50%; cursor: pointer;
  background: var(--card); color: var(--ink); box-shadow: var(--shadow-pin);
  font-weight: 750; font-size: 14px; font-variant-numeric: tabular-nums;
  transition: background-color 0.3s, transform 0.3s;
}
.cluster::before { content: ""; position: absolute; inset: 0; border-radius: 50%; padding: 3px; background: var(--ring);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.cluster:hover, .cluster:focus-visible { background: var(--raised); outline: none; box-shadow: 0 0 0 3px var(--cyan-deep), var(--shadow-pin); }
.cluster-count { position: relative; }

.ripple { position: absolute; left: 0; top: 0; border-radius: 50%; pointer-events: none; z-index: 1;
  /* a 70-px band: the 2-px line and a 34-px glow spread 18 px on each side */
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--cyan) 60%, transparent), 0 0 34px 18px color-mix(in oklab, var(--cyan) 13%, transparent), inset 0 0 34px 18px color-mix(in oklab, var(--cyan) 8%, transparent); }

.map-tip {
  position: absolute; left: 0; top: 0; z-index: 40; max-width: 300px; padding: 10px 14px; border-radius: var(--r-sm); pointer-events: none;
  background: var(--card); box-shadow: inset 0 0 0 1px var(--line-strong), var(--shadow-2); color: var(--ink-soft); font-size: 13px; line-height: 1.45;
}
.tip-names, .tip-meta { color: var(--ink); font-weight: 700; }
.tip-meta { margin-top: 6px; font-size: 12px; color: var(--ink-muted); }
.tip-quote { color: var(--ink); }
.tip-universe { display: flex; align-items: center; gap: 6px; margin: 4px 0 6px; color: var(--u); font-size: 12px; font-weight: 650; }
.tip-universe .uicon { width: 14px; height: 14px; }

/* ---------------------------------------------------------------- controls and legend */
.map-ui { position: absolute; right: 16px; top: calc(var(--header-h) + 16px); z-index: 5; display: grid; justify-items: end; gap: 10px; transition: opacity 0.4s; }
.map-ui.is-hidden { opacity: 0; pointer-events: none; }
.map-buttons { display: grid; gap: 4px; padding: 4px; border-radius: var(--r-pill); background: var(--glass); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: inset 0 0 0 1px var(--line-strong), var(--shadow-1); }
.map-btn .icon { width: 19px; height: 19px; }
.map-btn.is-busy { color: var(--cyan-deep); animation: spin-soft 1.2s linear infinite; }
@keyframes spin-soft { to { rotate: 360deg; } }
.map-switch { padding: 0 14px 0 8px; border-radius: var(--r-pill); background: var(--glass); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: inset 0 0 0 1px var(--line-strong), var(--shadow-1); font-size: var(--step--1); font-weight: 650; }
.map-legend {
  width: min(340px, calc(100vw - 32px)); padding: 14px 16px 16px; border-radius: var(--r-md); background: var(--card);
  box-shadow: inset 0 0 0 1px var(--line-strong), var(--shadow-2); font-size: 13px; color: var(--ink-soft);
}
.legend-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.legend-head h2 { font-size: var(--step-1); }
.map-legend h3 { font-family: var(--font-ui); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); margin: 12px 0 6px; font-weight: 700; }
.legend-list { display: grid; gap: 8px; }
.legend-list li { display: grid; grid-template-columns: 60px 1fr; align-items: center; gap: 12px; line-height: 1.35; }
.lg { width: 60px; height: 24px; }
.lg-dot { justify-self: center; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 750; }
.lg-glow { background: radial-gradient(circle, var(--cyan-deep) 0 16%, rgba(25, 240, 255, 0.45) 30%, rgba(25, 240, 255, 0) 70%); }
.lg-cluster { width: 26px; height: 26px; background: var(--card); box-shadow: inset 0 0 0 3px var(--universe-build), var(--shadow-pin); color: var(--ink); }
.lg-hot { background: var(--cyan); box-shadow: 0 0 0 3px var(--cyan-soft); }
.lg-dim { background: var(--paper); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.lg-remote { background: var(--card); outline: 1.5px dashed var(--ink-muted); outline-offset: 3px; }
.map-note { display: flex; align-items: flex-start; gap: 8px; max-width: 280px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--glass); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: inset 0 0 0 1px var(--line-strong); font-size: 12.5px; color: var(--ink-soft); }
.map-note .icon { color: var(--cyan-deep); width: 16px; height: 16px; margin-top: 2px; }
@media (max-width: 1127px) {
  .map-ui { top: auto; bottom: calc(96px + env(safe-area-inset-bottom)); }
}
.map-area-search { position: absolute; z-index: 6; transform: translateX(-50%); box-shadow: var(--shadow-2); }
.map-area-search .icon { width: 18px; height: 18px; }
.dust { position: absolute; left: 0; top: 0; pointer-events: none; }
